Q: is "access-control-allow-origin" a secure way to restrict communication between two servers? I have two servers, A and B. I want server B to only accept HTTP requests from server A.
is "access-control-allow-origin" a secure way to implement that?

A: No.
HTTP headers is sent from server to client, or client to server. It's fine for protecting a cooperating client against attacks on the client, but it's not fine for protecting the server against anything. Any client is free to ignore it if it so desires; there's nothing the server can do to enforce it.
Implement real authentication, such as TLS client certificates, bearer tokens or a similar scheme.


Q: How to write two media quires in a single css file? I have the following code in my css file
@media (max-width:1000px) and (min-width:400px) {
    .tooltiptext {
        margin-left: 10em !important;
    }
    .homeInternetToolTip .tooltiptext i {
        left: 9% !important;
    }
}

@media (min-width:1000px) and (max-width:1400px) {
    .tooltiptext {
        margin-left: 3em !important;
    }
}

I am getting a error at 2nd query stating '{'} is needed.

A: I don't seem to have an issue. Please find the code below

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Document</title>
    <style>
      @media (max-width: 1000px) and (min-width: 400px) {
        .tooltiptext {
          margin-left: 10em !important;
        }
        .homeInternetToolTip .tooltiptext i {
          left: 9% !important;
        }
      }
      @media (min-width: 1000px) and (max-width: 1400px) {
        .tooltiptext {
          margin-left: 3em !important;
        }
      }
    </style>
  </head>
  <body></body>
</html>

A: You can use as many @media queries as you want in a single css file, or also inside style tag. But when I copied your code in editor your } bracket at the end have some character code issue, either it is some other character that looks like }, or it have an invisible whitespace character after it making it not actually a }. So in your code remove the last bracket and type again from keyboard, don't copy from anywhere.


Q: How to ping ip in js or node js I create electron app which check availability of ip. To check availability you should ping ip. I use fetch api and with domens it work all right, but if i try to ping ip in local network like 192.168.1.190 i getting rejecting, but if i ping it by cmd ping it getting me successful result. I found library ping but it working like fetch and getting rejecting local ips. How should i ping?
P.S
ip like 8.8.8.8 also return rejecting in fetch api, but in cmd ping all right.

A: Using icmp package:
const icmp = require('icmp');

icmp.send('8.8.8.8', "Hey, I'm sending a message!")
    .then(obj => {
        console.log(obj.open ? 'Done' : 'Failed')
    })
    .catch(err => console.log(err));

A: if you use nodejs, you could use exec to call system ping command.
const exec = require('child_process').exec;
function process(error, stdout, stderr) {
    //TODO: process result or logging.
}
exec("ping -c 3 localhost", process);

Or you can use 3rd party libraries.
https://github.com/nospaceships/node-net-ping


Q: gwt-rpc deserialization rpc string I have gwt-rpc response string, for example:
//OK[1,["19.04.2011 10:49"],0,5]

I need to deserialize it. In the best way I want to do it with php, but as I know there are no ready solutions. So, is gwt-rpc serialization algorithm is open source and I can try implement it in php?
Or may be I can to develope some java application ( as proxy ) to deserialize it and send to php?


Q: Type issue when using data from php with Swift I try to fill a table view with data downloaded from my database with Alamofire. I created a new NSObject class as followed :
class Repas: NSObject {
    var date: String
    var choix: String
    var note: Int

    init(date: String, choix: String, note: Int) {
        self.date = date
        self.choix = choix
        self.note = note
        super.init()
    }
}

The downloaded date respect this model format but when I try to insert them I got an error: cannot assign a value of type 'String?' to a value of type '[Repas]'.
I tried to force casting but it doesn't work. I don't understand how I can access my data with this method.


Q: Message from paypal sandbox: "The currency of this PayPal transaction must match the currency of the merchant account" Paypal mobile SDKs are deprecated, people suggested to use braintree. I'm creating a demo iOS app.
This the error message i'm getting from server side: "The currency of this PayPal transaction must match the currency of the merchant account".
The currency code i'm passing is PHP.
Paypal automatically converts some currencies and PHP is not one of them.
Is there any additional setup i need to do for this currency conversion?
Here is the code on client side:
class ViewController: UIViewController {

var btClient: BTAPIClient?
var dataCollector: BTDataCollector?

override func viewDidLoad() {
    super.viewDidLoad()

    self.btClient = BTAPIClient(authorization: tokenizationKey)
    self.dataCollector = BTDataCollector(apiClient: btClient!)

}
@IBAction func buttonTouchUpInside(_ sender: Any) {
    startCheckout()
}

@objc func startCheckout() {
    let payPalDriver = BTPayPalDriver(apiClient: self.btClient!)
    payPalDriver.viewControllerPresentingDelegate = self
    payPalDriver.appSwitchDelegate = self
    let payPalRequest = BTPayPalRequest(amount: "1000.00")
    payPalRequest.currencyCode = "PHP"

    payPalRequest.lineItems = [.init(quantity: "1", unitAmount: "1000", name: "Item name", kind: .debit)]

    payPalRequest.isShippingAddressEditable = true
    payPalRequest.isShippingAddressRequired = true

    //Shipping address
    let postalAddress = BTPostalAddress()
    postalAddress.streetAddress = "1234 Main St."
    postalAddress.countryCodeAlpha2 = "PH"
    postalAddress.extendedAddress = "Unit 1"
    postalAddress.locality = "Chicago"
    postalAddress.postalCode = "60652"
    postalAddress.recipientName = "Jhon doe"
    postalAddress.region = "IL"
    payPalRequest.shippingAddressOverride = postalAddress

    payPalDriver.requestOneTimePayment(payPalRequest) { (tokenizedPayPalAccount, error) -> Void in
        if let tokenizedPayPalAccount = tokenizedPayPalAccount {
            print("nonce: \(tokenizedPayPalAccount.nonce)")
            self.dataCollector?.collectDeviceData() { deviceData in
                self.sendRequestPaymentToServer(nonce: tokenizedPayPalAccount.nonce, amount: "1000.00", deviceData: deviceData)
            }
        } else if let error = error {
            print(error.localizedDescription)
        } else {
            print("cancelled")
        }
    }
}

func sendRequestPaymentToServer(nonce: String, amount: String, deviceData: String) {
    print("payment_method_nonce=\(nonce)&amount=\(amount)&deviceData=\(deviceData)")
    let paymentURL = URL(string: "http://localhost/newServer/pay.php")!
    var request = URLRequest(url: paymentURL)
    request.httpBody = "payment_method_nonce=\(nonce)&amount=\(amount)&deviceData=\(deviceData)".data(using: String.Encoding.utf8)
    request.httpMethod = "POST"

    URLSession.shared.dataTask(with: request) { [weak self] (data, response, error) -> Void in
        guard let data = data else {
            print(error!.localizedDescription)
            return
        }
        print(String(decoding: data, as: UTF8.self))
        guard let result = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any], let success = result["success"] as? Bool, success == true else {
            print("Transaction failed. Please try again.")
            return
        }

        print("Successfully charged. Thanks So Much :)")
        }.resume()
    }
}

This is the code on server side:
$paymentMethodNonce =  $_POST['payment_method_nonce'];
$amount = $_POST['amount'];
$deviceData = $_POST['deviceData'];

$result = $gateway->transaction()->sale([
    'amount' => $amount,
    'paymentMethodNonce' => $paymentMethodNonce,
    'options' => [
        'submitForSettlement' => true
    ],
    'deviceData' => $deviceData
]);

echo json_encode($result);

A: self.btClient = BTAPIClient(authorization: tokenizationKey)

A tokenization key can only be used for a full Braintree gateway integration. Such an integration requires setting up the new currency, PHP, on the gateway sandbox and later production accounts that you are using for processing. If you want to use the Braintree gateway in production, your business needs to apply and be approved for this.
So basically, you need to set up PHP in your gateway interface if you are going to use that new currency with the above integration method.

To instead use the Braintree SDK with PayPal more directly (no gateway account), the credential you need to use for authentication first is an access token.  Use the access token on your server to obtain a client token, which your client will fetch as needed: https://developers.braintreepayments.com/guides/authorization/client-token
A sandbox PayPal Braintree access token can be obtained from the bottom of: https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplication (For live mode, via https://www.paypal.com/api )


Q: Calculated measure which returns average number of site key per day I am trying to create a calculated measure which  returns average number of site keys per day.
Fact table looks like below.

Formula for measure is sum of number of distinct keys of each day divided by number of days for that month..
Calculated Measure = SUM(Distinct Keys of Day1, Distinct Keys of Day2,....Distinct Keys of last day of month)/ Number of days of month.
Any suggestion is appreciated and Thanks in Advance.

A: From my point of view your calculated member will be something like:
SET [Used Keys] AS
  NONEMPTY([Key].[Key].[Key], [Measures].[Count])
MEMBER [AVG Keys] AS
  AVG(
    [Date].[Month].&[2017-01].Children,
    DistinctCount([Used Keys])
)


Q: Не всплывает UIToolBar после нажатия на кнопку У меня есть кнопка, которая отображает дату. При нажатии на нее можно поставить любую другую дату - снизу должен всплыть UIToolBar с UIDatePicker
class AddNewOperationVC: UIViewController {
    let dateButton: UIButton = {
        let button = UIButton()
        return button
    }()
    let datePicker: UIDatePicker = {
        let picker = UIDatePicker()
        picker.timeZone = NSTimeZone.local
        picker.datePickerMode = .date
        picker.preferredDatePickerStyle = .wheels
        return picker
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        setDatePickerButton(button: dateButton, picker: datePicker)

        self.dateButton.addTarget(self,
            action: #selector(createToolbarAction),
            for: .touchUpInside)
    }
}

extension AddNewOperationVC {
    func setDatePickerButton(button: UIButton, picker: UIDatePicker) {
        let dateFormatter = DateFormatter()
        dateFormatter.dateStyle = .medium
        dateFormatter.timeStyle = .none

        let nowDate = dateFormatter.string(from: datePicker.date)

        button.layer.cornerRadius = 8
        button.layer.borderWidth = 1

        button.layer.borderColor = UIColor.black.cgColor
        button.backgroundColor = .systemBackground

        button.setTitle("Today, \(nowDate)", for: .normal)
        button.setTitleColor(.black, for: .normal)

        button.easy.layout([Height(56)])
    }

    @objc func createToolbarAction() -> UIToolbar { // Всплывающий снизу DatePicker
        let toolbar = UIToolbar()
        toolbar.sizeToFit()

        let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: nil, action: #selector(doneButtonPressed))
        toolbar.setItems([doneButton], animated: true)

        return toolbar
    }

    @objc func doneButtonPressed() {
        let dateFormatter = DateFormatter()
        dateFormatter.dateStyle = .medium
        dateFormatter.timeStyle = .none

        self.dateButton.setTitle(dateFormatter.string(from: datePicker.date), for: .normal)
        self.view.endEditing(true)
    }
}

С UITextField у меня спокойно всплывало это меню, но когда начал переделывать под кнопку, toolBar больше не работает (проверил с помощью брейкпоинтов, кнопка при нажатии заходит в функцию createToolbarAction, но ничего не происходит


Q: Image upload endpoint using jax-rs WITHOUT Jersey How do you create an endpoint for someone to upload a image using jax-rs without jersey?
this is the code I have written:
@POST
@Path("/uploadImage/")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(@QueryParam("uan") String uan, InputStream stream) {
    try {
        byte[] attachmentBytes = IOUtils.toByteArray(stream);
        BufferedImage image = ImageIO.read(new ByteArrayInputStream(attachmentBytes));
        return Response.ok().build();
    } catch (IOException e) {
        System.out.print(e);
        return Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).build();
    }

}

When I hit the endpoint with or without file I get a 200 OK response.
There are many examples of creating an file upload endpoint using Jersey however i do not want to have to import Jersey just for this one task.
This post has an answer using Jersey that does what I want to do:
FileUpload with JAX-RS


Q: Is it possible to have use vanilla CSS files in Magento 2 via a child theme? I understand that it's built to compile .less files, but I'd really like to be able add vanilla CSS files in a nice way.

A: Yes this is absolutely possible. The less files just get compiled into css in the pub directory. To add your own static css files you will just put them in your css directory (/app/design/frontend/{vendor}/{theme}/web/css) and they will be accessed just like any less compiled css file.
Depending on your magento configuration you may need to first run bin/magento setup:static-content:deploy from your magento installation's root directory.


Q: angular Manually trigger validation on input I have a template-driven form with an <input> bound to [(ngModel)] and would like to manually trigger all Validators I placed on it, would it be possible ?
If you're interested to know why I would like this kind of behavior I would say that in the case of a custom Validator with dynamics rules (or dependent of variables) when a rules change we would need to check the <input> to seek for errors.
<input type="text" customValidator [(ngModel)]="onlyLetters" required />


Q: Request explanation on the behaviour of pointers in array I m running this using rextester (online compiler). I followed a tutorial but there is something I don't understand.
I thought it would be better to write my question directly inside the code.
//gcc 5.4.0

#include <stdint.h>
#include  <stdio.h>

uint8_t var1 = 17;
uint8_t var2 = 23;
uint8_t arr[] ={7,9,11};

uint64_t *ptr1;//pointer
uint64_t *ptr2;
uint64_t *ptr3;

int main(void)
{

    printf("var1: %d\n", var1) ;

    //connecting pointer to address
    ptr1 = &var1;
    printf("address of ptr1: %d\n", ptr1) ;
    printf("value of ptr1: %d\n\n", *ptr1) ;

    //connecting pointer to address + 1
    ptr2 = &var1 +1;
    printf("address of ptr2: %d\n", ptr2) ;

    //assign value to pointer
    *ptr2 = var2;
    printf("value of ptr2: %d\n\n", *ptr2) ;

    //try on array
    ptr3= &arr;//no need to point element 0, or yes?
    printf("address of ptr3: %d\n", ptr3) ;
    printf("value of ptr3: %d\n\n", *ptr3) ;//i expect 7
    return 0;
}

Any help would be very appreciate to help me understand the right behaviour of pointers in c and cpp
I made a lot of tries but i m not able to link a pointer to an array
Edit after response of mato:
Do you think this is a clean way to work with pointer and array? Or there are better solution which take care of not overwriting memory?
//gcc 5.4.0

#include <stdint.h>
#include  <stdio.h>

uint16_t var = 17;
uint16_t arr[] ={3,5,7,11,13};
uint16_t *ptr;

int main(void)
{

printf("var: %d\n", var) ;

//connecting pointer to address
ptr = &var;
printf("address of ptr: %d\n", ptr) ;
printf("value of ptr: %d\n\n", *ptr) ;

//try on array
for (uint16_t n =0;n<5;n++){
ptr= &arr[n] ;
printf("item: %d value: %d ads: %d pointer: %d\n", n, arr[n], ptr, *ptr) ;
}
return 0;
}

A: You are doing many mistakes. Up to the point, that g++ does not compile the code and explains why pretty good.
Pointer is an address. There is no "connecting pointer to address". ptr1 = &var1; means literally "store address of var1 in variable named ptr1"
You use incompatible pointer types. So as long as you dereference it (e.g. using *) you are going into undefined behaviour.
I am pretty sure you can reinterpret any type of data as char* or unsigned char*, I image this is true for equivalent types like uint8_t, i.e. single byte types.
You, however, are going the other way, you declare 1-byte data, and are pretending it's a 4 byte int. Basically you force the program to read memory out the variable bounds.
Fact, that *ptr1 and *ptr2 give result you expect is a rather lucky coincidence. Probably memory behind them was zeroed. For ptr3 it isn't because you have filled it with other element of the array (7 and 9).
I believe you also use wrong type specifier for printing. %d is for int, uint8_t should be described as hhu and uint64_t as lu. I am not 100% convinced how fatal this is, because of platform specific widths and integer promotions.
You should use matching types for your pointers and variables.

A: It seems that you do understand what pointers are and you can use them with basic types.
There are two problems in your code. First is this part:
//connecting pointer to address + 1
ptr2 = &var1 + 1;

Here you assigned some address to variable ptr2. Up to this point there is nothing dangerous about that.
But then you assign a value to memory at that address
//assign value to pointer
*ptr2 = var2;

This is dangerous because you, as a developer, don't know what is stored at that address. Even if you are lucky right now, and that part of memory isn't being used for anything else, it will most likely change once your program gets longer and then you will have hard time searching for the bug.
Now arrays usually are a bit confusing, because when you create an array like this:
uint8_t arr[] = {7,9,11};

three things happen.

*

*Your program allocates continual block of memory, that fits 3 variables of type uint8_t. The 3 variables in this context are called elements.

*The elements will get the provided initial values 7, 9 and 11.

*An address of first element (the one that contains value 7) will be stored in arr.

So arr is actually of type uint8_t *.
In order to get the last part do what you expect, you just need to change this one line (remove the &):
ptr3 = arr;

EDIT: BTW watch and understand this course and you will be expert on C memory manipulation. Video is a bit dated, but trust me, the guy is great.
EDIT2: I just realised the other answer is absolutely correct, you really need to match the types.


Q: How to draw commutative diagrams in Tikz One of my friends can draw simple commutative diagrams in TikZ but he cannot draw this one:

I am not an expert in TikZ so I was wondering if someone could help with drawing this one in TikZ.

A: For this diagram, I would actually give up on using relative placements, and just spec out explicit node placements for everything. This, combined with a number of standard tikz styling tips, including:

*

*[>->], [>->>] and [->>] for arrow styling

*edge node {..} and edge node[swap] {..} to place labels on arrows

*edge [bend right] and edge [bend left] to produce the curvy arrows

*[dashed] and [double equal sign distance] for line styling

*[anchor=east] to make sure the left hand row labels can grow freely without running in over the diagram

makes the diagram straightforward:
\begin{tikzpicture}[scale=2,auto]
  \node [anchor=east] at (-.5,3) {$e_2 : $};
  \node (n2) at (0,3) {$N_2$};
  \node (g2) at (1,3) {$G_2$};
  \node (q2) at (2,3) {$Q_2$};
  \draw [>->] (n2) edge node {$\kappa_2$}  (g2);
  \draw [->>] (g2) edge node {$\pi_2$} (q2);

  \node [anchor=east] at (-.5,2) {$\tilde e : $};
  \node (n1xn2) at (0,2) {$N_1\times N_2$};
  \node (gn) at (1,2) {$\tilde G$};
  \node (q) at (2,2) {$Q$};
  \draw [>->] (n1xn2) edge node {$\lambda$}  (gn);
  \draw [->>] (gn) edge node {$\rho$} (q);
  \draw [->>] (n1xn2) edge node[swap] {$\sigma_2$} (n2);
  \draw [->>] (gn) edge node[swap] {$\tau_2$} (g2);
  \draw [>->>] (q) edge node[swap] {$\gamma_2$} (q2);

  \node [anchor=east] at (-.5,1) {$e_1\times A : $};
  \node (n1xa) at (0,1) {$N_1\times A$};
  \node (g1xa) at (1,1) {$G_1\times A$};
  \node (q11) at (2,1) {$Q_1$};
  \draw [>->] (n1xa) edge  (g1xa);
  \draw [->>] (g1xa) edge (q11);
  \draw [>->] (n1xn2) edge node {$\sigma$} (n1xa);
  \draw [>->] (gn) edge node {$\beta$} (g1xa);
  \draw [>->>] (q) edge node {$\gamma_1$} (q11);

  \node [anchor=east] at (-.5,0) {$nat'(e_1\times A)=\frac{e_1\times A}{\alpha N_1} : $};
  \node (n1xaf) at (0,0) {$\frac{N_1\times A}{\alpha N_1}$};
  \node (g1xaf) at (1,0) {$\frac{G_1\times A}{\beta\lambda N_1}$};
  \node (q10) at (2,0) {$Q_1$};
  \draw [>->] (n1xaf) -- (g1xaf);
  \draw [->>] (g1xaf) -- (q10);
  \draw [->>] (n1xa) edge node {$nat'$} (n1xaf);
  \draw [->>] (g1xa) edge node {$nat$} (g1xaf);
  \draw [double equal sign distance] (q11) -- (q10);

  \node [anchor=east] at (-.5,-1) {$e_1\times A : $};
  \node (n1xad) at (0,-1) {$N_1\times A$};
  \node (g1xad) at (1,-1) {$G_1\times A$};
  \node (q1d) at (2,-1) {$Q_1$};
  \draw [>->] (n1xad) -- (g1xad);
  \draw [->>] (g1xad) -- (q1d);
  \draw [->>] (n1xad) edge node[swap] {$nat'$} (n1xaf);
  \draw [->>] (g1xad) edge node[swap] {$nat$} (g1xaf);
  \draw [double equal sign distance] (q1d) -- (q10);

  \node [anchor=east] at (-.5,-2) {$e_1 : $};
  \node (n1) at (0,-2) {$N_1$};
  \node (g1) at (1,-2) {$G_1$};
  \node (q1dd) at (2,-2) {$Q_1$};
  \draw [>->] (n1) edge node {$\kappa_1$} (g1);
  \draw [->>] (g1) edge node {$\pi_1$} (q1dd);
  \draw [->] (n1) edge node[swap] {$\mu'$} (n1xad);
  \draw [->] (g1) edge node[swap] {$\mu$} (g1xad);
  \draw [double equal sign distance] (q1dd) -- (q1d);

  \draw[>->,dashed] (n1) edge[bend left] (n1xaf);
  \draw[>->,dashed] (g1) edge[bend left] (g1xaf);
  \draw[>->,dashed] (n1xn2) edge[bend right] (n1xaf);
  \draw[>->,dashed] (gn) edge[bend right] (g1xaf);

\end{tikzpicture}

A bit tedious, but entirely straightforward. Gives the resulting diagram:

A: I would use a \matrix for the node positioning.  Matrices automatically name their cells, but I would give them their own names as I find it hard to remember which entry is in which cell but easier if they have names.  I chose the names fairly arbitrarily since there are a few cells with repeated contents.
I would also gather together the arrows into "types" and draw them with a single command.  To get lots of arrows with a single command it is necessary to use the edge path construction (not necessary if only drawing a single arrow per command).
Other than that, this is fairly similar to Mikael's version.
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}

\DeclareMathOperator{\nat}{nat}

\tikzset{
  label lines/.style={
    every node/.style={
      auto, % puts the label to one side of the line
% sometimes we need to "swap" the side with the 'swap' key
      maths labels
    }
  },
% This means we don't have to put the arrow labels in \(...\)
  maths labels/.style={
    execute at begin node=\(,
    execute at end node=\)
  }
}

\begin{document}
\begin{tikzpicture}
\matrix[
  matrix of math nodes, % to avoid having to put everything in \(..\)
  row sep={between origins, 2cm}, % space things out a bit vertically
  column sep={between origins,3cm}, % and horizontally
  nodes={anchor=center}, % makes the arrows straighter
  column 1/.style={every node/.append style={left}} % line up first column on colons
] (cd) {
|[name=e2]|  e_2 \colon &[-2cm] % squeeze the first column in a bit
|[name=n2]| N_2 &|[name=g2]| G_2 &|[name=q2]| Q_2 \\
%
|[name=e]|  \tilde{e} \colon &|[name=n1n2]| N_1 \times N_2 &|[name=g]| \tilde{G} &|[name=q]| Q \\
%
|[name=e1a]|  e_1 \times A \colon &|[name=n1a]| N_1 \times A &|[name=g1a]| G_1 \times A &|[name=q1]| Q_1 \\
%
|[name=ne1a]|  \displaystyle\nat'(e_1 \times A) = \frac{e_1 \times A}{\alpha N_1} \colon &|[name=nn1a]| \displaystyle\frac{N_1 \times A}{\alpha N_1} &|[name=ng1a]| \displaystyle\frac{G_1 \times A}{\beta \lambda N_1} &|[name=nq1]| Q_1 \\
%
|[name=e1a2]|  e_1 \times A \colon &|[name=n1a2]| N_1 \times A &|[name=g1a2]| G_1 \times A &|[name=q1a2]| Q_1 \\
%
|[name=e12]|  e_1 \colon &|[name=n12]| N_1 &|[name=g12]| G_1 &|[name=q12]| Q_1\\
};
\draw[>->,label lines]
(n2) edge node {\kappa_2} (g2)
(n1n2) edge node {\lambda} (g)
(n1a) edge (g1a)
(nn1a) edge (ng1a)
(n1a2) edge (g1a2)
(n12) edge node {\kappa_1} (g12)
(n1n2) edge node {\alpha} (n1a)
(g) edge node {\beta} (g1a)
;
\draw[->>,label lines]
(g2) edge node{\pi_2} (q2)
(g) edge node{\rho} (q)
(g1a) edge (q1)
(ng1a) edge (nq1)
(g1a2) edge (q1a2)
(g12) edge node {\pi_1} (q12)
(n1n2) edge node[swap] {\sigma_2} (n2) % the 'swap' puts the label on the other side of the line
(g) edge node[swap] {\tau_2} (g2)
(n1a2) edge node[swap] {\nat'} (nn1a)
(n1a) edge node {\nat'} (nn1a)
(g1a2) edge node[swap] {\nat} (ng1a)
(g1a) edge node {\nat} (ng1a)
;
\draw[>->>,label lines]
(q) edge node {\gamma_1} (q1)
(q) edge node[swap] {\gamma_2} (q2)
;
\draw[->, label lines,swap]
(n12) edge node {\mu'} (n1a2)
(g12) edge node {\mu} (g1a2)
;
\draw[double,double distance=.5ex] (q1) -- (nq1) -- (q1a2) -- (q12);
\draw[->,dashed,bend right]
(n1n2) edge (nn1a)
(g) edge (ng1a)
;
\draw[>->,dashed,bend left]
(n12) edge (nn1a)
(g12) edge (ng1a)
;
\end{tikzpicture}
\end{document}

Result:

A: A solution with names like with a matrix but without matrix. It's more easy to scale the result. I use the scope library to draw the edges.
\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows ,scopes}

\begin{document}

\begin{tikzpicture}[xscale=1.5,yscale=3]

\path node   (m11) at (0,0) {$N_1$}         (-1,0) node[anchor=east] {$e_1$ \ :}
      node   (m12) at (3,0) {$G_1$}
      node   (m13) at (5,0) {$Q_1$}
      node   (m21) at (0,1) {$N_1\times A$} (-1,1) node[anchor=east] {$e_1\times A$ \ :}
      node   (m22) at (3,1) {$G_1\times A$}
      node   (m23) at (5,1) {$Q_1$}
      node   (m31) at (0,2) {$\displaystyle\frac{ N_1\times A}{\alpha A}$}
                      (-1,2)  node[anchor=east]{$nat'(e_1\times A)=
                                 \displaystyle\frac{ e_1\times A}{\alpha N_1}$ \ :}
      node   (m32) at (3,2) {$\displaystyle\frac{ G_1\times A}{\beta\lambda N_1}$}
      node   (m33) at (5,2) {$Q_1$}
      node   (m41) at (0,3) {$N_1\times A$} (-1,3) node[anchor=east] {$e_1\times A$ \ :}
      node   (m42) at (3,3) {$G_1\times A$}
      node   (m43) at (5,3) {$Q_1$}
      node   (m51) at (0,4) {$N_1\times N_2$} (-1,4) node[anchor=east] {$\tilde{e}$ \ :}
      node   (m52) at (3,4) {$\tilde{G}$}
      node   (m53) at (5,4) {$Q$}
      node   (m61) at (0,5) {$N_2$} (-1,5) node[anchor=east] {$e_2$ \ :}
      node   (m62) at (3,5) {$G_2$}
      node   (m63) at (5,5) {$Q_2$} ;
     { [ thick]
      \draw[>->]   (m61) -- node[above]{$\kappa_2$}      (m62);
      \draw[->>]   (m62) -- node[above]{$\pi_2$}    (m63);
      \draw[>->]   (m51) -- node[above]{$\lambda$}  (m52);
      \draw[>->>]  (m52) -- node[above]{$\beta$}    (m53);
      \draw[->>]   (m42) -- (m43);
      \draw[>->]   (m31) -- (m32);
      \draw[->>]   (m32) -- (m33);
      \draw[->>]   (m22) -- (m23);
      \draw[>->]   (m11) -- node[above]{$\kappa_1$}      (m12);
      \draw[->>]   (m12) -- node[above]{$n_1$}      (m13);

      {[>->,shorten >=.5cm]
      \draw        (m41) -- (m42);
      \draw        (m21) -- (m22);
      }

      {[->>]
      \draw   (m51) -- node[right]{$\sigma_2$} (m61);
      \draw   (m52) -- node[right]{$\tau_2$}   (m62);
      \draw   (m21) -- node[right]{nat'}       (m31);
      \draw   (m22) -- node[right]{nat}        (m32);
      \draw   (m41) -- node[right]{nat'}       (m31);
      \draw   (m42) -- node[right]{nat}        (m32);
      }
      \draw[->]    (m11) -- node[right]{$\mu'$}     (m21);
      \draw[->]    (m12) -- node[right]{$\mu$}      (m22);
      \draw[>->>]  (m53) -- node[right]{$\gamma_2$} (m63);
      \draw[>->>]  (m53) -- node[right]{$\gamma_1$} (m43);
      \draw[>->]   (m51) -- node[right]{$\alpha$}   (m41);
      \draw[>->]   (m52) -- node[right]{$\beta$}    (m42);
      {[dashed]
       {[->]
       \draw   (m51) to [out=-140,in= 140]      (m31);
       \draw   (m52) to [out=-140,in= 140]      (m32);
       }
       {[>->]
       \draw  (m11) to [out= 140,in=-140]      (m31);
       \draw  (m12) to [out= 140,in=-140]      (m32);}
       }
       \draw[double]  (m43)--(m33)--(m23)--(m13);
       }
\end{tikzpicture}
\end{document}


Q: SQL Query to conditionally select a row from a table depending on join existence I have a query that joins 3 tables and I am trying to retrieve a conditional set of rows depending on whether the record exists in the third table.
If there is a match in the 3rd table then I just want the matching records from the 1st table. if there isn't a match from the 3rd table then I just want one record from the first table.
select
o.Object_ID,
reqCon.Connector_ID,
req.Object_ID as Requirement_ID

from t_object o

left join t_connector reqCon on reqCon.End_Object_ID = o.Object_ID and reqCon.Stereotype = 'deriveReqt'
left join t_object req on reqCon.Start_Object_ID = req.Object_ID and req.Stereotype = 'functionalRequirement'

This produces the following type of result, but the ones highlight with  in Bold are the actual rows that are required.
Object_ID   Connector_ID    Requirement_ID
40936   43259
40936   43260
**40936 43299   38013**
40943   43264
40943   43265
**40943 43298   38014**
**44088 46245**
44088   46246
**42669 44655**
42669   44656
**42670 44657**
42670   44658

A: One solution is union all:
select o.Object_ID, reqCon.Connector_ID, req.Object_ID as Requirement_ID
from t_object o join
     t_connector reqCon
     on reqCon.End_Object_ID = o.Object_ID and
        reqCon.Stereotype = 'deriveReqt' join
     t_object req
     on reqCon.Start_Object_ID = req.Object_ID and
        req.Stereotype = 'functionalRequirement'
union all
select o.Object_ID, min(reqCon.Connector_ID), null as Requirement_ID
from t_object o left join
     t_connector reqCon
     on reqCon.End_Object_ID = o.Object_ID and
        reqCon.Stereotype = 'deriveReqt' left join
     t_object req
     on reqCon.Start_Object_ID = req.Object_ID and
        req.Stereotype = 'functionalRequirement'
group by o.Object_Id
having sum(req.Object_Id is not null) = 0;

The first query brings in the matches.  The second brings in the one row per object that has no match.


Q: Chart.js time scale not showing data I have a Chart.js chart which was displaying fine, until I added a time scale to it. The configuration looks like this:
    this.chart = new Chart(this.ctx, {
        type: 'line',
        data: data,
        options: {
            legend: {
                display: false
            },
            scales: {
                xAxes: [{
                    type: 'time',
                    time: {
                        unit: 'month',
                        format: 'timeFormat'
                    }
                }]
            }
        }
    });

And the data object looks like this:
let data = {
    labels: ["1485903600", "1490738400"],
    datasets: [{
        label: '',
        data: [120, 30],
        lineTension: 0
    }]
};

The x-axis displays the two dates correctly, and the y-axis is bounded by the correct limits (i.e. 120 and 30), but the data is not displaying on the graph.

A: The reason your chart is not displaying data when you converted to the time scale is because you are passing string values for your labels that the Date constructor is not able to parse.
The time scale expects either an integer (number of milliseconds since epoch), a Date object, a moment.js object, or a string representation of a date that is in a format that Date.parse() can understand.
So in your case, when the chart is rendered it can not create Date objects for the X axis (because of your label values), so it creates 2 date objects using new Date() (this is why the X axis still displays some date data...notice that it is 2017 dates because new Date() returns a Date initialized to right now).
To correct this, just convert the label values to integers (e.g. remove the quotes) and the chart will then display your data points.  The chart still looks funny however because the X scale is configured in units of month but your data values are only 1 day apart (1485903600 = Jan 17, 1970 10:45 PM and 1490738400 = Jan 18, 1970 12:05 AM).
Here is a codepen example that shows your original chart and the correct chart so you can see the difference.


Q: Rational Canonical Form related problem Let $V$ be a vector space over $\mathbb{C}$ and let $n=\mbox{dim}_{\mathbb{C}}(V)$ be finite. Let $T\in\hom_{\mathbb{C}}(V,V)$ and suppose that
for every $c\in\mathbb{C}$, $\{v\in V:Tv=cv\}$ has dimension no greater than $1$.
Then show that $\exists w\in V$ such that $\{w,Tw,\dots, T^{n-1}w\}$ is linearly independent.
My Attempt: The hypothesis suggest that the characteristic function of $T$ splits into distinct linear factors. Since the minimal polynomial divides the char poly and the char poly divides a power of the minimal polynomial, they have the same roots. But this means that the char poly is the minimal polynomial and it is of degree $n$. But this means that there is only one invariant factor (when applying the Fundamental Theorem of modules over PIDs and viewing $V$ as a $\mathbb{C}[x]$ module. So in particular $V$ is cyclic). Explicitly the image of $\bar{1}$ is a generator. Is this all correct?


Q: writing and adding newline after every line in json        first =  (str(personaggio["data"]["Character"]["name"]["first"]))
        last =  (str(personaggio["data"]["Character"]["name"]["last"]))
        immagine =  (str(personaggio["data"]["Character"]["image"]["large"]))
        print (f"{first} {last} {id}")
        data = {}
        data["personaggi"] = []
        data["personaggi"].append({
            "id":id,
            "character": [
                {'nome': first,
                'cognome': last,
                'img': immagine}
            ]
            })
        id += 1
        with open('idch.txt', 'w') as outfile:
            json.dump(data , outfile)

example output:
{"personaggi": [{"id": 65, "character": [{"nome": "Pinako", "cognome": "Rockbell", "img": "https://s4.anilist.co/file/anilistcdn/character/large/65.jpg"}]}]}

and the output is right. i just need to add new character in newline, like:
{"personaggi": [{"id": 65, "character": [{"nome": "Pinako", "cognome": "Rockbell", "img": "https://s4.anilist.co/file/anilistcdn/character/large/65.jpg"}]}]
           [{"id": 66, "character": [{"nome": "x", "y": "x", "img": "y"}]}]
           [{"id": 67, "character": [{"nome": "x", "y": "x", "img": "y"}]}]}

im getting the data for every character via a get request, and there isn't a list of all the id's. so i need to loop through every id. the loop is working and everything but i don't know how to print them in the .txt :(


Q: Is it possible to build an iPad app on the iPad? I would like to minimize the number of devices I would have to purchase to do iPad development so it would be nice if it did :)
I suspect the answer is no because I really doubt apple was kind enough to put an objective c compiler on the device. I guess an alternate question would be what is the cheapest apple platform I could use to build apps?

A: No, there is neither a compiler nor and IDE available for the iPad. You need a Mac to do iOS development, but even a cheap used Mac Mini will do (and no, you cannot do iOS development on Windows, I'm afraid).

A: You are correct.  Apple wants you to develop your apps on a Mac.

A: Here is a link to Apple's site describing what you need.  A mac with xcode is a requirement.

A: First to answer your "subject question": As far as I know, NO you cannot install Xcode development kit on an iPad and thereby producing new iPad software... Apple also would like you to buy a real Apple computer if you want to do real business with the platform.
BUT
With some effort and research, you can just buy an orignal Mac OSX 10.6 or newer. Then with some tweaking and fixes, you install this on ordinary PC hardware. This is because the Apple computers today also are running on Intel CPU's and PC motherboards.
Its not officially supported nor "okay" from Apple's licensing point of view, but once you get it running the computer / OS thinks its a real Mac and then you can run and compile Mac software as its running 100% as a Mac.
I've seen tests where the owner connected iPod and iPhones to iTunes and AppStore which didnt see anything unusual, so the owner was able to buy movies and music and applications as normally.
Same goes for installing pure Apple software such as Xcode and other Mac-Only software.
You can even install some boot-manager and be able to run Windows 7 and Mac OSX on a partioned harddrive I've been told.
The "thing" is called a Hackintosh. But I was warned that it is far from every piece of PC hardware that you can make run with Mac OSX, so a lot of studying is needed before succeeding I guess.

A: I am not sure if this app is compatible with ipad, but it can certainly MAKE your app. You still need the SDK to compile the code it generates, and you still need to purchase the dev program to release your app to the store.
Not to mention the functionality you can add is very limited, but it is the closest to developing on the device itself that you can get.

A: You could use the Notes app on an iPad, or a Javascript editing app, or a cloud hosted text editor from iPad Safari, to write HTML5/CSS/Javascript for a web app.  Upload the resulting web app source text plus a manifest to some web server, go to it in Safari with your iPad, test it, and save it as a web clipping web app.
That's for a web app.
If you want to build native iOS/iPad apps you need an Intel Mac running OS X 10.6.x (but even a cheaper old used Mini or iMac will do, as long as it can run Snow Leopard 10.6).
Or at least fast network access to a Mac.  You could remote access a Mac using one of the many VNC or other remote viewing apps for the iPad, and develop native iPad apps from an iPad that way, but it would still involve a Mac.


Q: repeating a button in a php while loop The following is a markup I have for displaying my database:
$html = '';
$database_enquiry = tep_db_query("(relevant database enquiry in here)");
while ($database = tep_db_fetch_array($database_enquiry)){
    $html .= '
';
    $html .= '      '.$myV['myVariable goes here'].'	';
    $html .= '      <button id="editDriver"></button><button id="timeDriver"></button>	';
    $html .= '
';
}

echo $html;

For some reason, the rows, are displaying in the loop, but the buttons are only showing up for the first row. Anyone know why?

A: IDs, as their name imply, should be unique to a document, you are duplicating the buttons IDs for every row.
Normaly most browsers don't make a fuss if you have dulicates (though they should), but it seems in your case, it's causing problems.
So, give your buttons unique IDs accross rows, or use classes to see if it helps:
$html .= '      <button class="editDriver"></button><button class="timeDriver"></button>	';

A: Could you write something between the button tag and add type attribute?
<button type="button">Something</button>

ref

A: There are 3 things you need to fix/check:

*

*The id attribute id unique. You should not have more than one per page

*

 tags should be inside a

 element.

*Maybe your query return a single row, in which case your code is working properly.

Also, you should check the official documentation for the button element: http://www.w3.org/wiki/HTML/Elements/button


Q: jquery calculated result should show image due to result I have a calculation which should show different images or text due to the result that is given.
for example, if the result is between 3 and 7 there should be image 1, if it is between 8 and 12 -> image 2.
i made a jsfiddle with the actual state: http://jsfiddle.net/utSYb/
<form id="calx">

Variable 1 	<input id="th" type="text" name="th[]" value="77" />

Variable 2 	<input id="ah" type="text" name="ah[]" value="132" />

Variable 3	<select name="ih" id="ih"><option value="45">1"</option><option value="51">2"</option></select>

Result	<input id="x" type="text" name="x[]" value="" data-formula="($ah-$th-$ih+2)" />

</form>

for your info, i am using this script: http://www.xsanisty.com/project/calx/
thanks

A: Try this
$('input').on('change', function () {
    var x = $('#x').val();
    if (x > 3 && x < 7) {
        //code to show image
    }
    //elseif for other statements and so on...
});

A: Something like this will sort you out:
if( result >= 3 && result <= 7 ){
    ... show image 1 ...
}else if( result >= 8  && result <= 12){
    ... show image 1 ...
}else{
    ... show default image . . .
}


Q: A question relating the the extension of probability from an algebra to a $\sigma$-algebra I was trying the prove that the following set  $\mathcal{B}$ is closed by difference i.e
$\forall A,B  \in \mathcal{B} \implies A\cap B^C \in \mathcal{B}$
$\mathcal{B}=\{A \in \mathcal{A}:P(A)=Q(A) \}$
where $\mathcal{A}$ is a sigma algebra and $P$ and $Q$ are two probabilities defined on $\mathcal{A}$, supposing that $P$ and $Q$ agree on a class $C \subset \mathcal{A}$  such that $\sigma(C)=\mathcal{A}$
Now it is clear that if I choose $A,B  \in \mathcal{A}$ then $A\cap B^C \in \mathcal{A}$
But I am struggling to show that $P(A\cap B^C )=Q(A\cap B^C )$
How could I do that? Could someone give me a hint. It is probably obvious but I can't see how to do it.
I mean  $P(A)=Q(A)$ and $P(B^C)=Q(B^C)$ follows directly from the definition of the set $\mathcal{B} $ given that $A,B \in \mathcal{B}$

A: Basically $\mathcal B$ defined like this is not closed by difference.
Let $x,y,z$ be distinct elements and define $P=\frac{1}{2}\delta_{x}+\frac{1}{2}\delta_{y}$
and $Q=\frac{1}{2}\delta_{y}+\frac{1}{2}\delta_{z}$.
Here $\delta_u$ stands for the Dirac-measure defined by $\delta_u(D)=1_D(u)$.
Now let $A,B$ be
measurable sets with $x\in A\cap B^{c}$, $y\in A\cap B$ and $z\in A^{c}\cap B$.
Then $A,B\in\mathcal{B}$, but $A\cap B^{c}\notin\mathcal{B}$.

edit (after edit of question):
In $\mathcal B$ we recognize a Dynkin system. Knowing that $\mathcal C$ is closed under finite intersections the Dynkin's π-λ theorem can be applied to conclude that $\mathcal B=\sigma(\mathcal C)=\mathcal A$.


Q: How to generate a wsdl using zend soap I'm trying to generate a wsdl file using the autodiscover class from the Zend framework. The resulting definition doesn't seem to become available and subsequent functionality doesn't work.
Below is the code that I'm using...
<?php

/**
 * Returns Hello World as a string.
 *
 * @return string
 */
 function hello( )
 {
  return "Hello World";
 }

 if( isset( $_GET['wsdl'] ) )
 {
  $autodiscover = new Zend_Soap_AutoDiscover();
  $autodiscover->addFunction( 'hello' );
  $autodiscover->handle();
 }
 else if( isset( $_GET['client'] ) )
 {
  $client = new Zend_Soap_Client( "http://localhost/service.php" );
  echo $client->hello();
 }
 else
 {
  $server = new Zend_Soap_Server( "http://localhost/service.php?wsdl" );
  $server->addFunction( 'hello' );
  $server->handle();
 }

?>

This all weems to fail silently, calling http://localhost/service.php?wsdl just dies silently and generates no WSDL definition. Could someone please give me an idea of what I'm doing wrong :)
Many thanks

A: I tried the code you posted, except that I added: require('Zend/Soap/AutoDiscover.php');. It worked.

A: Try adding docblocking to the hello function. the WSDL generator relies on it to generate proper WSDL file. http://framework.zend.com/manual/en/zend.soap.autodiscovery.html See the important notes in that link.

A: Yep, you are missing require('Zend/Soap/AutoDiscover.php'); that's all.


Q: PHP contact form issue (Method Not Allowed) PHP CODE
$name_error = $email_error =  "";
$name = $email = $message = $success = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $name_error = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
    if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
      $name_error = "Only letters and white space allowed";
    }
  }

  if (empty($_POST["email"])) {
    $email_error = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
      $email_error = "Invalid email format";
    }
  }

    if (empty($_POST["subject"])) {
    $subject_error = "Subject is required";
  } else {
    $subject = test_input($_POST["subject"]);
  }

  if (empty($_POST["message"])) {
    $message = "";
  } else {
    $message = test_input($_POST["message"]);
  }

  $to = "ayoub.kermout@gmail.com"
  $about = "GA:TC CONTACT RECIVED!!"
  $body = "Name: $name\nEmail: $email\nSubject: $subject\nMessage: $message"

  mail($to, $about, body, "From: $name <$email>")
  $success = "Message sent, thank you for contacting us!";
  $name = $email = $message = '';

}
}
?>

JAVASCRIPT CODE
(function($) {
  "use strict"; // Start of use strict

  // Smooth scrolling using jQuery easing
  $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
    if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
      if (target.length) {
        $('html, body').animate({
          scrollTop: (target.offset().top - 48)
        }, 1000, "easeInOutExpo");
        return false;
      }
    }
  });

  // Closes responsive menu when a scroll trigger link is clicked
  $('.js-scroll-trigger').click(function() {
    $('.navbar-collapse').collapse('hide');
  });

  // Activate scrollspy to add active class to navbar items on scroll
  $('body').scrollspy({
    target: '#mainNav',
    offset: 48
  });

  // Collapse the navbar when page is scrolled
  $(window).scroll(function() {
    if ($("#mainNav").offset().top > 100) {
      $("#mainNav").addClass("navbar-shrink");
    } else {
      $("#mainNav").removeClass("navbar-shrink");
    }
  });

  // Scroll reveal calls
  window.sr = ScrollReveal();
  sr.reveal('.sr-icons', {
    duration: 600,
    scale: 0.3,
    distance: '0px'
  }, 200);
  sr.reveal('.sr-button', {
    duration: 1000,
    delay: 200
  });
  sr.reveal('.sr-contact', {
    duration: 600,
    scale: 0.3,
    distance: '0px'
  }, 300);

  // Magnific popup calls
  $('.popup-gallery').magnificPopup({
    delegate: 'a',
    type: 'image',
    tLoading: 'Loading image #%curr%...',
    mainClass: 'mfp-img-mobile',
    gallery: {
      enabled: true,
      navigateByImgClick: true,
      preload: [0, 1]
    },
    image: {
      tError: 'The image #%curr% could not be loaded.'
    }
  });

})(jQuery);

HTML CODE

CONTACT FORM

Fill the form table down below to contact us.

Contact

          <form id="contact-form" class="form" action="mail/contact.php" method="post" role="form">

                  Your Name
                  <input type="text" class="form-control" id="name" name="name" placeholder="Your name" tabindex="1" required>

                  Your Email
                  <input type="email" class="form-control" id="email" name="email" placeholder="Your Email" tabindex="2" required>

                  Subject
                  <input type="text" class="form-control" id="subject" name="subject" placeholder="Subject" tabindex="3">

                  Message
                  <textarea rows="5" cols="50" name="message" class="form-control" id="message" placeholder="Message..." tabindex="4" required></textarea>

                  <button type="submit" class="btn btn-start-order">Send Message</button>

          </form>

PROBLEM:
As you can see that my PHP, JS, HTML code for the contact form, But for some reason it doesn't work!!??
Every time I try to use it I keep getting (method not allowed)!!!??
I most tried everything (new PHP code different html code)
and note (I'm using it on a site hosted on glitch) it doesn't officially support PHP but it does.

A: I tried you code. It should work except it should be $body instead of body in mail($to, $about, body, "From: $name <$email>");.
So the problem should be from the host provider.
BTW: Gmail seems having more strict security policy. I failed on Gmail and tried another mail service and succeed to receive the email.


Q: Learning Math On my own I'm a physics major and I'm pretty sure that I'm interested in theoretical physics research. However, I haven't been able to take math courses in a systematic way (as a math major would) due to scheduling difficulties. Therefore, I would like to fill the gaps in my math education by reading books on my own. Are there any suggestions on what topics I should concentrate on and what books are the best, considering that my main objective is to improve my physics insight. (I am very familiar with rigorous proofs and stuff.)
Thanks!

A: A short (but might be helpful) answer is to consult the MIT opencourse website. See what you found interesting and you may borrow the book from the library to read it. A good thing is one can learn math entirely on one own with a computer. For physics you need to learn how to do experiments, etc.
A topic you might be interested is differential geometry and geometrical topology if your interest is " theoretical physics research". Similarly you may read functional analysis, PDE, etc....
I also recommend this page which I know since high school and never finished learning from it...


Q: Unhandled Promise rejection: Cannot call method 'push' of null I have an issue I just cannot seem to understand. If anyone could offer some advise I would appreciate it.
I am using Ionic2 with Meteor/Mongo to build a Chat App.
I have the following code:
  private findChats(): Promise<Mongo.Collection<Chat>> {
    let promise: Promise<Mongo.Collection<Chat>> = new Promise<Mongo.Collection<Chat>>(resolve => {
      let registeredIds: String[] = [this.senderId];
      for (let i = 0; i < this.jobModelsForSender.length; i++) {
        console.log('findChats:  registeredIds.push this.jobModelsForSender[i].id: ' + registeredIds + '  -  ' + this.jobModelsForSender[i].id);
        registeredIds.push('J' + this.jobModelsForSender[i].id);
        console.log('findChats:  pushed: ' + registeredIds);
      }
      this.subscribe('chats', this.senderId, registeredIds, () => {
        console.log('findChats:  in subscribe: ' + this.senderId+'  '+registeredIds);

        let chats: Mongo.Cursor<Chat> = Chats.find(
          { memberIds: { $in: registeredIds } },
          {
            sort: { lastMessageCreatedAt: -1 },
            transform: this.transformChat.bind(this),
            fields: { memberIds: 1, lastMessageCreatedAt: 1 }
          }
        );
        console.log('findChats:  chats: ' + chats);
        this.chats = chats;
        let localChatCollection: Mongo.Collection<Chat> = new Mongo.Collection<Chat>(null);
        chats.forEach((chat: Chat) => {
          localChatCollection.insert(chat);
        });
        console.log('findChats:  resolve(localChatCollection): ' + localChatCollection);
        resolve(localChatCollection);
      });
    });
    return promise;
  }

But I get the following output:
findChats:  registeredIds.push this.jobModelsForSender[i].id: P8  -  72 app.bundle.js:118232
findChats:  pushed: P8,J72 app.bundle.js:118234
findChats:  registeredIds.push this.jobModelsForSender[i].id: P8  -  72 app.bundle.js:118232
findChats:  pushed: P8,J72 app.bundle.js:118234
findChats:  registeredIds.push this.jobModelsForSender[i].id: P8  -  72 app.bundle.js:118232
findChats:  pushed: P8,J72 app.bundle.js:118234
Unhandled Promise rejection: Cannot call method 'push' of null ; Zone: <root> ; Task: Promise.then ; Value: TypeError {stack: (...), message: "Cannot call method 'push' of null"} zone.js:461
Error {rejection: TypeError, promise: ZoneAwarePromise, zone: Zone, task: ZoneTask, stack: (...)…}
 zone.js:463
Unhandled Promise rejection: Cannot call method 'push' of null ; Zone: <root> ; Task: Promise.then ; Value: TypeError {stack: (...), message: "Cannot call method 'push' of null"} zone.js:461
Error {rejection: TypeError, promise: ZoneAwarePromise, zone: Zone, task: ZoneTask, stack: (...)…}
 zone.js:463
Unhandled Promise rejection: Cannot call method 'push' of null ; Zone: <root> ; Task: Promise.then ; Value: TypeError {stack: (...), message: "Cannot call method 'push' of null"} zone.js:461
Error {rejection: TypeError, promise: ZoneAwarePromise, zone: Zone, task: ZoneTask, stack: (...)…}
 zone.js:463
findChats:  in subscribe: P8  P8,J72 app.bundle.js:118243
findChats:  chats: [object Object] app.bundle.js:118249
findChats:  resolve(localChatCollection): [object Object]

As you can see, I am getting an error in zone.js. As far as I can see, when I debug this, and as the logs show, it does the push successfully to registeredIds. It then exits the function, returning the promise. After that it goes into zone.js where the error is logged.

A: The answer will probably not be relevant to many people, but as Anton pointed out, that it is an issue to do with the promise loading asynchronously.
I had an event that was calling the same promise at the same time. As soon as I remove the trigger to that event, I don't get any errors.


Q: Why is my posted data null in the Controller target of this AJAX call? I have modeled (no pun intended) my AJAX call on the answer here from logan filley, which seems sensible and likely to work. This is the jquery I have in the View:
$("#btnSaveConfig").click(function () {

    var saveConfigModel = {
        unit: $('#unitsselect').val(),
        scheduleProduceUsage: $('#ckbx_produceusage').checked,
        scheduleDeliveryPerformance: $('#ckbx_deliveryperformance').checked,
        scheduleFillRate: $('#ckbx_fillratebycustomer_location').checked,
        schedulePriceCompliance: $('#ckbx_pricecompliance').checked,
        // TODO: Finish this by storing add'l emails in an array along with the three on the page;
        recipients: $('#email1').val(),
        generationDayOfMonth: $('#dayofmonthselect').val(),
        generationOrdinal: $('#ordinalselect').val(),
        generationDayOfWeek: $('#dayofweekselect').val(),
        generationWeekOrMonth: $('#weekormonthselect').val(),
        daterangeFromProduceUsage: $('#produsagefrom').val(),
        daterangeToProduceUsage: $('#produsageto').val(),
        daterangeFromDeliveryPerformance: $('#delperffrom').val(),
        daterangeToDeliveryPerformance: $('#delperfto').val(),
        daterangeFromFillRate: $('#fillratefrom').val(),
        daterangeToFillRate: $('#fillrateto').val(),
        daterangeFromPriceCompliance: $('#pricecompliancefrom').val(),
        daterangeToPriceCompliance: $('#pricecomplianceto').val()
    }

    $.ajax({
        type:"POST",
        url:'@Url.Action("PostUnitConfig", "SaveConfig")',
        async:true,
        contentType: 'application/json',
        dataType:"json",
        data: JSON.stringify(saveConfigModel)
    });
}); // $("#btnSaveConfig").click()

...and this is my Model:
public class SaveConfigModel
{
    public UnitConfigVals unitConfigVals { get; set; }

    public class UnitConfigVals
    {
        public string unit { get; set; }
        public bool scheduleProduceUsage { get; set; }
        public bool scheduleDeliveryPerformance { get; set; }
        public bool scheduleFillRate { get; set; }
        public bool schedulePriceCompliance { get; set; }
        public List<string> recipients { get; set; }
        public int generationDayOfMonth { get; set; }
        public string generationOrdinal { get; set; }
        public string generationDayOfWeek { get; set; }
        public string generationWeekOrMonth { get; set; }
        public int daterangeFromProduceUsage { get; set; }
        public int daterangeToProduceUsage { get; set; }
        public int daterangeFromDeliveryPerformance { get; set; }
        public int daterangeToDeliveryPerformance { get; set; }
        public int daterangeFromFillRate { get; set; }
        public int daterangeToFillRate { get; set; }
        public int daterangeFromPriceCompliance { get; set; }
        public int daterangeToPriceCompliance { get; set; }
    }
}

...and Controller (obviously ultra-spartan at the moment):
public class SaveConfigController : Controller
{
    public ActionResult PostUnitConfig(SaveConfigModel model)
    {
        try
        {
            string s = model.unitConfigVals.unit;
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        return Json(new { success = true });
    }
}

I am reaching the breakpoint in my Controller (on the "string s = model.unitConfigVals.unit;" line), but it throws an exception because the value of "model" is null. Why? Have I got something in my AJAX call wrong, or...?!?
UPDATE
I changed my jquery to this (changed boolean assignments and appended a semicolon):
   $("#btnSaveConfig").click(function() {

      var saveConfigModel = {
        unit: $('#unitsselect').val(),
        scheduleProduceUsage: $('#ckbx_produceusage').attr('checked'),
        scheduleDeliveryPerformance:
        . . .
    };

    $.ajax({
        type: "POST",
        url: '@Url.Action("PostUnitConfig", "SaveConfig")',
        async: true,
        //contentType: 'application/json',
        dataType: "json",
        data: JSON.stringify({ data: saveConfigModel })
    });
});

...but the Controller is still passed a null model.
UPDATE 2
Now I changed "attr('checked')" to "is('checked')" but no difference...
UPDATE 3
"model" is null here in the Controller:
public class SaveConfigController : Controller
{
    public ActionResult PostUnitConfig(SaveConfigModel model)

...when the AJAX call is like this:
$.ajax({
    type: "POST",
    url: '@Url.Action("PostUnitConfig", "SaveConfig")',
    async: true,
    dataType: "json",
    data: saveConfigModel
});

...and also when the AJAX call is like this:
$.ajax({
    type: "POST",
    url: '@Url.Action("PostUnitConfig", "SaveConfig")',
    async: true,
    data: saveConfigModel
});

...and this:
$.ajax({
    type: "POST",
    url: '@Url.Action("PostUnitConfig", "SaveConfig")',
    async: true,
    contentType: 'application/json',
    dataType: "json",
    data: JSON.stringify({ model: saveConfigModel })
});

Do I need the "async: true"? I don't use that in my (working) GET AJAX calls. Similarly, do I need "cache: false"? I do use that in those working GET AJAX calls...
UPDATE 4
Even when I provide just some bogus vals:
var saveConfigModel = {
    unit: 'Buford', //$('#unitsselect').val(),
    scheduleProduceUsage: true, //$('#ckbx_produceusage').is(':checked'),
    scheduleDeliveryPerformance: false, // $('#ckbx_deliveryperformance').is(':checked'),
    scheduleFillRate: false, //$('#ckbx_fillratebycustomer_location').is('checked'),
    schedulePriceCompliance: false, //$('#ckbx_pricecompliance').is('checked'),
    // TODO: Finish this by storing add'l emails in an array along with the three on the page; might be as easy as declaring an array like this one, and adding to it as necessary
    recipients: 'platypus@whatever.com', // $('#email1').val(),
    generationDayOfMonth: '2nd', //$('#dayofmonthselect').val(),
    generationOrdinal: 'First', //$('#ordinalselect').val(),
    generationDayOfWeek: 'Thursday', // $('#dayofweekselect').val(),
    generationWeekOrMonth: 'month', // $('#weekormonthselect').val(),
    daterangeFromProduceUsage: $('#produsagefrom').val(),
    daterangeToProduceUsage: $('#produsageto').val(),
    daterangeFromDeliveryPerformance: '1', // $('#delperffrom').val(),
    daterangeToDeliveryPerformance: '1', //$('#delperfto').val(),
    daterangeFromFillRate: '1', //$('#fillratefrom').val(),
    daterangeToFillRate: '1', //$('#fillrateto').val(),
    daterangeFromPriceCompliance: '1', //$('#pricecompliancefrom').val(),
    daterangeToPriceCompliance: '1' //$('#pricecomplianceto').val()
};

...it still winds up at the Controller null like forevermore before.
And then, grasping at straws, I even encased the boolean values in single quotes ('true' and 'false'), but that also (probably predictably) made no difference either.
UPDATE 5
For future generations, this is the AJAX that works:
$.ajax({
    type: "POST",
    url: '@Url.Action("PostUnitConfig", "SaveConfig")',
    async: true,
    contentType: 'application/json',
    dataType: "json",
    data: JSON.stringify({ model: saveConfigModel })
});

A: Since the values you posting back are for your nested UnitConfigVals class (not SaveConfigModel, then you controller method should be
public ActionResult PostUnitConfig(SaveConfigModel.UnitConfigVals model)

and the ajax data option needs to be
data: JSON.stringify({ model: saveConfigModel })

Alternatively you could keep the current controller method and use
data: JSON.stringify({ model: { unitConfigVals: saveConfigModel }})

although it seems a little odd that you using a nested class here.
A few other issues with your initial code

*

*$('#ckbx_produceusage').checked will return undefined, and it
needs to be $('#ckbx_produceusage').is(':checked') which will
return true or false

*Since recipients is List<string>, it will need to be
recipients: [ 'someValue', 'anotherValue', etc ]
However all this code to build you json data not really necessary, and if your view is generated correctly using the strongly typed HtmlHelper methods, then your ajax call can be as simple as
$.ajax({
    type:"POST",
    url:'@Url.Action("PostUnitConfig", "SaveConfig")',
    dataType: "json",
    data: $('form').serialize(),
    success: function(data) {
        // do something
    }
});


Q: qDebug output in qtCreator while running unit tests with catch2 I have a project with unittests which are implemented with catch2 and using the catch2-integration in qtcreator. The unittests contain qDebug()<<"message" calls. The project uses CMAKE as build system. Everything compiles and I can both run the tests as standalone application and with the interface (i.e. "run selected tests") in qtcreator. Currently it is compiled in debug-mode.
However, when running in a terminal, I get all qDebug messages.
If I'm running the main application (not the unit tests), I can observe qDebug messages in the "Application output" tab.
However, if I'm running the unit tests, no matter if I use qtCreator interface or start debugging or run the compiled tests, the "Application output" stays empty.
As stated above, I'm able to see them in a terminal, but then I only can run the full test suite, while I would hope to be able only to run selected tests and get their output.
What needs to be in place that the qDebug messages which originate from catch2 unittests in qtcreator are displayed in the "Application Output" tab during test execution?
QtCreator 7.0.0, Windows, MSVC2019, 64Bit.
Amongst others I already tried (without luck): QtCreator: qDebug Messages Not Shown


Q: c/c++ clang linking error on Mac OSX - webkitgtk I am trying to use GTK3 and WebKitGTK. I am successful at running the following code :
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
#include <JavaScriptCore/JavaScript.h>

using namespace std;

static void destroyWindowCb(GtkWidget* widget, GtkWidget* window);
static gboolean closeWebViewCb(WebKitWebView* webView, GtkWidget* window);

int main(int argc, char* argv[])
{
// Initialize GTK+
gtk_init(&argc, &argv);

// Create an 800x600 window that will contain the browser instance
GtkWidget *main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(main_window), 800, 600);

// Create a browser instance
WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());

// Put the browser area into the main window
gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(webView));

// Set up callbacks so that if either the main window or the browser instance is
// closed, the program will exit
g_signal_connect(main_window, "destroy", G_CALLBACK(destroyWindowCb), NULL);
g_signal_connect(webView, "close", G_CALLBACK(closeWebViewCb), main_window);

// Load a web page into the browser instance
webkit_web_view_load_uri(webView, "http://www.webkitgtk.org/");

// Make sure that when the browser area becomes visible, it will get mouse
// and keyboard events
gtk_widget_grab_focus(GTK_WIDGET(webView));

// Make sure the main window and all its contents are visible
gtk_widget_show_all(main_window);

// Run the main GTK+ event loop
gtk_main();

return 0;
}

static void
destroyWindowCb(GtkWidget* widget, GtkWidget* window)
{
    gtk_main_quit();
}

static gboolean
closeWebViewCb(WebKitWebView* webView, GtkWidget* window)
{
    gtk_widget_destroy(window);
    return TRUE;
}

And the following cmake list :
cmake_minimum_required(VERSION 3.3)
project(HttpsMock)

# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)

pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(WEBKIT REQUIRED webkitgtk-3.0)

# Setup CMake to use GTK+, tell the compiler where to look for headers
include_directories(${GTK3_INCLUDE_DIRS})
include_directories(${WEBKIT_INCLUDE_DIRS})

# and to the linker where to look for libraries
link_directories(${GTK3_LIBRARY_DIRS})
link_directories(${WEBKIT_LIBRARY_DIRS})

# Add other flags to the compiler
add_definitions(${GTK3_CFLAGS_OTHER})
add_definitions(${WEBKIT_CFLAGS_OTHER})

# Flags and source
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -v")

set(SOURCE_FILES main.cpp)

add_executable(HttpsMock ${SOURCE_FILES})
# Linking
target_link_libraries(HttpsMock ${GTK3_LIBRARIES})
target_link_libraries(HttpsMock ${WEBKIT_LIBRARIES})

But as soon as I try to use another method like :
WebKitURIRequest *request = webkit_uri_request_new("http://www.webkitgtk.org/");

The program doesn't want to link anymore. It's really weird. Here's a sample of the error :
[100%] Linking CXX executable HttpsMock
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o HttpsMock -L/opt/local/lib -search_paths_first -headerpad_max_install_names CMakeFiles/HttpsMock.dir/main.cpp.o -lwebkitgtk-3.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpangoft2-1.0 -lpango-1.0 -lm -lfontconfig -lfreetype -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -ljavascriptcoregtk-3.0 -lglib-2.0 -lintl -rpath /opt/local/lib -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "_webkit_uri_request_new", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture x86_64

I really have no clue of what is going on. Could someone please enlighten me?
Thanks

A: The problem is that I was using
pkg_check_modules(WEBKIT REQUIRED webkitgtk-3.0)
instead of
pkg_check_modules(WEBKIT REQUIRED webkit2gtk-3.0)


Q: Spring Batch CompositeItemWriter How to properly set writer delegates Hi I am trying to add two writers to a spring batch compositeitemwriter. I am getting an error saying:
The method setDelegates(List<ItemWriter<? super MyObject>>) in the type CompositeItemWriter<MyObject> is not applicable for the arguments (List<ItemWriter<MyObject>>)

My code below
public ItemWriter<MyObject> myWriter(){
    ItemWriter<MyObject> myWriter = new myWriter();
    return myWriter;
}

public ItemWriter<MyObject> myOtherWriter(){
    ItemWriter<MyObject> myOtherWriter = new MyOtherWriter();
    return myOtherWriter;
}

public CompositeItemWriter<MyObject> compositeItemWriter(){
    CompositeItemWriter<MyObject> writer = new CompositeItemWriter<MyObject>();
    List<ItemWriter<MyObject>> writerList = new ArrayList<ItemWriter<MyObject>>();
    writerList.add(myWriter());
    writerList.add(myOtherWriter());
    writer.setDelegates(writerList); //<-- ERROR HERE
    return writer;
}

I could not find any strong code examples of compositeitemwriters that did not use xml. I know my error has something to do with generic type parameters, which I have little knowledge of. Could anyone explain why the above code would not work and possibly how to remedy it? Multiple itemwriters in Spring batch This is the closest I could find, but it uses generic types which also give me an error.
Thank you for any help! I am new to spring batch.

A: Try modifying...
List<ItemWriter<MyObject>> writerList = new ArrayList<ItemWriter<MyObject>>();

...with :
List<ItemWriter<? super MyObject>> writerList = new ArrayList<ItemWriter<? super MyObject>>();

CompositeItemWriter#setDelegates takes a list in the form List<ItemWriter<? super T>>.
See spring documentation.

A: Just in case you did not find a proper solution.
I would do it like this:
public ItemWriter<MyObject> myWriter() {
    ItemWriter<MyObject> myWriter = new JdbcBatchItemWriter<MyObject>(); //  <-- Example item writer 1
    return myWriter;
}

public ItemWriter<MyObject> myOtherWriter() {
    ItemWriter<MyObject> myOtherWriter = new JdbcBatchItemWriter<MyObject>(); //  <-- Example item writer 2
    return myOtherWriter;
}

public CompositeItemWriter<MyObject> compositeItemWriter() {
    CompositeItemWriter<MyObject> writer = new CompositeItemWriter<MyObject>();
    writer.setDelegates(Arrays.asList(myWriter(),myOtherWriter())); //<-- NO ERROR HERE :)
    return writer;
}

I hope that helps.


Q: How can I implement a decay for a matrix transformation with react-native-gesture-handler and reanimated? I'm trying to learn react-native-gesture-handler and react-native-reanimate. I like the idéa of using matrices for transformation, but I have a hard time understanding where to fit in physics functions, such as withDecay.
I want to use the new Gestures API (https://docs.swmansion.com/react-native-gesture-handler/docs/api/gestures/gesture) instead of the old gestureHandler API (https://docs.swmansion.com/react-native-gesture-handler/docs/gesture-handlers/api/common-gh)
Here is a nice example of using matrices for transformation and simply multiplying the change-matrice with the current matrice.
https://github.com/wcandillon/can-it-be-done-in-react-native/blob/master/bonuses/sticker-app/src/GestureHandler.tsx
This concept works great, but I also want to have a decay effect after ending a pan, i.e. the translation should continue to glide a bit.
Here is my first attempt. It does not work, and might be a bit naive. But I think that the code shows what I want to do. I just don't know how to do it correctly. My attempt was to add the .onEnd event, compared to Williams Candillon's original code.
  const pan = Gesture.Pan()
    .onChange(e => {
      matrix.value = multiply4(
        Matrix4.translate(e.changeX, e.changeY, 0),
        matrix.value,
      );
    })
    .onEnd(({velocityX, velocityY}) => {
      matrix.value = multiply4(
        Matrix4.translate(
          withDecay({velocity: velocityX}),
          withDecay({velocity: velocityY}),
          0,
        ),
        matrix.value,
      );
    });

A: the problem here is the withDecay returns an animation value (it auto update). So the idea would be to do trX.value = withDecay(), same of y and then use useDerivedValue to get the total Matrix4. I hope this helps.


Q: Update Wordpress Theme System i'm creating a premium Wordpress theme and i was wondering if there's a wordpress plugin or system that allows for easy upgrades of future theme updates for possible clients. Something like the internal system that Wordpress uses for its open source themes.
Thank you :)

A: I was researching this yesterday, and found this script , based on this
I hope it helps

A: The update library for themes is now available. You can find it here
Edite:
It seems that this library has been deprecated. And they refer to Plugin Update Checker.
Thank you @Buttered_Toast


Q: How to turn a .py file into a .deb package using quickly? We have made a .py file that controls brightness of the screen. It has a GUI with slider for controlling and runs when it is double clicked after marking it as executable.
But we want to make a .deb package with it for easily distributing. Is there any way to do it with Quickly? If not, then what are the other ways?
We also want to associate it with an icon.
The project we are trying to debianize is here.

A: FPM is a great tool for packaging not only deb but other formats too like rpm.

A: If you check out the wiki for Quickly. It's the third step under "How to get started":
quickly package


Q: Cannot Remove Underline From Vue router-link I think I tried almost everything trying to remove underline from router-link.
This is my code:
<router-link :to="{name: 'Plan'}">

Plan Your Trip

      <router-link :to="{name: 'Plan'}">COVID-19</router-link>
      <router-link :to="{name: 'Plan'}">Visa</router-link>
      <router-link :to="{name: 'Plan'}">Essentials</router-link>

</router-link>

I'm trying to remove underline from sub-links only.
Things I've tried:
In-line style
<router-link style="text-decoration: none !important;" :to="{name: 'Plan'}">COVID-19</router-link>

Assign class
<router-link class="sub-link" :to="{name: 'Plan'}">COVID-19</router-link>

Declare tag
<router-link tag="div" :to="{name: 'Plan'}">COVID-19</router-link>

Assign seperate tag + Declare class for that tag
<router-link :to="{name: 'Plan'}">

COVID-19

</router-link>

These are just few lists, I literally tried every possible methods I can think of... Am I missing something about customizing Vue router-link?

A: Uses display: inline-block;text-decoration:none;, the trick is display: inline-block;.
Css spec states

For block containers that establish an inline formatting context, the
decorations are propagated to an anonymous inline element that wraps
all the in-flow inline-level children of the block container. For all
other elements it is propagated to any in-flow children. Note that
text decorations are not propagated to floating and absolutely
positioned descendants, nor to the contents of atomic inline-level
descendants such as inline blocks and inline tables.

Example: The link COVID-19 in your codes will remove the underline.
<router-link :to="{name: 'Plan'}">

Plan Your Trip

      <router-link :to="{name: 'Plan'}" style="display: inline-block;text-decoration:none;">COVID-19</router-link>
      <router-link :to="{name: 'Plan'}">Visa</router-link>
      <router-link :to="{name: 'Plan'}">Essentials</router-link>

</router-link>

Below is one demo:

let Layout = {
  template: `

Layout Page

  <router-link to="/contact">

Links

    <router-link to="/contact/add" style="display: inline-block;text-decoration:none;">Add1</router-link>
    <router-link to="/addcontact">Add2</router-link>

  </router-link>
  <router-view></router-view>

`
};
let Home = {
  template: '
this is the home page. Go to <router-link to="/contact">contact</router-link>
'
};

let ContactList = {
  // add <router-view> in order to load children route of path='/contact'
  template: '
this is contact list, click <router-link to="/contact/add">Add Contact In sub Router-View</router-link> here to add contact
<router-view></router-view>
 Or Click <router-link to="/addcontact">Add Contact In Current Router-View</router-link>
'
};

let ContactAdd = {
  template: '
Contact Add
'
}

let router = new VueRouter({
  routes: [{
    path: '/',
    redirect: 'home',
    component: Layout,
    children: [{
        path: 'home',
        component: Home
      },
      {
        path: 'contact',
        component: ContactList,
        children: [{
          path: 'add',
          component: ContactAdd
        }]
      },
      {
        path: 'addcontact', // or move ContactAdd as direct child route of path=`/`
        component: ContactAdd,
      }
    ]
  }]
});

new Vue({
  el: '#app',
  components: {
    'App': {
      template: '
<router-view></router-view>
'
    },
  },
  router
});

  <app></app>

A: When you inspect the DOM for a router-link, you see that it's an a tag. Bear in mind, that even when the initial underline is removed, there is an underline that happens when you hover over the router link text.
Using this snippet

<router-link :to="{name: 'Plan'}">

Plan Your Trip

      <router-link :to="{name: 'Plan'}">COVID-19</router-link>
      <router-link :to="{name: 'Plan'}">Visa</router-link>
      <router-link :to="{name: 'Plan'}">Essentials</router-link>

</router-link>

.expander a {
  text-decoration: none;
}

.expander a:hover {
  text-decoration: none;
}

A: The outer router-link is applying text-decoration: underline to its inner-text and the inner router-links are also applying text-decoration: underline to their inner-text.
You essentially have double underlines applied to your inner router-links at the moment.
You need to remove it from both. If you need another element to have text-decoration: underline then set it for that element separately.


Q: jQuery ui Slider for Background and Font Colors I have a problem regarding my new site design prospect, and it involves using some jQuery and jQueryUI (mainly SliderUi) and some css manipulation.
Everytime I slide the #slider, the width of .left will then update depend on (ui.value from 1-100 + '%'), from here slide + background transition is happening already,
My question is is there any possible way to manipulate the color of texts depending on slider's treshold or value? if yes, can you suggest how can I come up into something like this?
Snippet below.
Thanks in advance!

$(document).ready(function() {
  $( "#slider" ).slider({
    max: 101,
    min:1,
    value: 51,
    slide: function(event,ui) {
      var percentage = (ui.value)-1;
      $('.left').css("width",percentage +'%');
    }
  });
});
#slider {z-index: 5;background: #666; }
.left, .right {positioackgrn:absolute; top: 0; left: 0; height: 100vh;}
.left {background: #000; width: 50%; z-index: 1;}
.right {background: #fff;  z-index: -1; width: 100%;}
.main-content {z-index: 3; position: absolute; top: 0; left: 0; width: 100%;}
h3 {color: blue; text-align: center; margin-top: 30px;}
<link href="https://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet"/>

A part of my font must change color depending on slider-ui threshold

A: Update!
http://jsfiddle.net/lsubirana/7od3sfrr/1/
HTML:

My font color must change depending on slider-ui threshold

My font color must change depending on slider-ui threshold

CSS:
.left, .right {position:absolute; top: 0; left: 0; height: 100vh;overflow:hidden;}
.left h3 {color: white; text-align: center; margin-top: 30px;width:100vw;}
.right h3 {color: black; text-align: center; margin-top: 30px;width:100vw;}

Original Answer:
One method to obtain what you are looking for is to pass the slider percentage to a function that can return you an rgb color value. The following page shows how to create rainbows in javascript and I believe can be applied in this case:
http://krazydad.com/tutorials/makecolors.php
$(document).ready(function() {
  $( "#slider" ).slider({
    max: 101,
    min:1,
    value: 51,
    slide: function(event,ui) {
      var percentage = (ui.value)-1;
      $('.left').css("width",percentage +'%');
      $('h3').css('color', rgb(percentage));
    }
  });
});

function rgb(p){
    var frequency = .08;
       r = Math.sin(frequency*p + 0) * 127 + 128;
       g = Math.sin(frequency*p + 2) * 127 + 128;
       b = Math.sin(frequency*p + 4) * 127 + 128;
     return  'rgb(' + Math.round(r) + ',' + Math.round(g) + ',' + Math.round(b) + ')';
}

http://jsfiddle.net/lsubirana/376ow969/


Q: Why is Existence and Uniqueness for Navier-Stokes Easier in 2-D than in 3-D? I know that existence and uniqueness for incompressible viscous flow in the 2-D case has already been established$^1$, and that doing the same for the 3-D case has yet to be shown. Not only that, but it's one of the hardest problems out there in mathematics today.
Clearly then, the 2-D case is considerably easier than the 3-D case, but why is this so? As quoted from the Navier-Stokes Millenium Problem's problem statement,

"This gives no hint about the three-dimensional case, since the main
  difficulties are absent in two dimensions."

What are these main difficulties? I'm looking for any answers, going as deep into any subjects as necessary. I'm ready to read long and deeply for this.
P.S: I've only started self-studying basic partial-differential equations, but I'm really interested in numerical (and analytic too) methods for solving PDE's.

[1] Ladyzhenskaya, Olga A. Mathematics and Its Applications : The
Mathematical Theory of Viscous Incompressible Flow. 2nd ed. 2.
Camberwell, Australia: Gordon and Breach Science Publishers, 1969. 224.
Print.

A: Not really a direct answer to your question, but Terry Tao has a splendid article on the Navier-Stokes Millenium problem, accessible via arXiv:
"Localisation and compactness properties of the Navier-Stokes global regularity problem"

A: In two dimensions it is possible to take advantage of the "enstrophy miracle". This is not possible in three dimensions.


Q: Let $\tau=\{(-\infty,a)\ :\ a\in\mathbb{R}\}\cup\{\emptyset, \mathbb{R}\}.$Does $\{\frac{1}{n}\}_n$ converge or diverge in this topology. Let $\tau=\{(-\infty,a)\ :\ a\in\mathbb{R}\}\cup\{\emptyset, \mathbb{R}\}.$ Discuss the convergence or divergence of $\{\frac{1}{n}\}_n$ in this topology.
If $\{\frac{1}{n}\}_n$  converges to $p$, $\forall (W \in \tau, W \ni p) \ \exists N \in \mathbb{N} : \forall n \geq N \ p_n \in W$. Other than that... I am unsure on how to provide a formal proof. It seems intuitively obvious to me that the sequence converges to $0$, but is it enough to merely say that the sequence enters into any open set that contains $0$?

A: Let $p$ be a point in $\mathbb{R}$. If $p < 0$, then $p \in (-\infty,0)$, and this set is open and contains no point of the sequence. So ...
If $p \ge 0$ and $p \in (-\infty, a)$, then $a > p \ge 0$, so for any $n \ge n_0 > \frac{1}{a}$ we have $\frac{1}{n} \le \frac{1}{n_0} < a$, so ...


Q: Now why LoopTools do not make calculation In deed I still in calculating the self energy diagram I started in this post
Why FormCalc gives zero amplitude for this process
Here is the code I use after the last answer
<< FeynArts`;
<< FormCalc`;

tops = CreateTopologies[1, 1 -> 1, ExcludeTopologies -> Internal];

ins := InsertFields[tops, F[1, {1}] -> F[1, {1}],
  InsertionLevel -> {Particles}]

ClearProcess[];

amp = CalcFeynAmp[CreateFeynAmp[ins, Truncated -> True], OnShell -> False, FermionChains -> VA]

Squaring the amplitude and set arbitrary values for all unknown parameters
matrix = SquaredME[amp] //. HelicityME[amp] //. Hel[_] -> 0

VALUES = {Den[p2_, m2_] :> 1/(p2 - m2), Alfa -> 1/128,
   Alfa2 -> 1/128^2, SW2 -> 0.23, CW2 -> 0.99 , ME2 -> 0.001,
   Finite -> 1, MW2 -> 6400, MZ2 -> 8100};

MyResul = mat //. Subexpr[] //. Join[VALUES] // Simplify
which yeilds:
4.65923*10^-7 (1.49 + 1. B0i[bb1, Pair[k[1], k[1]], 0, 8100] +
   1.98 B0i[bb1, Pair[k[1], k[1]], 0.001, 6400]) (1.49 +
   1. Superscript[B0i[bb1, Pair[k[1], k[1]], 0, 8100],"*"] +
   1.98 Superscript[B0i[bb1, Pair[k[1], k[1]], 0.001, 6400],"*"]) (1. Mat[F3, F3] + 1. Mat[F3, F4] + 1. Mat[F4, F3] + 1. Mat[F4, F4])

Now to get a numerical result for my calculation I should to use LoopTools because it should deal with quantities like  Mat[F3, F4] and B0i[bb1, Pair[k[1], k[1]] .. But LoopTools returns the same MyResul without doing any thing
   In[]:= Install["LoopTools"]

Out[]= LinkObject["/home/safi/RECENT-9-14/Mathematica/lib/LoopTools/i686-\
Linux/bin/LoopTools", 666, 5]

In[]:=MyResul

Out[]= 4.65923*10^-7 (1.49 + 1. B0i[bb1, Pair[k[1], k[1]], 0, 8100] +
   1.98 B0i[bb1, Pair[k[1], k[1]], 0.001, 6400]) (1.49 +
   1. Superscript[B0i[bb1, Pair[k[1], k[1]], 0, 8100],"*"] +
   1.98 Superscript[
    B0i[bb1, Pair[k[1], k[1]], 0.001, 6400],"*"]) (1. Mat[F3, F3] +
   1. Mat[F3, F4] + 1. Mat[F4, F3] + 1. Mat[F4, F4])

Note that all packages are installed in a right way as i added them to the Math link .. but probably there is some thing wrong in the code ..


Q: Extract fields from Json using Kusto in Application Insights I have the following json contained in a particular field in the traces.customDimensions:

When I parse this Json to extract a particular value I always get an empty column, for example:
traces | order by timestamp desc
| project CurrentContext = parse_json(customDimensions.CurrentPluginContext)
| extend Source = CurrentContext.source
| project Source

The query returns the following:

I've also tried:
traces | order by timestamp desc
| project timestamp, CurrentContext = customDimensions.CurrentPluginContext, CurrentParentContext = customDimensions.CurrentParentluginContext,
Source = parse_json(tostring(customDimensions.CurrentPluginContext)).source,
DepthCurrentContext = parse_json(tostring(customDimensions.CurrentPluginContext)).depth,
DepthCurrentParentContext = parse_json(tostring(customDimensions.CurrentParentluginContext)).depth
| mv-expand CurrentContext
| extend Source = CurrentContext.source

But here I get also an empty "Source" column. And the Columns "DepthCurrentContext" and "DepthCurrentParentContext" do not even appear.

The Json is valid.
Do I miss something here?
Any help is very appreciated!
UPDATE 27.02.2023
When I do the following:
let json = '{"source": "GetUserData","correlationId": "00000000-0000-0000-0000-000000000000","depth": "1","initiatingUserId": "00000000-0000-0000-0000-000000000000","isInTransaction": "False","isolationMode": "2","message": "Update","mode": "Asynchronus","operationId": "00000000-0000-0000-0000-000000000000","orgId": "00000000-0000-0000-0000-000000000000","orgName": "unqXXXXXXXXXXXXXXXXXXXX","requestId": "00000000-0000-0000-0000-000000000000","userId": "00000000-0000-0000-0000-000000000000","entityId": "00000000-0000-0000-0000-000000000000","entityName": "systemuser","type": "Plugin","stage": "Post-operation"}';

traces
| extend properties = parse_json(json)
| project Source = properties.source, CorrelationID = properties.correlationId

I get the properties out of the Json. The Json is the exact same as the ohne from the log.
Any idea?

A: as mentioned in the documentation: you will need to use tostring on the internal property bag.
i.e. parse_json(tostring(parse_json(customDimensions).CurrentPluginContext))

A: traces | order by timestamp desc
| project CurrentContext = parse_json(customDimensions.CurrentPluginContext)
| extend Source = parse_json(tostring(CurrentContext)).source
| project Source


Q: getting sql error unknown column in where clause when trying to filter data In the SQL query where city clause when I put string 'delhi' I get results but when I put a variable like below I get error unknown column delhi in where clause. how to solve the issue?
router.get('/filter/:city', (req, res) => {
  const location = req.params.city;
  const singleQuoteLocation = location.replace(/"/g, "'");
  connection.query(
    `select * from weather_data where city=${singleQuoteLocation}`,
    (err, results, field) => {
      if (err) {
        console.log(err);
      } else {
        res.status(200).send(results);
        console.log(results);
      }
    }
  );
});

A: You should be using a prepared statement with a ? placeholder for the city value.  Then, bind a JS variable to the ?.
router.get('/filter/:city', (req, res) => {
  const location = req.params.city;
  connection.query(
    "SELECT * FROM weather_data WHERE city = ?", [location],
    (err, results, field) => {
      if (err) {
        console.log(err);
      }
      else {
        res.status(200).send(results);
        console.log(results);
      }
    }
  );
});

Note that when using a prepared statement there is no need to massage the location variable by doing things like wrapping in single quotes.  Instead, let your MySQL driver worry about how to handle this, via the prepared statement.

A: `select * from weather_data where city = \'${singleQuoteLocation}\' `


Q: How to stretch table within a cell (nested table) in html? Nested table does not 100% height of parent td
I have used height="100%" but did not help
HTML:

Text

Text

Text

Text

Text

Text

Text

Actual result: https://jsfiddle.net/fela93/8ysfawve/17/


Q: What is the most efficient way to find rows of a CSV not containing duplicate entries across the fields of that row (excluding blank entires)? I'm looking to find all of the rows of a CSV file that contain the duplicate data in two or more of the fields of that row (i.e. find all of the rows without unique data in each field.)
For example, I have the following CSV file:
John,Smith,Smith,21
Mary,Jones,Smith,32
John,42,42,42
Henry,Brown,Jones,31
Mary,,,21

I would want the following rows to be printed:
John,Smith,Smith,21
John,42,42,42

These rows are printed because a the data in one field of these rows occurs in another field. Note that "Mary,,,21" was not printed even though it has duplicate empty fields.
I could write a Python script and keep a count of the times each entry occurs in each row, but it seems like there must be a better way to do this.

A: Using perl:
perl -F, -lane 'my %s; print if grep { $s{$_}++ } @F'

Uses:

*

*-F, to set field separator to ,

*-l to automatically handle linefeeds

*-a to autosplit

*-n to wrap it in a while ( <> ) { loop.

*-e to specify code to exec.

Incoming data is autosplit on , into @F and we use a %s hash to spot if there's a dupe.
If — based on your comment — you need to skip empty fields (which this would count as dupes):
perl -F, -lane 'my %s; print if grep { /./ ? $s{$_}++ : () } @F'

This includes a ternary operator to test if a field is empty.
Testing with Windows (which isn't quite the same, because of quotes):
C:\Users\me>perl -F, -lane "my %s; print qq{line matches:$_} if grep { /./ ? $s{$_}++ : () } @F"
line matches:John,Smith,Smith,21
line matches:John,42,42,42

If written longhand, it looks more like this:
#!/usr/bin/env perl
use strict;
use warnings;

while ( my $line = <DATA> ) {
   my %seen;
   chomp($line);
   my @fields = split /,/, $line;
   if ( grep { /./ and $seen{$_}++ } @fields ) {
       print $line,"\n";
   }
}

__DATA__
John,Smith,Smith,21
Mary,Jones,Smith,32
John,42,42,42
Henry,Brown,Jones,31
Mary,,,21

You could use the Text::CSV module to parse it, but I would suggest not doing so, unless you're specifically dealing with quoting/embedded linefeeds etc.
E.g.:
#!/usr/bin/env perl
use strict;
use warnings;

use Data::Dumper;
use Text::CSV;

my $csv = Text::CSV -> new ( {sep_char => ',', eol => "\n", binary => 1} );

while ( my $row = $csv -> getline ( \*DATA ) ) {
   my %seen;
   if ( grep { /./ and $seen{$_}++ } @$row ) {
       print join ",", @$row, "\n";
   }
}

__DATA__
John,Smith,Smith,21
Mary,Jones,Smith,32
John,42,42,42
Henry,Brown,Jones,31
Mary,,,21

A: Using awk you can do:
awk -F, '{delete a; for (i=1;i<=NF;i++) if ($i!="") if ($i in a) {print; next} else a[$i]}' file

John,Smith,Smith,21
John,42,42,42

A: $ awk -F, '{delete seen; for (i=1;i<=NF;i++) if ( ($i!="") && seen[$i]++ ) { print; next } }' file
John,Smith,Smith,21
John,42,42,42

A: If you'd like a Perl solution that you can integrate into a larger script (and doesn't quite so closely resemble line noise), and that correctly handles CSV data where a field contains a comma, I'd use the Text::CSV module:
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;

my $file = shift or die "Usage: $0 <file>\n";

open my $fh, '<', $file or die "Cannot open $file: $!\n";

my $csv = Text::CSV->new();

while (my $row = $csv->getline($fh)) {
   my %h;
   $h{$_}++ for @{$row};
   for my $dup_field (grep { $h{$_} > 1 } keys %h)  {
      if (length $dup_field) {
          print $csv->string();
          next;
      }
   }
}

A: If you like perl and regex, then this looks good :
perl -ne 'print if /(?:^|,)([^,]+),(?:.*,)?\1(?:,|$)/'
If you need explanations :
([^,]+) matches a "word" (in that context, I use "word" to mean "the data of a row"), and \1 will see if it is repeated. (?:.*,)? allows other words to be between the repetitions of your data. And finally (?:^|,) and (?:,|$) ensure that the 2 repeated words are the same, and no one is a substring of the other.


Q: how to implement level order print for MaxHeap I'm currently making a MaxHeap program and I need to print my heap in level order. How can this be done? Do I create a method to print the heap in level order inside of my heap class or would I do it in my main class? I know for like my binary search tree project i used iterative methods and called them from my main class but I'm not sure if I can do that here. Below is my implementation of the MaxHeap class from my textbook:
public final class MaxHeap<T extends Comparable<? super T>> implements MaxHeapInterface<T>
{
private T[] heap;
private int lastIndex;
private boolean initialized = false;
private static final int DEFAULT_CAPACITY = 25;
private static final int MAX_CAPACITY = 10000;

int swaps=0;

public MaxHeap() {
this(DEFAULT_CAPACITY);
}

public MaxHeap(int initialCapacity) {
if (initialCapacity < DEFAULT_CAPACITY)
    initialCapacity = DEFAULT_CAPACITY;
else
    checkCapacity(initialCapacity);

@SuppressWarnings("unchecked")
T[] tempHeap = (T[]) new Comparable[initialCapacity + 1];
heap = tempHeap;
lastIndex = 0;
initialized = true;
}

public T getMax() {
checkInitialization();
T root = null;
if (!isEmpty())
    root = heap[1];
return root;
}


Q: Trying to do a checksum on a file I have to install (16.04) First of all I'm a tenderfoot to this OS.  I just installed the OS and one of the first things I'm trying to do is update the BIOS on my MB.  The the BIOS is located here, http://global.shuttle.com/main/productsDownload?productId=1383
As you can see, there's a checksum for this file.  The thing is I don't have a clue how to check for this checksum after I download it.  I assumed that I could right click the file after the download, but it wasn't that easy.
After I do manage to check the checksum.  I'm going to need help installing it.  I'm not really sure Ubuntu will be able to install it or not.  I'm working to install the latest file on the page posted.
For reference I install my OS from a CD on a mag that Ubuntu released.  It's a 64 bit 16.04 install.


Q: How to Unescape a JavaScript string in Ruby What is the simplest way to unescape the following string in Ruby.
Sample Input
str = "\\u003Cul id=\\\"list_example\\\"\\u003E\\n\\t\\u003Cli class=\\\"item_example\\\"\\u003EHello\\u003C/li\\u003E\\n\\u003C/ul\\u003E\\n\\n"
puts str # => \u003Cul id=\"list_example\"\u003E\n\t\u003Cli class=\"item_example\"\u003EHello\u003C/li\u003E\n\u003C/ul\u003E\n\n
str.encoding # => #<Encoding:UTF-8>

Desired Output
puts str #=>

Hello

A: The simplest approach is just to read the string as a JSON string.
unescaped_str = JSON.load("\"#{str}\"")

A: That string is escaped twice. There are a few ways to unescape it. The easiest is eval, though it is not safe if you don't trust the input. However if you're sure this is a string encoded by ruby:
print eval(str)

Safer:
print YAML.load(%Q(---\n"#{str}"\n))

If it was a string escaped by javascript:
print JSON.load(%Q("#{str}"))

See also Best way to escape and unescape strings in Ruby?


Q: 'future_to_publish' hook not working in wordpress I'm trying to save data to a file when a scheduled post is published. I tried to do this using the hooks 'future_to_publish', 'publish_future_post', 'transition_post_status' - none of them worked for me. I experimented with changing the priority of the hooks - didn't work either.
This is my code:
<?php
function savePostData( $ID ) {
$wpRootPath     = get_home_path();
$postsDataPath  =  $wpRootPath . 'test.txt';
$handle = fopen( $postsDataPath, "w" );
fwrite( $handle, $ID );
fclose( $handle );
}
add_action( 'future_to_publish', 'savePostData', 10, 1 );
?>

When attaching the same function to the following hooks everything works:
add_action( 'publish_post', 'savePostData', 10, 1 );
add_action( 'pending_to_publish', 'savePostData', 10, 1 );
add_action( 'draft_to_publish', 'savePostData' );

I read there is some problem with the is_admin() function interfering with the wordpress cron job, but, still, I cannot get this to work.

A: It turned out when a post is published with cron, 'publish_post' hook is also executed and I didn't need to use it together with the 'future_to_publish' hook.
The problem with both hooks, however, was that for some reason get_home_path(); does not work in the same way as when the post is published immediately from admin panel, so using the exact path to my file solved the problem.