text:
Q: Assuming that $g(z)=\frac{f(z)}{z-z_0}$ is continuous at $z_0$, prove that $\int_\gamma \frac{f(z)}{z-z_0}dz=0$. Suppose that $f$ is analytic in some domain D containing the unit circle $\gamma$ and that $z_0$ is a point in D not on $\gamma
$. Assuming that $g(z)=\frac{f(z)}{z-z_0}$ is continuous at $z_0$, prove that $$\int_\gamma  \frac{f(z)}{z-z_0}dz=0.$$
This is where I am so far, we know that from Cauchy's Integral Formula $$\int_\gamma  \frac{f(z)}{z-z_0}dz=2\pi if(z_0)$$ This is equal to $0$ if $f(z_0)=0$. To show that this is equal to $0$, this must have to do something with $g(z)$ being continuous at $z_0$. I know that $g(z)$ is analytic if $f(z_0)=0$, however I cannot show that continuity of $g(z)$ implies analyticity of $g(z)$.
Any comments will be helpful.

A: You know that $\lim_{z\to z_0}\frac{f(z)}{z-z_0}$ exist. Also, as $f$ is analytic, $\lim_{z\to z_0}\frac{f(z)-f(z_0)}{z-z_0}$ exists. Thus, the limit $\lim_{z\to z_0}\frac{f(z_0)}{z-z_0}$ exists. But this can only be true when $f(z_0) = 0$.

A: Since $\lim_{z\to z_0}\frac{f(z)}{z-z_0}$ exists, $f(z_0)=0$. Otherwise, we would have $\lim_{z\to z_0}f(z)\neq0$ and $\lim_{z\to z_0}z-z_0=0$, which would imply that the limit $\lim_{z\to z_0}\frac{f(z)}{z-z_0}$ does not exist (in $\mathbb C$). So$$\int_\gamma\frac{f(z)}{z-z_0}\mathrm dz=2\pi if(z_0)=0.$$

A: $g$ has an isolated singularity at $z_0$. Since $g$ is continuous at $z_0$, Riemann says:
$g$ has aremovable singularity at $z_0$. Hence there is an analytic function $h$ on $D$ such that $h=g$ on $D \setminus \{z_0\}$.
Consequence: $\int_\gamma  \frac{f(z)}{z-z_0} dz=\int_\gamma  g(z) dz=\int_\gamma  h(z) dz=0$.

A: Since $g(z)=\frac{f(z)}{z-z_0}$ is given to be continuous at $z_0$. Then
\begin{eqnarray*}
g(z_0)&=&\lim_{z \to z_0}\frac{f(z)}{z-z_0}\\
&=&\frac{\lim_{z \to z_0}f(z)}{\lim_{z \to z_0} (z-z_0)} \\
\lim_{z \to z_0}f(z)&=&g(z_0) \lim_{z \to z_0}(z-z_0)\\
f(z_0)&=&0
\end{eqnarray*}


text:
Q: unable to retrieve HTML form data running on Localhost:port python I am running a simple form input on my localhost:port using socket programming.
Currently, I have a form running on my chrome, just a text box on localhost:2333, I am able to see the text box input on my wireshark like this

The input message I typed is testesest.
After which, I put the <form action="http://localhost:2333"> such that the entered form data can flow back to my localhost:port. However, my 2nd r= recv(1024)is not receiving anything.
import socket
import sys
import os

Addr = ''
PORT = 2333
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((Addr, PORT))
s.listen()

The above is the standard part.
while(1):
    try:
        print("waiting for connection")
        conn, address = s.accept()
        print("New client connected from IP address {} and port number {}".format(*address))

        received = conn.recv(1024)
        #print("Request received")

        #This is what i am hosting
        #A webpage with a form

        conn.send(b'\r\n')

        #This is the webpage content

        #The code will stuck here at recv
        print("Waiting for form input from client")
        r = conn.recv(1024)
        print(r.decode())

        print("Form input received")
        print("HTTP response sent")

    except KeyboardInterrupt:
        conn.close()
        s.close()

    conn.close()
    s.close()
    break

Can I get some help please?

A: Input data sent via GET is attached to the URI (/?work=<data>), which is sent as a new request:
import socket
import sys
import os

Addr = ''
PORT = 2333
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((Addr, PORT))
s.listen()

while (1):
    try:
        print("waiting for connection")
        conn, address = s.accept()
        print(
            "New client connected from IP address {} and port number {}".format(
                *address
            )
        )

        request = conn.recv(1024)
        print("Request received")
        method, uri, _ = request.decode().split(' ', 2)
        print(method, uri)

        #This is what i am hosting
        #A webpage with a form

        response = ""
        conn.send(b'HTTP/1.1 200 OK\r\n')
        conn.send(b'Content-Type: text/html\r\n')
        conn.send(b'Host: localhost:2333\n')
        conn.send(b'\r\n')

        if uri == '/':
            response = """
                <form action="http://localhost:2333/" method="GET">
                <input type="text" name="work"></form>
                """
        elif uri.startswith('/?work'):
            response = f"
recevied: {uri[uri.find('/?work=')+7:]}
"

        conn.send(response.encode())
        conn.send(b"\r\n")

        print("Form input received")
        #print("HTTP response sent")

    except KeyboardInterrupt:
        conn.close()
        s.close()

    #conn.close()
    #s.close()
    #break

Out:
waiting for connection
New client connected from IP address 127.0.0.1 and port number 55941
Request received
GET /?work=TestInput

recevied: TestInput

Form input received
waiting for connection
...

Note:
You might want to have a look at the protocol specs and/or use any existing library to get rid of this low level stuff.

A: Whenever we submit any form, browser makes new http request instead of using the existing connection, so you need to handle it in new http request/connection.
Another thing is, r = conn.recv(1024) is not letting the current connection close, that's why pressing enter in textfield is also not working.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I password protect the web.me.com/USER? Mobile me users have web.me.com/USER to use it as a HTML server. Is there a way to password protect some/all of the contents?

A: It appears that .htaccess files aren't supported, so someone came up with a javascript solution:
http://leonstafford.com/wp/encrypt-web-pages-on-mobileme.html
Here's some information on how it was possible to password protect the public folder in the mac.com implementation me.com, it may be relevant.
http://homepage.mac.com/rfwilmut/notes/faq.html#3_Public_Folder


text:
Q: Spring "prototype" bean scope vs "new" operator Can someone explain the difference between Spring "prototype" bean scope and using "new" operator? Also what is the advantage of declaring the bean with "prototype" scope over "new" operator?

A: Prototype beans do mean that a new instance of the bean is created every time it is requested (in which case you might think you may as well be instantiating it yourself when needed using new).
But the key thing is that they still satisfy the dependency injection design pattern (https://en.wikipedia.org/wiki/Dependency_injection) which among many other things makes unit testing with mocked dependencies significantly easier.


text:
Q: Unable to install ngx-doc-viewer in angular 9 I am trying to install ngx-doc-viewer in angular 9 project. But it throws some error, here I have attached the error. Anyone faced this issues?

or
Suggest me any other document viewer using angular 9
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: app@0.0.147
npm ERR! Found: @angular/common@9.0.7
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~9.0.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^11.2.0" from ngx-doc-viewer@2.0.2
npm ERR! node_modules/ngx-doc-viewer
npm ERR!   ngx-doc-viewer@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

A: You have a dependency conflict (incorrect and potentially broken dependency).
Try to to run the npm install command with --force, or --legacy-peer-deps.
OR:
Workaround is to use the --force flag when running ng update [package] to override the dependency issues.
ng update ngx-doc-viewer --next --force


text:
Q: API Post to Sonata Media Bundle Symfony 3 My purpose is to send a picture from an Ionic App (For now testing with PostMan) to my Symfony 3 based database using Sonata Media Bundle.
Their is a documentation but it's quite short and I'm stuck to the 15.3. SENDING A MEDIA FILE process.
I managed to get the follow process in the Bundle and inspect data.
c:\wamp64\www\bumblb___api\vendor\sonata-project\media-bundle\Controller\Api\MediaController.php > handleWriteMedium() function.
/**
 * Write a medium, this method is used by both POST and PUT action methods.
 *
 * @param Request                $request
 * @param MediaInterface         $media
 * @param MediaProviderInterface $provider
 *
 * @return View|FormInterface
 */
protected function handleWriteMedium(Request $request, MediaInterface $media, MediaProviderInterface $provider)
{
    $form = $this->formFactory->createNamed(null, 'sonata_media_api_form_media', $media, array(
        'provider_name' => $provider->getName(),
        'csrf_protection' => false,
    ));

    // return $media;
    // return $request->__toString();

    // THE FORM DOES NOT FILL WITH REQUEST
    $form->handleRequest($request);
    return $form->getData();
    // return $media;

    if ($form->isValid()) {

        $media = $form->getData();
        $this->mediaManager->save($media);

        $view = FOSRestView::create($media);

        // BC for FOSRestBundle < 2.0
        if (method_exists($view, 'setSerializationContext')) {
            $serializationContext = SerializationContext::create();
            $serializationContext->setGroups(array('sonata_api_read'));
            $serializationContext->enableMaxDepthChecks();
            $view->setSerializationContext($serializationContext);
        } else {
            $context = new Context();
            $context->setGroups(array('sonata_api_read'));
            $context->setMaxDepth(0);
            $view->setContext($context);
        }

        return $view;
    } else {
        // return "NOT VALID";
    }

    return $form;
}

Which is called be this one :
/**
 * Adds a medium of given provider
 * If you need to upload a file (depends on the provider) you will need to do so by sending content as a multipart/form-data HTTP Request
 * See documentation for more details.
 *
 * @ApiDoc(
 *  resource=true,
 *  input={"class"="sonata_media_api_form_media", "name"="", "groups"={"sonata_api_write"}},
 *  output={"class"="Sonata\MediaBundle\Model\Media", "groups"={"sonata_api_read"}},
 *  statusCodes={
 *      200="Returned when successful",
 *      400="Returned when an error has occurred while medium creation",
 *      404="Returned when unable to find medium"
 *  }
 * )
 *
 * @Route(requirements={"provider"="[A-Za-z0-9.]*"})
 *
 * @param string  $provider A media provider
 * @param Request $request  A Symfony request
 *
 * @return MediaInterface
 *
 * @throws NotFoundHttpException
 */
public function postProviderMediumAction($provider, Request $request)
{
    $medium = $this->mediaManager->create();
    $medium->setProviderName($provider);

    try {
        $mediaProvider = $this->mediaPool->getProvider($provider);
    } catch (\RuntimeException $ex) {
        throw new NotFoundHttpException($ex->getMessage(), $ex);
    } catch (\InvalidArgumentException $ex) {
        throw new NotFoundHttpException($ex->getMessage(), $ex);
    }

    return $this->handleWriteMedium($request, $medium, $mediaProvider);
}

I choose to make it using JSON with POSTMAN. Form-data does not seems to work.
http://127.0.0.1:8000/api/providers/sonata.media.provider.image/media
{
"name": "nameex",
"description": "descriptionex",
"copyright": "copyrightex",
"authorName": "authorNameex",
"cdnIsFlushable": true,
"enabled": true,
"binaryContent": "data:image/jpeg;base64,test"
}

the differents return that I write to test :
return $form->getData();
{
        "provider_metadata": [],
        "enabled": false,
        "provider_name": "sonata.media.provider.image"
    }

return $request->__toString();
"POST /api/providers/sonata.media.provider.image/media HTTP/1.1\r\nAccept:          */*\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4\r\nAuthorization:   Basic c3VwZXI6c3VwZXI=\r\nCache-Control:   no-cache\r\nConnection:      keep-alive\r\nContent-Length:  201\r\nContent-Type:    application/json\r\nHost:            127.0.0.1:8000\r\nOrigin:          chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop\r\nPhp-Auth-Pw:     super\r\nPhp-Auth-User:   super\r\nPostman-Token:   16103fb6-3847-efe8-9cc6-7aa2a48b4ff9\r\nUser-Agent:      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\r\nX-Php-Ob-Level:  1\r\n\r\n{\n\t\"name\": \"namee\",\n\t\"description\": \"description\",\n\t\"copyright\": \"copyright\",\n\t\"authorName\": \"authorName\",\n\t\"cdnIsFlushable\": true,\n\t\"enabled\": true,\n\t\"binaryContent\": \"data:image/jpeg;base64,patata\"\n}"

The request seems to be OK but the form is not being filled with it. I compare the request with another form post which is working, it's the same structure.
The form is never valid, because vield "should not be blank".
I will may find a solution testing form-data in another way.. Trying to send a real baseEncode image value..
I know it's a very specific case but if someone was in this case or was able to offer my a different point of view would be wonderfull. Or I will have to give up on Media Bundle which is perfectly working with the admin and reception just because of that :(
Thank you

A: The solution was just to do not override POSTMAN Headers Content-Type when using form-data type format.
Overriding POSTMAN Content-Type makes the POST being send empty..
After my tests in Postman, I used DATA_URL picture format to send it using Ionic and the MediaBundle API. (with Blob conversion and FormData javascript system)


text:
Q: Switching from portrait to landscape layouts in flexbox I want to realize following Layout with flexbox:

You can see both orientations in the picture. Left side for the portrait view and on the right side for the landscape view.
The premise is that I want to keep my html as short as possible (if it is possible).
Is there a way to do this with flex?
In the portrait view everything just works fine because it's just one column.
Now I'm stuck at the landscape orientation.
The navigation should be on the right side of the screen and the other content on the left.

header, footer, main, nav {
  margin: 5px;
  padding: 5px;
  border-radius: 5px;
  min-height: 120px;
  border: 1px solid #eebb55;
  background: #ffeebb;
}
section {
  display: flex;
  flex-direction: column;
}
@media only screen and (orientation: landscape) {
  /* no clue */
}

  header
  content
  navigation
  footer

Thank you very much for your time!

A: If you can't set a fixed height on the section, you could do like this where you give the navigaton an absolute position.

header, footer, main, nav {
  margin: 5px;
  padding: 5px;
  border-radius: 5px;
  min-height: 120px;
  border: 1px solid #eebb55;
  background: #ffeebb;
}
section {
  display: flex;
  flex-direction: column;
}
@media only screen and (orientation: landscape) {
  section {
    position: relative;
  }
  header, footer, main {
    width: calc(60% - 10px);         /*  10px is for the margin  */
    box-sizing: border-box;
  }
  nav {
    position: absolute;
    top: 0;
    min-height: calc(100% - 10px);   /*  10px is for the margin  */
    right: 0;
    width: calc(40% - 10px);         /*  10px is for the margin  */
    box-sizing: border-box;
  }
}

  header
  content
  navigation
  footer

A: For this layout to work with flexbox there must be a fixed height on the container. Otherwise, flex items don't know where to wrap and the nav element won't shift to the right column.
In this case, the layout appears to cover the viewport, so you should be all set.
Just use height: 100vh and the order property. No changes to the HTML.

section {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header, footer, main, nav {
  flex: 1;
  margin: 5px;
  padding: 5px;
  border-radius: 5px;
  border: 1px solid #eebb55;
  background: #ffeebb;
}

@media only screen and (orientation: landscape) {
  section {
    flex-wrap: wrap;
  }
  nav {
    flex-basis: 100%;
    order: 1
  }
}

body { margin: 0; }

  header
  content
  navigation
  footer

jsfiddle demo
For other options see: Make a div span two rows in a grid


text:
Q: Passing a set of NumPy arrays into C function for input and output Let's assume we have a C function that takes a set of one or more input arrays, processes them, and writes its output into a set of output arrays. The signature looks as follows (with count representing the number of array elements to be processed):
void compute (int count, float** input, float** output)

I want to call this function from Python via ctypes and use it to apply a transformation to a set of NumPy arrays. For a one-input/one-output function defined as
void compute (int count, float* input, float* output)

the following works:
import ctypes
import numpy

from numpy.ctypeslib import ndpointer

lib = ctypes.cdll.LoadLibrary('./block.so')
fun = lib.compute
fun.restype = None
fun.argtypes = [ctypes.c_int,
                ndpointer(ctypes.c_float),
                ndpointer(ctypes.c_float)]

data = numpy.ones(1000).astype(numpy.float32)
output = numpy.zeros(1000).astype(numpy.float32)
fun(1000, data, output)

However, I have no clue how to create the corresponding pointer array for multiple inputs (and/or outputs). Any ideas?
Edit: So people have been wondering how compute knows how many array pointers to expect (as count refers to the number of elements per array). This is, in fact, hard-coded; a given compute knows precisely how many inputs and outputs to expect. It's the caller's job to verify that input and output point to the right number of inputs and outputs. Here's an example compute taking 2 inputs and writing to 1 output array:
virtual void compute (int count, float** input, float** output) {
    float* input0 = input[0];
    float* input1 = input[1];
    float* output0 = output[0];
    for (int i=0; i<count; i++) {
        float fTemp0 = (float)input1[i];
        fRec0[0] = ((0.09090909090909091f * fTemp0) + (0.9090909090909091f * fRec0[1]));
        float fTemp1 = (float)input0[i];
        fRec1[0] = ((0.09090909090909091f * fTemp1) + (0.9090909090909091f * fRec1[1]));
        output0[i] = (float)((fTemp0 * fRec1[0]) - (fTemp1 * fRec0[0]));
        // post processing
        fRec1[1] = fRec1[0];
        fRec0[1] = fRec0[0];
    }
}

I have no way of influencing the signature and implementation of compute. I can verify (from Python!) how many inputs and outputs are required. Key problem is how to give the correct argtypes for the function, and how to produce appropriate data structures in NumPy (an array of pointers to NumPy arrays).

A: To do this specifically with Numpy arrays, you could use:
import numpy as np
import ctypes

count = 5
size = 1000

#create some arrays
arrays = [np.arange(size,dtype="float32") for ii in range(count)]

#get ctypes handles
ctypes_arrays = [np.ctypeslib.as_ctypes(array) for array in arrays]

#Pack into pointer array
pointer_ar = (ctypes.POINTER(C.c_float) * count)(*ctypes_arrays)

ctypes.CDLL("./libfoo.so").foo(ctypes.c_int(count), pointer_ar, ctypes.c_int(size))

Where the C side of things might look like:
# function to multiply all arrays by 2
void foo(int count, float** array, int size)
{
   int ii,jj;
   for (ii=0;ii<count;ii++){
      for (jj=0;jj<size;jj++)
         array[ii][jj] *= 2;
   }

}

A: In C, float** points to first element in a table/array of float* pointers.
Presumably each of those float* points to first element in a table/array of float values.
Your function declaration has 1 count, however it's not clear what this count applies to:
void compute (int count, float** input, float** output)

*

*2D matrix count x count in size?

*count -sized array of float* each somehow terminated, e.g. with nan?

*null-terminated array of float* each of count elements (reasonable assumption)?

Please clarify your question and I will clarify my answer :-)
Assuming the last API interpretation, here's my sample compute function:
/* null-terminated array of float*, each points to count-sized array
*/
extern void compute(int count, float** in, float** out)
{
    while (*in)
    {
        for (int i=0; i<count; i++)
        {
            (*out)[i] = (*in)[i]*42;
        }
        in++; out++;
    }
}

Test code for the sample compute function:
#include <stdio.h>
extern void compute(int count, float** in, float** out);

int main(int argc, char** argv)
{
#define COUNT 3
    float ina[COUNT] = { 1.5, 0.5, 3.0 };
    float inb[COUNT] = { 0.1, -0.2, -10.0 };
    float outa[COUNT];
    float outb[COUNT];
    float* in[] = {ina, inb, (float*)0};
    float* out[] = {outa, outb, (float*)0};

    compute(COUNT, in, out);

    for (int row=0; row<2; row++)
        for (int c=0; c<COUNT; c++)
            printf("%d %d %f %f\n", row, c, in[row][c], out[row][c]);
    return 0;
}

And how you use same via ctypes in Python for count == 10 float subarrays and size 2 float* array, containing 1 real subarray and NULL terminator:
import ctypes

innertype = ctypes.ARRAY(ctypes.c_float, 10)
outertype = ctypes.ARRAY(ctypes.POINTER(ctypes.c_float), 2)

in1 = innertype(*range(10))
in_ = outertype(in1, None)
out1 = innertype(*range(10))
out = outertype(out1, None)

ctypes.CDLL("./compute.so").compute(10, in_, out)

for i in range(10): print in_[0][i], out[0][i]

Numpy interface to ctypes is covered here http://www.scipy.org/Cookbook/Ctypes#head-4ee0c35d45f89ef959a7d77b94c1c973101a562f, arr.ctypes.shape[:] arr.ctypes.strides[:] and arr.ctypes.data are what you need; you might be able to feed that directly to your compute.
Here's an example:
In [55]: a = numpy.array([[0.0]*10]*2, dtype=numpy.float32)

In [56]: ctypes.cast(a.ctypes.data, ctypes.POINTER(ctypes.c_float))[0]
Out[56]: 0.0

In [57]: ctypes.cast(a.ctypes.data, ctypes.POINTER(ctypes.c_float))[0] = 1234

In [58]: a
Out[58]:
array([[ 1234.,     0.,     0.,     0.,     0.,     0.,     0.,     0.,
            0.,     0.],
       [    0.,     0.,     0.,     0.,     0.,     0.,     0.,     0.,
            0.,     0.]], dtype=float32)


text:
Q: on some standard formulations of the axiom of choice One of the standard statements  of the axiom of choice is the following:
Let S be a given  nonvoid `universal'  set.
To each i in a nonvoid set I associate a  nonvoid subset X_i of  S.
(Other wordings are ``  let (X_i:i\in I) be a family of subsets S)".
Then there is  a function f that maps each i to some element x_i in X_i
(in other  words the cartesian product \prod X_i is non void).
In my opinion this statement does not make sense, since in the hypothesis one already uses
a special case of the conclusion. The statement  "one associates X_i" is nothing but
the assumption that there is a map iota from I into P(S),  the power set of S.
 In other words,  iota is an element of P(S)^I, the cartesian product of I copies of P(S).
Thus a special case of the  axiom of choice serves as the hypotheses for what is claimed....
How to go around in this version of the axiom of choice?

A: That is not a real problem. You are given a function which assigns indexes to a set. Not to mention, that if $A$ is any set at all, then it can be indexed by itself. For example $\Bbb N$ can be indexed using itself, where each element is its own index. This works for other sets as well (only you don't have a notion of first, second, and so on; and you don't need one either).
You could also say that it is a problem that when you talk about a limit of a uniformly convergent sequence of continuous functions being continuous, you're using the conclusion since each function in the sequence is a limit of such sequence on its own.
No. This is certainly not a problem. Suppose you are given such a family of non-empty sets. Then there is a function which chooses one element from each member of that family.


text:
Q: Exercises on character group $G^*$ of a group $G$ Let $S^1=\{z \in \mathbb{C} : |z|=1\}$, which is a group under multiplication of functions. For a group $G$ define  $G^*=Hom(G,S^1)$, the character group of $G$. Prove that $G^*$ is indeed a group under multiplication of functions.
Prove:
$a) (A\oplus B)^* \cong A^* \oplus B^*.$
$b)$ If $G$ is a finite abelian group then $G \cong G^*$.
$c)$ Let $G$ be a finite abelian group and $H$ a subgroup of $G$. Show that there is a subgroup $N$ of $G$ such that $G/N \cong H$. Similarily, if $H$ is isomorphic to a quotient group $G$ then $H$ is isomorphic to a subgroup of $G$.
I need help with c), I am not sure if a),b) are correct.
Solution:
First we show $G^*$ is a group under multiplication.
Identity: $\mathbb{1}:= \mathbb{1}(a)=1 \in G^*$ is the identity element in $G^*$ as if $f \in G^*$, $(f*\mathbb{1})(a)=f(a)*1=f(a)=1*f(a)=(\mathbb{1}*f)(a)$.
Associativity: let $f,g,h \in G^*$, $((f*g)*h)(a)= (f(a)*g(a))*h(a)=f(a)*(g(a)*h(a))=(f*(g*h))(a)$.
Inverse:  Let $f \in G^*$, then let $f^{-1}(a):=f(a)^{-1}$, we show $f^{-1}$ is a homomorpism: $f^{-1}(0)=f(0)^{-1}=1^{-1}=1$, $f^{-1}(a+b)=f(a+b)^{-1}=(f(a)f(b))^{-1}=f(a)^{-1}f(b)^{-1}=f^{-1}(a)f^{-1}(b)$.
Hence, $G^{*}$ is a group under multiplication.
a) Consider the map $\phi: (A\oplus B)^* \rightarrow A^* \oplus B^*$ by $\phi(f)=(f|_{A},f|_B)$, it is an isomorphism.
b) Let $G$ be a finite abelian group, then $G \cong \oplus_{1}^{n}\mathbb{Z}_p$, by $2)$, $G^* \cong \oplus_{1}^{n}\mathbb{Z}_p^* \cong \oplus_1^n\mathbb{Z}_p$.

A: I don't know how much you know about category theory and homological algebra, but I'm going to prove the first part of c) showing that $Hom(-,S^1)$ is a contravariant right-exact functor from the category of finite abelian groups to itself.
That means that given the exact sequence $0\to H\to G\to G/H$, it will give us an exact sequence $Hom(G/H,S^1)\to Hom(G,S^1)\to Hom(H,S^1)\to 0$. And since $Hom(-,S^1)$ is the ''identity'' on objects, i.e., $Hom(G,S^1)\cong G$, we will get an exact sequence $G/H\to G\to H\to 0$ (it actually gives an isomorphic exact sequence, but exactness of one follows from exactness of the other one). Since you know the definition of exact sequence, I'm assuming that you know that this mean that $H\cong G/\mathrm{Im}(G/H)$ using the first isomorphism theorem, so $N= \mathrm{Im}(G/H)$.
Given a homomorphism $h:H\to G$, there is a natural homomorphism $h^* =Hom(h,S^1):G^*\to H^*$ given by $h^*(g)=g\circ h$. With this in mind, I'll let you check that $Hom(-,S^1)$ is indeed a contravariant functor using the definitions.
Now, we already have that $Hom(-,S^1)$ applied to $0\to H\to G\to G/H $ gives us a (not yet exact) sequence $G/H\to G\to H\to 0$, since it reverses arrows and respects compositions in the contravariant sense. Then, let's prove that $Hom(-,S^1)$ transforms the injection $H\to G$ into a surjection $G\to H$.
To show that $h^*$ is surjective I take two homomorphisms $j: F\to H$ and $k:F\to H$ such that $j^*h^*=k^*h^*$. Let's apply this to $z\in \operatorname{Hom}(F,S^1)$. We get $j^*h^*(z)=k^*h^*(z)\Rightarrow z\circ h\circ j=z\circ h\circ k$. Now take and injective $z$, which exists since the image of $(1,\dots, 1)$ under the isomorphism $F\cong Hom(F,S^1)$ is injective. To see this, remember that an element of $Hom(F,S^1)$ is determined by the $p_i$-th root of unity that is the image of $1\in\mathbb{Z}_{p_i}$.
 Since $F=\oplus_{i=1}^n\mathbb{Z}_{p_i}$ being $p_i\neq p_j$ for $i\neq j$, the only $p_i$-th root that is $p_j$-root is $1$. Then, by injectivity of $z$, $h\circ j=h\circ k$, and by injectivity of $h$, $j=k$, hence $j^*=k^*$ and therefore $h^*$ is surjective.
This shows that $G\to H\to 0$ is exact. Finally, we need to show that $\ker{p^*}=\mathrm{Im}{h^*}$, where $p:G\to G/H$ is the quotient map. This follows from the more general fact that $Hom(-,X)$ is left-exact in many contexts. It is not a hard proof so you could try to do it, but you can also look it up here in the case of $R$-modules (the proof for finite abelian groups is similar).
There are more general and abstract ways to prove this fact, for example the one in this answer, but since you don't know a lot about category theory I tried to use less of that machinery.

A: Let $i \colon H \to G$ be the inclusion homomorphism. We can define the homomorphism $i^* : G^* \to H^*$ as $i^*(f) = f \circ i$. @Javi proves that $i^*$ is surjective in the fifth paragraph of his answer. Apply the first isomorphism theorem to get $G^*/\ker i^* \cong H^*$. From (b), you can remove the stars from $G^*$ and $H^*$. You can also deduce from (b) that there is a subgroup $N < G$ with $N \cong N^* \cong \ker i^*$.


text:
Q: Mount FAT32: Can't find a valid FAT filesystem Xubuntu 14.04. nfts-3g is installed.
/dev/sdc is the Flash drive. I have created new partition with fdisk (tried with cfdisk too). Tried with W95 FAT32 code and W95 FAT32 (LBA) code. ("b" and "c" in fdisk).
After writing the changes I try to mount it with:
mount -t vfat /dev/sdc1 /media/flash4gb/
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

dmesg says:
[60591.890070] FAT-fs (sdc1): invalid media value (0x73)
[60591.890077] FAT-fs (sdc1): Can't find a valid FAT filesystem

NOTE: Usually the other software like: USB bootable USB creators working well. After they touch the drive, everything is fine. I am not sure FAT32, but the NTFS is well.

A: After creating the partition with fdisk you must create the FAT file system:
sudo mkfs.vfat -F 32 /dev/sdc1

Then you should be able to mount /dev/sdc1 with -t vfat.


text:
Q: Highcharts create space for negative value Creating Pie chart using highcharts library but it creates empty space between slice for negative value.
I would like to remove that empty space and want to show negative value as 0.0.
Following is my code..
  [http://jsfiddle.net/mukeshkumartech/xnxL3adL/][1]

You can see with this code that data is not displaying for "Firefox" as 0.0 without creating sapce.

A: You can prepare you data before passing it to the chart constructor just like this:
  data: [
    ['Firefox', -45.089],
    ['IE', 26.8],
            ['Chrome:', -10],
    ['Safari', 8.5],
    ['Opera', 6.298],
    ['Others', 0.7]
  ].map(function(pointArr) {

    var newPoint = {
        name: pointArr[0]
      },
      value = pointArr[1];
    if (value < 0) {
      newPoint.y = 0;
      newPoint.negY = value;
    } else {
      newPoint.y = value
    }
    return newPoint;
  })

If the value is negative than I use 0 as the y property and save the original value in the negY property to use it later in the dataLabels.formater:
    dataLabels: {
      enabled: true,
      formatter: function() {
        console.log(this);
        var point = this.point;
        return this.key + " - value: " + (point.negY ? point.negY : point.y);
      }
    }

Live working example: http://jsfiddle.net/kkulig/6u7Lzfu9/
API reference: https://api.highcharts.com/highcharts/series.pie.dataLabels.formatter


text:
Q: Pass variables between different scripts python I made a script python app.py and I managed to store data from a javascript form, thanks to a flask app :
app = Flask(__name__)
app.config.from_object('config')
db.init_app(app)

@app.route('/getFormData', methods=['POST'])
def get_javascript_data():
    params = request.form.to_dict()
    sunElevation = params['sunElevation']
    cloudCoverage = params['cloudCoverage']
    thresholdNDVI = params['thresholdNDVI']
    limitScene = params['limitScene']
    city = params['city']
    data_search = passData(sunElevation, cloudCoverage, thresholdNDVI, limitScene, city)
    return jsonify(data_search.data_dict)

if __name__ == '__main__':
    app.run()

Here is the definition of the class passData, in models.py :
class passData:
    def __init__(self, sunElevation, cloudCoverage, thresholdNDVI, limitScene, city):
        self.sunElevation = sunElevation
        self.cloudCoverage = cloudCoverage
        self.thresholdNDVI = thresholdNDVI
        self.limitScene = limitScene
        self.city = city
        self.data_dict = [{'sunElevation':self.sunElevation,'cloudCoverage':self.cloudCoverage, 'thresholdNDVI':self.thresholdNDVI, 'limit':self.limitScene, 'city':self.city}]

I need to use those different parameters (sunElevation...) in an other script, in a other folder, to execute a search of imagery and then run the script associated. My problem is that I don't know how to pass those data, because  they seem to only exist in the fonction defined in the get_javascript_data().
If someone has an idea that could help me !

A: You just have to import the other script, call the function and pass the parameters:
app = Flask(__name__)
app.config.from_object('config')
db.init_app(app)

from path.to.your.file import your_function

@app.route('/getFormData', methods=['POST'])
def get_javascript_data():
    params = request.form.to_dict()
    sunElevation = params['sunElevation']
    cloudCoverage = params['cloudCoverage']
    thresholdNDVI = params['thresholdNDVI']
    limitScene = params['limitScene']
    city = params['city']
    data_search = passData(sunElevation, cloudCoverage, thresholdNDVI, limitScene, city)

    # call the function and pass the parameters
    your_function(sunElevation, cloudCoverage) #...

    return jsonify(data_search.data_dict)

A: Try adding the following code in your file, then import the script
import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))

from eosLandviewer.main_naturalite import search


text:
Q: Android Studio 2.0: Run task only on first run. NOT at Instant Run I'm trying to setup instant runt for my project. Unfortunately my predecessors decided to hook some actions to preBuild (downloading configuration data to be more precise). The actions provide some data to BuildConfig. This is being run now every time I try to use the Instant Run feature and makes it ~1,5min long.
My question is: Is there a way to hook a task only to the dry run and do not run it for Instant Run?
First run:

*

*downloadingTask

*prebuild and stuff

Instant run:

*

*prebuild and stuff


text:
Q: Surrond h1 entry-title automatically with a span tag I would like to implement a style on all h1 entry titles, the issue is that the styling is reliant on there being span tags around the element. Hence how can I automatically insert a span tag either side of my entry titles.
For background info, this is the style I wish to add:
h1.entry-title {
   text-transform: uppercase;
   position: relative;
   text-align: center;
   margin-bottom: 50px;
}

h1.entry-title span {
    background: #fff;
    padding: 0 30px;
    position: relative;
    z-index: 1;
}

h1.entry-title:before {
    background: #004B92;
    content: "";
    display: block;
    height: 1px;
    position: absolute;
    top: 50%;
    width: 100%;
}

h1.entry-title:before {
    left: 0;
}

Which results in:

As you can see, the span is key for hiding part of the line.

Partners

I was hoping there maybe something I could write into the functions.php file to achieve this?

A: You could either add the span in your template file like this:

<?php the_title() ?>

Or you could add a filter to manipulate the output like this:
add_filter('the_title', function ($title) {
  $title = '' . $title . '';
  return $title;
});


text:
Q: Multiple Image Fadeout on scroll I have a onepage and on each navigation point a image in the middle of the site changes color by fading.
I managed to fade in with: $("#active3").fadeIn(2000);
However I have a issue fading it out again.
Let me try to explain:
I have 5 Navigation points with 5 different images.
If I (for example) scroll from first to third navigation point im gonna have 3 pictures laying over each other since on every navigation point, one picture fades in.
If I then jump from third again to the first I have to get the first picture on top somehow ( which wouldn't work for me since z-index can not fade, or? )  or I fade 2 and 3 out.
So I tryed to fade out each image which is not on the active navigation point out. For example when I was on the second navigaton point the code would be:
$("#active1").fadeOut(2000);
$("#active2").fadeIn(2000);
$("#active3").fadeOut(2000);
$("#active4").fadeOut(2000);
$("#active5").fadeOut(2000);

But It seems that the fadeOuts queue and don't happen at the same time.
This is the site im working on: http://palmira-lopez.de
thank you for helping!
Also as a sitenote, this is not a commercial project but a site for my mum :)

A:
But It seems that the fadeOuts queue

You can use .finish() to tell jquery to finish whatever is currently queued.
$("#active1").finish().fadeOut(2000);
$("#active2").finish().fadeIn(2000);
$("#active3").finish().fadeOut(2000);
$("#active4").finish().fadeOut(2000);
$("#active5").finish().fadeOut(2000);

this may not be what you want though and you may want .hide() for those that are not in the process.
You might be better adding a class and using css transitions.


text:
Q: Why does ^C, ^V etc. appear in the terminal when I use the Ctrl+character keyboard shortcut? Sometimes, when copy-pasting text from the output of commands, I'll accidently use Ctrl+c instead of Ctrl+Shift+c.
So the command-line interprets it as ^C...
Why is this? Why does the command-line interpret control input as ^?

A: Because CTRL+KEY combos are interpreted by the terminal as non-printable ASCII characters, and being those non-printable you need a way to represent them.
The convention, stemming from VT terminals with ANSI support, is to represent the CTRL+KEY combo representing CTRL with a caret (^) and KEY with KEY.

A: When copying and pasting to/from a terminal, it is best practise to use the short cuts Ctrl+Insert and Shift+Insert respectively.
These are the more traditional short cuts for terminal use, though you'll note that in an X graphical environment Ctrl+Insert and Shift+Insert are tied to the same Ctrl+C and Ctrl + V.
In most terminals Ctrl+C (represented by ^C) are used to halt the execution of a process, hence pasting with that short cut won't work.
For quick copying and pasting, you can utilize X's primary buffer by highlighting whatever text you want to copy, and then middle-clicking where you want to paste it. No keyboard required.

A: It does not actually insert the character sequence "^C". This is only a representation for unprintable ASCII control characters, such as:

*

*^C → ETX (End of text, sends a kill signal), ASCII 0x03

*^D → EOT (End of transmission, terminates input), ASCII 0x04

*^H → BS (Backspace, \b), ASCII 0x08

*^J → LF (Line feed, \n), ASCII 0x0A

*^L → FF (Form feed, new page, clears the terminal), ASCII 0x0C

*^M → CR (Carriage return, \r), ASCII 0x0D

This is only a small extract of possible ASCII control characters that can be inserted using the keyboard; you can find a full list here.
I think the most important ones to remember are Ctrl+C, Ctrl+D and Ctrl+L.

A: You should be using Ctrl+C and not Shift+Ctrl+C, because on the command line, they do the same thing (and Ctrl+C is easier than Shift+Ctrl+C).  That might not be true in certain graphical environments where the GUI captures some keystrokes and does something special, but if the keystrokes are truly sent to the command line, then there is no difference.  This is why pressing Ctrl+C may show ^C as a capital C, instead of a lowercase C.  The command line makes no distinction on which one you pressed (and uppercase was presumably judged to be easier to read).  This is true for letters; for other characters, the Shift may have an effect.)
Pressing Ctrl-C sends the ASCII code that is 64 below the uppercase letter's position in the ASCII table (and 96 less than the lowercase letter's position in the ASCII table).  So pressing Ctrl-c (lowercase) sends ASCII code 3 (which is 64 less than capital C's ASCII code of 67).  In many environments, you can hold Alt and then press 3 on the numpad (and then release the 3 key, and then release the Alt key) and you may get the same effect.
Regarding ^C, the ^ is just a well-known shorthand for the "Ctrl" key.  Similarly, M- is a shorthand for the "Alt" key.  Err, yeah.  M stands for the word "Meta", which can be entered by holding Alt and pressing whatever comes next, or sometimes by pressing Esc (and releasing Esc) and then pressing whatever comes next.  Wikipedia's article on "Control Key": "Notation" section describes this as "Traditional notation".  This is also known as Caret Notation (Wikipedia's article on Caret notation, Unix StackExchange: ryvnf's question about Caret Notation).
Regarding the last question, the command shell is not "interpreting" anything to be a caret.  In other words, the shell is not reading anything, and believing that it is a caret.  What is happening is that the shell is using the well-known caret notation for output.  As another example, you can see the well-known pager, "less", use caret notation by running: dd if=/dev/zero bs=64 count=1 | less
(The "nano" text editor also uses caret notation in its online help, including the full screens of online help shown after pressing ^G, a.k.a. Ctrl-g.)


text:
Q: Get a CookieContainer from a WebBrowser control? First of all, excuse me If I misunderstood some concepts, since web requests and cookies are not my fort.
Well, the thing is that I would like to get all the cookies stored in the WebBrowser's session for the current url. This will help me for example after interactively logging in a website, I can retrieve the cookies from the WebBrowser instance to use them in background with the HttpWebRequest class. (the website has security measures like a captcha and a random question, so for me is not viable to try automate it using requests in background to login and store the cookies, I prefer to use a webbrowser)
This is what I tried so far, it seems that it works fine but I'm not sure whether I did it all ok without missing any important thing to take into account, and I think my approach seems a little dirty solution, I mean maybe exists a direct way to get this from the abstraction layer of the WebBrowser control...
<HideModuleName>
Public Module WebBrowserExtensions

    <Extension>
    <DebuggerStepThrough>
    Public Function GetCookieContainer(ByVal wb As WebBrowser) As CookieContainer
        Dim uri As Uri = wb.Url
        Dim cookieContainer As New CookieContainer()
        Dim cookies As String() = wb.Document.Cookie.Split({";"c}, StringSplitOptions.None)

        For Each cookie As String In cookies
            Dim name As String = cookie.Substring(0, cookie.IndexOf("="c)).TrimStart(" "c)
            Dim value As String = cookie.Substring(cookie.IndexOf("="c) + 1)
            cookieContainer.Add(uri, New Cookie(name, value, "/", uri.Host))
        Next cookie

        Return cookieContainer
    End Function

End Module

So, my question is: It is all ok with my approach?, if not then which would be the proper way to do this?.
PS: I know the WebBrowser is a embedded instance of Internet Explorer, but I'm not sure about how the WebBrowser manages the cookies, I mean if the cookies persists only during the lifetime of the current application or the WebBrowser instance, or just the cookies are stored in the system and are the same cookies used by Internet Explorer. As I said, excuse me If I misunderstood some concepts.


text:
Q: Reactivesearch Autosuggest with ascii-folding I do not seem to be able to get autosuggest to work with ascii folding (i.e. convert accents to their ascii equivalents)
  <DataSearch
      componentId="mainSearch"
      dataField="_name"
      categoryField="title"
      className="search-bar"
      queryFormat="and"
      placeholder="Search for movies..."
      iconPosition="left"
      autosuggest={true}
      filterLabel="search"
  />

Mapping
"_name": {
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "ascii": {
                        "type": "text",
                        "analyzer": "autosuggest_analyzer"
                    },
                    "ascii2": {
                        "type": "text",
                        "analyzer": "ngram_analyzer"
                    }
                }
            },

A: Thank you @David for reporting this.
Can you try adding ascii fields to dataField prop. dataField prop can accept either String or Array, so you can specify multiple fields there, example
<DataSearch
   dataField={["_name", "_name.ascii", ...othersIfAny]}
   ...
/>


text:
Q: why nuget could not add protobuf-net 668 reference to visual studio project automatically I use nuget in my vs project to download dependencies, Mysql.Data and Protbuf-net,
the packages.config file is under the same directory whith .sln file, which contains :
<packages>
<package id="MySql.Data" version="6.9.9" targetFramework="net40-client" />
<package id="protobuf-net" version="2.0.0.668" targetFramework="net40-client" />
</packages>

when restored packages, there is a new folder packages which contains MySql.Data and protobuf-net, but
only MySql.data reference is added into project Reference. I know I can manually add the reference to it, but
the issue is that when use travis-cl to build my solution, It will fail

A: NuGet package restore will not modify your project. If your project is missing the protobuf-net reference you will need to modify your project.

A: If you want to add the package references into project automatically, I suggest you put the packages.config file to the same directory with .csproj file.
Then reinstall them with following command after restore packages. I have tested it in my side, when running this command in Package Manager Console window, the package references will be added into project automatically.

Update-Package -reinstall

And you also can choose add the references manually.


text:
Q: Is there a close event for the browser contextmenu I'm catching the contextmenu event using jQuery like this:
$(document.body).on("contextmenu", function(e){
    //do stuff here
});

So far, so good. Now I want to execute some code when it closes but I can't seem to find a correct solution for this.
Using something like the following would catch some of the cases, but not nearly all:
$(document.body).on("contextmenu click", function(e){});

It wouldn't be executed when:

*

*the browser loses focus

*an option in the contextmenu is chosen

*the user clicks anywhere in the browser that's not on the page

note: I'm not using a jQuery context menu, I'm just using it to catch the event.

A: Following code may help you. jsfiddle
var isIntextMenuOpen ;
$(document).on("contextmenu", function(e){

    isIntextMenuOpen = true;
});
function hideContextmenu(e){
       if(isIntextMenuOpen ){
            console.log("contextmenu closed ");
       }

     isIntextMenuOpen = false;
}
$(window).blur(hideContextmenu);

$(document).click(hideContextmenu);

A: I needed to detect when a context menu closes and so I came up with a solution.
Fiddle:  https://jsfiddle.net/kexp0nmd/1/

var premenuelem;

var TempContextMenuCloseHandler = function(e) {
console.log('closed!');
//console.log(e);
 window.removeEventListener('keyup', TempContextMenuCloseHandler, true);
 window.removeEventListener('mousedown', TempContextMenuCloseHandler, true);
 window.removeEventListener('focus', TempContextMenuCloseHandler, true);

 var focuselem = document.getElementById('tempfocus');
 if (focuselem === document.activeElement)  premenuelem.focus();
 focuselem.style.display = 'none';
};

var TempContextMenuHandler = function(e) {
console.log('open!');
//console.log(e);
 premenuelem = document.activeElement;

 var focuselem = document.getElementById('tempfocus');
 focuselem.style.display = 'block';
 focuselem.focus();

 window.addEventListener('keyup', TempContextMenuCloseHandler, true);
 window.addEventListener('mousedown', TempContextMenuCloseHandler, true);
 window.addEventListener('focus', TempContextMenuCloseHandler, true);
};

window.addEventListener('contextmenu', TempContextMenuHandler, true);
html, body { min-height: 100%; }
<textarea></textarea>

Tested and verified working as of May 2020 on Edge, Firefox 76, and Chrome 80 for both mouse and keyboard.  Mobile/touch support unknown.
The key aspect of this solution is using an element that has a tabIndex on it.  By showing and moving focus to that element (focus stealing) before the context menu appears causes Edge and Chrome to send a focus change event when the user later closes the context menu.  I made the background of the div gray so it could be seen - in production, make it a transparent background and style it up however you want.
The keyup handler catches the release of the Escape/Enter key for when the keyboard closes the context menu.  The mousedown handler catches mousedown events in Firefox only.
As far as I can tell, there is no way to know for certain what option a user selected or even if they did, in fact, select an option.  At the very least, it allows for consistent detection of context menu open/close across all major browsers.
The textarea in the example is just there to give something else to play with for focus handling.
While this solution involves temporary focus stealing, it is the cleanest, cross-browser solution until browser vendors and the W3C add an 'exitcontextmenu' event or some such to the DOM.
One minor bug I just ran into:  Showing the context menu and switching away to another application closes the context menu but does not fire the closed event right away.  However, upon switching back to the web browser, the event fires and the close handler runs.  Adding a 'blur' capture to the window might solve that but then I'd have to re-test everything and it might break something (e.g. fire blur on opening the context menu).  Not worth fixing for the extremely rare occasion this might happen AND the handler still fires - it's just visibly delayed.


text:
Q: Mailgun Error 'The parameters passed to the API were invalid I am using mailgun to help me with sending mails on laravel.
Here mail code:
$data = array('name' => ucfirst($customer_name),'email' => $email, 'ticket_id' => $ticket_id);
$mail_data = array('name' => ucfirst($customer_name),'email' => $email, 'mobile' =>  $contact, 'address' => $address, 'delivery_type' => ucfirst(Input::get('delivery_type')), 'pickup_type' => ucfirst(Input::get('pickup_type')), 'pickup_date' => $pickup_date, 'pickup_time' => $pickup_time, 'brand' => $brand_name, 'ticket_id' => $ticket_id, 'city' => $region_name);

Mailgun::send('emails.ticket', $mail_data , function($message) use($data)
{
  $message->to($data['email'], $data['name'])
          ->bcc(array('myemail@mydomain.com, aotheremail@mydomain.com, onemore@mydomain.com, lastone@mydomain.com'))
          ->subject('Service Request! - '.$data['ticket_id']);
            });

I checked the logs figured out:
[2016-12-29 05:58:58] production.ERROR: exception 'Mailgun\Connection\Exceptions\MissingRequiredParameters' with message 'The parameters passed to the API were invalid. Check your inputs! Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.' in /var/www/html/mysite/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php:169
Stack trace:
#0 /var/www/html/mysite/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php(88): Mailgun\Connection\RestClient->responseHandler(Object(GuzzleHttp\Message\Response))
#1 /var/www/html/mysite/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php(106): Mailgun\Connection\RestClient->post('sandbox798d350d...', Array, Array)
#2 /var/www/html/mysite/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php(53): Mailgun\Mailgun->post('sandbox798d350d...', Array, Array)
#3 /var/www/html/mysite/vendor/bogardo/mailgun/src/Bogardo/Mailgun/Mailgun.php(104): Mailgun\Mailgun->sendMessage('sandbox798d350d...', Array, Array)
#4 /var/www/html/mysite/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(222): Bogardo\Mailgun\Mailgun->send('emails.ticket', Array, Object(Closure))
#5 /var/www/html/mysite/app/Http/Controllers/AppController.php(384): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#6 /var/www/html/mysite/app/Http/Controllers/AppController.php(384): Bogardo\Mailgun\Facades\Mailgun::send('emails.ticket', Array, Object(Closure))
#7 [internal function]: App\Http\Controllers\AppController->pickup_request()
#8 /var/www/html/mysite/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(256): call_user_func_array(Array, Array)
#9 /var/www/html/mysite/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(164): Illuminate\Routing\Controller->callAction('pickup_request', Array)

I am not able to figure where the problem is? is it the syntax error? or what could be wrong?
It used to work properly now it has stopped.
Thanks!

A: The error tells everything :)

The parameters passed to the API were invalid. Check your inputs! Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.

In Mailgun, sandbox subdomains are only for testing. If you need to really sending out emails you will need to add your domain name into your mailgun acc, or add authorized recipients into your mailgun account settings.
So in this case, you will need to either add mydomain.com into your mailgun whitelisted domains, or add myemail@mydomain.com, aotheremail@mydomain.com, onemore@mydomain.com, lastone@mydomain.com into whitelisted emails.
Relevant docs: https://help.mailgun.com/hc/en-us/articles/217531258-Authorized-Recipients
Related Q&A: https://laracasts.com/discuss/channels/laravel/sending-emails-with-mailgun


text:
Q: Pinterest Authentication url returning 404 error? I am testing pinterest api
http://pinterest.com/developers/api/
here on above url in authentication section it says i have to redirect users to pinterest Authentication screen.
but when i redirect users o this url(with my client_id and redirect_url)
https://pinterest.com/oauth/authorize/?client_id=12345456&redirect_uri=YOUR_REDIRECT_URI&scope=read

it returns 404 error?
what is wrong here?

A: This is the response I received from them the other day:

Hello Chris, the API was not really opened for public consumption. We pushed the docs live in an attempt to get feedback but we had to shut it down since we saw activity. We will write back the people who signed up for the beta list when we are ready.
Please fill out this form to get on the beta list.
https://docs.google.com/a/pinterest.com/spreadsheet/viewform?hl=en_US&formkey=dHBvVkVsN2NzUVEybDhjeFZ0ZzFKWnc6MQ

I wish they'd note this on the docs.


text:
Q: How to create internal Linking inside CHM help file I am creating a Help file for a C# program i wrote. i am using Windows HTML helper to create the CHM file. how can i go about creating links within this to jump me to another page or another part of the CHM file?
Thanks

A: Links inside a CHMis nothing CHM specific, they are just use normal HREF urls.
The only thing you want to do is make sure they all have relative paths relative to your CHM root directory.

A: You have to do it manually in each of source HTML files or use any of the help authoring tools available. Helpinator for example.

A: It have not come across any way to create internal links in a help file.
A way to do so is to create hyperlinks in a word document and then create the help file. It will work properly as you want.
If you encounter any issues, let me know!


text:
Q: Razor mvc3 + jquery + UrlAction + PartialViews I have a question about jQuery + Razor.. I want to build a javascript variable using razor with @Url.Action and the html attributes will be values of inputs.
Like this:
var d1 = $('#d1').val();
var d2 = $('#d2').val();
var url = "@Url.Action("Links", "PartialAccount", new { beginDate = "d1", endDate = "d2" })"
$("#links").fadeOut("slow").load(url).fadeIn("slow");
How can I do this?
Is it the same that below?
var url = "/PartialAccount/Links/?beginDate=" + d1 + "&endDate=" + d2;

A: I would pass the two values via the data parameter of load() if you want to get the values from dom elements?
$("#links").fadeOut("slow").load(url, { beginDate: d1, endDate: d2}).fadeIn("slow");

A: You should use the load  method as proposed by InfernalBadger:
load('@Url.Action("Links", "PartialAccount")', { beginDate: d1, endDate: d2})

because this will encode the parameters in d1 and d2 correctly. But only if you can pass the parameters as part of the querystring, not when they should be a part of the url itself.
So you can use if you want your url to be:
 /bar/foo?beginDate=1-1-2001&endDate=2-2-2001

(note that the /'s in the date will be encoded)
You cannot use this if you want your url to be:
/bar/foo/1-1-2001/2-2-2001

The @Url method, with the beginDate and endData parameters, does not work, because this is executed on the server, before the page is send to the browser.
And your method by using the + operator fails the user enters "special characters" in the input boxes (like dashes /).


text:
Q: What is meant by op = "" in this code? def three():
    op = ""
    num = int(input("Input a number:"))
    while num > 0:
        r = num % 2
        num = num // 2
        op = str(r) + op
    print (op)

*

*Could someone please explain line two of the code as it appears to not be setting anything?

*Also, could someone also explain what the second bottom line is doing?

A: op is just an initially empty string (line 2) which gets prepended by the string representation of r inside the loop (2nd last line).
Say the number chosen is 5. These are the iterations of the loop:

*

*r = 5%2 = 1
num = 5//2 = 2
op = "1"

*r = 2%2 = 0
num = 2//2 = 1
op = "0" + "1" = "01"

*r = 1%2 = 1
num = 1//2 = 0
op = "1" + "01" = "101"
Overall the loop makes a string which is the binary representation of the number entered.

A: op needs to be declared as a variable before it's used in the while loop; otherwise it would have a syntax error.  Remove that first line and see.
It's assigned "" because later on it gets added to (or rather, replaced with a new piece of text and its current value at the end).  So just doing
op = None

would not have worked (you cannot add a str and None)
The second bottom line concatenates; r needs to be converted to a string (because it's an int), and so it ends up prepending the value of r as a string to op.


text:
Q: How to speed up execution of Android UI tests as part of a CI system I'd like all unit & instrumentation tests (Espresso) to be ran after each commit / merge to the main develop branch. Unit tests are fast enough to allow this, but UI tests are not - 150 fully mocked UI tests take ~1h to run on a single device. Shazam's FORK library does great job in sharding these 150 tests across all connected devices. The current solution is a local machine with Jenkins running on it. Connecting 4 devices to it reduces the time to run UI tests to ~15 mins. That's not ideal, but bearable.
Ideally I'd like to find a cloud based CI system that allows me to run UI tests using Fork, so that the local Jenkins can be ditched and not maintained internally.
I tried AWS Device Farm and Firebase Test Lab, but both are using their own systems to run the tests. It seems they don't give the option to shard a single test suite across multiple devices. They seem to be great tools to run the whole test suite on different devices simultaneously, but that's not what I want for a CI solution (to split the test suite to multiple devices simultaneously).
Tried BuddyBuild as well, but internally their using Firebase Test Lab, so that didn't work for my case as well.
I was mainly thinking for solutions along these directions:

*

*find a way to run Fork on a cloud based solution

*find another way to shard a single test suite across multiple devices

Any suggestions are welcome! How do you guys solve this problem?

A: Congrats! Too much automation is a great problem to have. It sounds like you have already made a lot of progress speeding up the execution time. I'd say 15 minutes is a pretty reasonable number, but here are some alternate approaches to get that number even lower:

*

*Create a smaller and faster test suite of the highest priority test cases to run per commit while the longer running full test suite runs continuously against the latest merged commits. This is a pretty common pattern across the industry. You can use Android's built-in @Small, @Medium, and @Large annotations or package names to divide tests up.

*Optimize your test cases so multiple features are tested at once. Essentially, instead of testing every combination like A1,A2,B1,B2, you would instead test only A1,B2. See the pairwise testing Wikipedia page for a more detailed explanation.

*If it's possible for your app, try using emulators. Performance has improved greatly the last couple years. Using Intel Hardware Accelerated Execution Manager (HAXM) drivers I found tests ran faster and more reliably than on most physical devices. This could also make it easier for your goal to run in the cloud.

*Check how long each individual test takes to run corresponding to its priority. A low priority long running test could be moved to a less frequently running test.

*Watch the tests run to identify sleeps or other slow running areas of the test to improve.

*Look for tests that have never failed. Those could also be another candidate for moving to a less frequently running test.

*If you are looking for alternate ways to shard tests, you could roll your own by kicking off parallel scripts across devices that target a subset of your tests using adb shell am instrument options. Although, this would create many separate test reports and you would need to evenly divide the tests up yourself.

A: Might take a look at the Flank open source project which seemed to be built with pretty much the same goal in mind: https://medium.com/walmartlabs/flank-smart-test-runner-for-firebase-cf65e1b1eca7

Flank is a Firebase Test Lab tool for massively-scaling your automated Android tests. Run large test suites across many devices/versions/configurations at the same time, in parallel. Flank can easily be used in a CI environment where Gradle (or similar) first builds the APK:s and then Flank is used to execute the tests.

A: I would also vote to the above suggestion especially item 1
"Create a smaller and faster test suite of the highest priority test cases to run per commit while the longer running full test suite runs continuously against the latest merged commits. This is a pretty common pattern across the industry. You can use Android's built-in @Small, @Medium, and @Large annotations or package names to divide tests up.
Optimize your test cases so multiple features are tested at on"
Using annotations and driving the execution through TestNG frameworks (via Jenkins) would be one way of splitting a large suite into sections - merging the results would also be less of a pain if the annotation management divides your tests by logical groups (hope this helps)


text:
Q: What are all the way that you try to make your code functional like? so that you can make your program concurrent easily in the future.

A: I focus on making items Immutable.  Immutable objects allow you to reason about multi-threaded code a lot easier than "thread safe" objects.  The object has one visible state that can be passed between threads without any synchronization.  It takes the thought out of multi-threaded programming.
If you're interested, I've published a lot of my work with immutable objects, in particular immutable collections on code gallery.  The name of the project is RantPack.  In the collection area I have

*

*ImmutableCollection<T>

*ImmutableMap<TKey,TValue>

*ImmutableAvlTree<T>

*ImmutableLinkedList<T>

*ImmutableArray<T>

*ImmutableStack<T>

*ImmutableQueue<T>

There is an additional shim layer which (CollectionUtility) which will produce wrapper objects that implement BCL interfaces such as IList<T> and ICollection<T>.  They can't fully implement the interfaces since they are immutable but all possible methods are implemented.
The source code (C#) including the unit testing is also available on the site.

A: I program mainly in Java. I'm waiting patiently for the day where closures will be added to the language. But as I am still stuck on Java 1.4.2, even if they get added, that's not going to be for me for a long time !
That said, my main "functional" way of programming is making a lot of use of the "final" keyword. I try to have as many classes as possible completely immutable, and for the rest to have a clear distinction between what's transient and what's immutable.

A: Don't use member variables or global variables. Use the local stack of functions/methods. When a method uses only internally scoped variables and call parameters and returns all information using out/inout/reference parameters or return values, it is functional.

A: Make everything asynchronic.
Use immutable objects, messages, etc.
Communicate via queues.

A: Here's a talk on rubyconf 2008 about the subject, it's mostly ruby centered, but several concepts remain valid.
http://rubyconf2008.confreaks.com/better-ruby-through-functional-programming-2.html


text:
Q: What is the best way to execute a function after TWO or more async functions finish in React? I have two functions that run asynchronously getting data from the API. Both of them are called from their own useEffect().
I have a third function that needs to run once those two functions have been fully completed.
How can this be accomplished?
Edit:
Both of the async functions look like this:
   useEffect(() => {
    fetchBudgetBucketsData();
  }, [fiscalYear]);

  useEffect(() => {
    fetchBudgetBucketsData();
  }, [fiscalYear]);

 const fetchBudgetsData = async () => {
    setIsFetchingBudgets(true);
    const res = await getBudgets(orgID, `${parseInt(fiscalYear)}`, '', budgetType);
    setIsFetchingBudgets(false);
    if (isErrorResponse(res)) {
      console.warn(res.details);
      message.error(res.displayText);
      return;
    }
    setBudgets(res.budgets);
  };

 const fetchBudgetBucketsData = async () => {
    setIsLoadingBudgetBuckets(true);
    if (orgID === undefined) {
      return;
    }

    const res = await getBudgetBuckets(orgID, fiscalYear);
    setIsLoadingBudgetBuckets(false);
    if (isErrorResponse(res)) {
      console.warn(res.details);
      message.error(res.displayText);
      return;
    }
    setBudgetBuckets(res.buckets);
  };

Whenever the budget data or bucket data is updated, I want to call another function that checks for errors. However when the page loads, I need it to wait for both of those functions to be finished before it checks for errors.
Edit #2:
After some debugging, it looks like the issue might have to do with when React updates the state. Since I am trying to check for errors in data saved in the state.

A: One way could be chaining Promises.
Promise.all([ApiCall1, ApiCall2])
// At this point two promises above will be resolved
.then(() => ApiCall3)

Read more

A: I discovered the issue was caused by how React chooses when to update the state and not how I was calling these functions asynchronously.
I was able to call my Error check function by hooking it into the output of the data fetch calls. This makes sure that the error check only runs when either the budgets or buckets are edited and finished being changed.
useEffect(() => {
    getWarningsAndErrors();
  }, [budgets, budgetBuckets]) //Update errors whenever we edit budgets or buckets


text:
Q: jcrop suddenly jumps in the page here is my page:
http://anashimyafim.co.il/join
you can click on the green button below,
you will be slided to another div,
where you should upload an image.
than after the image is uploaded I place it in the page,
and call the jcrop function.
than if I click on the image to crop it,
the divs are suddenly moving.
do you have any suggestions??


text:
Q: Creating UIAlertView with multiple images and text I want to create a UIAlertView with multiple images hoe can i do so.
I am attaching a sample image for my requirement.
Can someone give directions to implement this.
 I can design a simple Alertview controller with a image but don't have idea about multiple images

A: You could create a custom view with your images which looks like a UIAlertView, or use one of the custom alerts from the wonderful iOS Github community.

*

*Custom iOS AlertView

*DTAlertView

A: You can subclass the UIAlertView to make it support images array.
Then in the -drawRect method, you customize the generation for the alert with the images from the array.

A: Try this.
ARAlertController
Hope it helps.


text:
Q: R Plotly: Sort x-axis by categorical variable for scatter plot I want to manually sort the x-axis for an R plotly scatterplot using crosstalk to filter by a code name (Code) but my x-axis is a time-series categorical variable (Time; i.e. Jan-Feb 2019, Mar-Apr 2019). By default, R sorts the x-axis alphabetically, which put my x-axis out of order and the points are jumbled (i.e. the first point connects to the last point which then connects to the fourth point...)
I tried converting Time to a factor and manually setting the order, but the points on the graph are still jumbled
Any help is much appreciated!
#Create dataset
df <- data.frame(
  "Code" = c("A","A","A","A","A","B","B","B","B","B"),
  "Time" = c("2016-2018","Jan-Feb 2019","Mar-Apr 2019","May-Jun 2019","Jul-Aug 2019", "2016-2018","Jan-Feb 2019","Mar-Apr 2019","May-Jun 2019","Jul-Aug 2019"),
  "Rate" = c(40.8, 50.8, 15.3, 39, 40.1, 70.2, 38.3, 25.2, 46.7, 41.9)
)

#Create filter
filter <- SharedData$new(df)
filter_select("Code", "Select Provider", filter, ~Code, multiple = FALSE)

#Graph
filter %>%
  plot_ly(
    x = ~`Time`,
    y = ~`Rate`,
    type = "scatter",
    mode="lines+markers"
  )

#ATTEMPT 1: Convert Time to factor, rerun filter, then graph
df$Time <- factor(df$Time, levels = c("2016-2018", "Jan-Feb 2019", "Mar-Apr 2019", "May-Jun 2019", "Jul-Aug 2019"))

filter <- SharedData$new(df)
filter_select("Code", "Select Provider", filter, ~Code, multiple = FALSE)

plot_ly(df,
  x = ~`Time`,
  y = ~`Rate`,
  type = "scatter",
  mode="lines+markers"
)

A: If you call plot_ly on the SharedData object rather than the original dataframe, you can use the filter_select option to show Code A and B in the correct order:
bscols(filter_select("Code", "Select Provider", filter, ~Code, multiple = FALSE),
        plot_ly(filter,
                         x = ~`Time`,
                        y = ~`Rate`,
                      type = "scatter",
                      mode="lines+markers"
              ))

A: Your problem is that your Time column is already a factor. If you set stringsAsFactors = FALSE when setting up the data frame, your code will work.
I would also add a color option in plotly.
df <- data.frame(
  "Code" = c("A","A","A","A","A","B","B","B","B","B"),
  "Time" = c("2016-2018","Jan-Feb 2019","Mar-Apr 2019","May-Jun 2019","Jul-Aug 2019", "2016-2018","Jan-Feb 2019","Mar-Apr 2019","May-Jun 2019","Jul-Aug 2019"),
  "Rate" = c(40.8, 50.8, 15.3, 39, 40.1, 70.2, 38.3, 25.2, 46.7, 41.9),
  stringsAsFactors = FALSE
)
df$Time <- factor(df$Time, levels = c("2016-2018", "Jan-Feb 2019", "Mar-Apr 2019",
                                      "May-Jun 2019", "Jul-Aug 2019"))
#Create filter
filter <- SharedData$new(df)
filter_select("Code", "Select Provider", filter, ~Code, multiple = FALSE)

#Graph
filter %>%
  plot_ly(
    x = ~`Time`,
    y = ~`Rate`,
    color = ~`Code`,
    type = "scatter",
    mode="lines+markers"
  )


text:
Q: this is a program i made for adding binary leet code is showing an error that is runtime error:heap-use-after-free on adress class Solution {
public:
    void rev(string &str)
    {
        char temp;
        for(int i=0;i<(str.length()/2);i++)
        {
            temp=str[i];
            str[i]=str[str.length()-1-i];
            str[str.length()-1-i]=temp;
        }
    }
    string addBinary(string a, string b) {
        int len1=a.length(),len2=b.length(),carry=0;
        string res="";

        string::iterator front_a;
        front_a=a.begin();
        string::iterator front_b;
        front_b=b.begin();

        if(len1==len2)
        {

        }
        else if(len1>len2)
        {
            for(int k=0;k<(len1-len2);k++)
            {
                b.insert(front_b,'0');
            }
        }
        else
        {
            for(int k=0;k<(len2-len1);k++)
            {
                a.insert(front_a,'0');
            }
        }
        len1=a.length();
        len2=b.length();
        cout<<a<<endl<<b<<endl;
        for(int i=len1-1;i>=0;i--)
        {
            if(a[i]=='0'&&b[i]=='0')
            {
                if(carry==1)
                {
                    res.push_back('1');
                    carry=0;
                }
                else
                {
                    res.push_back('0');
                }
            }
            else if((a[i]=='1'&&b[i]=='0')||(a[i]=='0'&&b[i]=='1'))
            {
                if(carry==1)
                {
                    res.push_back('0');
                    carry=1;
                }
                else
                {
                    res.push_back('1');
                }
            }
            else
            {
                if(carry==1)
                {
                    res.push_back('1');
                    carry=1;
                }
                else
                {
                    res.push_back('0');
                }
                carry=1;
            }
        }
        rev(res);
        string::iterator front;
        front=res.begin();
        if(carry==1)
        {
            res.insert(front,'1');
        }
        return res;
    }
};

"10100000101000001010000010100000101000001010000010100000"
"1101010010111010100000101000001010000010100000101000001010000010100000"
this is the test case which is causing an issue small inputs are leading to correct answer where as large input is causing runtime error

A: Insertion may invalidate iterators, the reason being that a new backing array may be allocated. You cannot just assume the old iterator remains valid the way you do e.g. here:
for(int k=0;k<(len1-len2);k++)
{
    b.insert(front_b,'0');
}

the code snippet should be changed to
for(int k=0;k<(len1-len2);k++)
{
    b.insert(b.begin(), '0');
}

or better
// casting unnecessary, if you use size_t or auto when declaring len1 and len2
b.insert(0, static_cast<size_t>(len1-len2), '0');

Note: there are 3 more places in your where you made this mistake.


text:
Q: Simple Math - Calculate percentage from offseted range Say you have scenario where you need to get percent value from range like 10-20. I.e. at 10 the value is 0.0 at 20 it is 1.0. I need this for a very simple algorithm. I can use clamping to get around this, but I was wondering if there is some nice and clean way to do this with simple math?
I can't change the start and end value, because they are indexes in For loop, so i need to get result of 0 all the time when index is 0-10 and from 10-20 it should be 0.0-1.0.

A: For startrange <= value <= endrange the formula is:
double fraction = (value-startrange)/(endrange-startrange)

Otherwise fraction = 0 or 1, depending if value < startrange  or value > endrange

A: It's a simple linear interpolation problem between 10 and 20 like this (I assume you are using C-like language):
for (int i=0; i<=20; i++)
{
    if(i>=10 && i<=20)
    {
         Result = 0.1*(i-10);
    }
    else
    {
        Result = 0.0;
    }
}

I hope it helps.


text:
Q: Programming syntax questionin usage of CNTKLibrary from C++ This is just a C++ programming syntax question (I think).  I have 192 floats in a structure like:
std::vector outputData(192);
I want to call the built-in Softmax function in the CNTKLibrary on this 192x1 vector -- the documentation in the header file is:
/// Create an instance of the CNTK built-in softmax operation on specified tensor input operand
CNTK_API FunctionPtr Softmax(const Variable& operand, const std::wstring& name = L"");
How do I do that?  I guess first I get the function pointer, and then I apply it, but I don't understand what the syntax would be.  Something like this...
// Grab Softmax Function pointer
FunctionPtr SoftmaxFuncPtr = Softmax(outputData);   // how to cast arg?
// How to evaluate this FuntionPtr?
SoftmaxFuncPtr->eval();                  // WAG - I have no idea...
Where does result of computation go?
Thanks if you can give me some hints...

A: First you need to define a Variable for the input of Softmax, something like:
auto inputVar = InputVariable(DimensionsOfInput, DataType::Float, L"InputSoftMax");

Then, you build a Composite Function using Softmax, like
FunctionPtr SoftmaxFuncPtr = Softmax(inputVar, L"SoftMax");
auto EvalFuncPtr = AsComposite(SoftmaxFuncPtr, L"EvalSoftMax");

After that , construct input and output map to prepare data for evaluation and then call Forward() or Evaluate() to execute evaluation on the input data and get output result.
The sample MultiThreadsEvaluationWithNewFunction() in EvalMultithreads.cpp showcases how to create a new function for evaluation. The page describes how to use these samples. The function there contains multiple layers and supports evaluation using multi-threads, so it might have some code which is not required for your case. And the sample is still using low-level APIs to manipulate input and output data, and we have also high-level convenient methods, like Value::CreateBatch/Sequence/BatchOfSequence(), Value::CopyVariableValueTo() to help you prepare input/output data without knowing low-level details. The CNTKLibrary.h has description of these APIS too.
Please let us know any questions you have.
Thanks,


text:
Q: $\forall x,y>0, x^x+y^y \geq x^y + y^x$
Prove that $\forall x,y>0, x^x+y^y \geq x^y + y^x$

A friend of mine told me none of the teachers in my school have succeeded in proving this seemingly simple inequality (it was asked at an oral exam last year). I tried it myself, but I made no significant progress.

A: Since the statement is symmetric in $x$ and $y$, it suffices to show: for fixed $y>0$, the quantity $x^x+y^y-x^y-y^x$ is nonnegative for $x\ge y$. And since this quantity vanishes at $x=y$, it suffices to show that it is increasing for $x\ge y$. But its derivative (with respect to $x$) is
$$
x^x \log x + x^x - yx^{y-1} - y^x\log y = (x^x \log x - y^x \log y) + (x^x - yx^{y-1});
$$
it now suffices to show that both quantities in parentheses are positive for $x\ge y>0$.
But for fixed $x>0$, the functions $t^x\log t$ and $tx^{t-1}$ are both increasing functions of the positive variable $t$: the derivative of the first function is $t^{x-1}+t^x\log^2t$ which is clearly positive; while the derivative of the second function is $x^{t-1}+tx^{t-1}\log t$, which is positive because $t\log t \ge -e^{-1} > -1$ for all $t$. In particular, their values at $t=x$ exceed their values at $t=y$, which confirms that both quantities are positive.
EDIT: Somehow I got both these last derivatives wrong, as LeGrandDODOM pointed out. The actual derivatives of $t^x\log t$ and $tx^{t-1}$ are, respectively, $t^{x-1}(x\log t+1)$ and $x^{t-1}(t\log x+1)$, neither of which is forced to be positive. I'm making this answer community wiki in case others can see how to rescue the idea.

A: WLOG, let $x \ge y$.
Case 1: Let $x \ge 1$, then for $t > 0$, $x^t \log x \ge y^t \log y$
$$\implies \int_y^x \left(x^t \log x - y^t \log y \right)dt \ge 0 \implies (x^x - x^y) - (y^x-y^y) \ge  0$$
Added
Case 2: For $x< 1$ - let $r = \dfrac{x}y\ge 1$. Then the inequality is:
$$\frac{y^x}{x^y+y^x}r^x+\frac{x^y}{x^y+y^x}\frac1{r^y} \ge 1$$
Using weighted AM-GM, this reduces to showing:
$$xy^x \ge yx^y \iff \frac{\log x}{1-x} \ge \frac{\log y}{1-y}$$
which is obvious.


text:
Q: Faceted Search Implementation using Hibernate Search + Spring MVC I am looking for suggestions and working sample for implementing Faceted Search using Spring MVC and Hibernate Search.

A: What exactly are you looking for? The Hibernate Search documentation contains examples for the faceting API and there also some tests in the Hibernate Search source code which show how to use the API. If faceting is enabled during a search you can get a list of facets via:
List<Facet> facets = facetManager.getFacets( "myFacet" );

Stick this list into a scope which is available during the rendering phase and you should be able to iterate over the facets and build the page to your liking.


text:
Q: What is this: $('') In a tutorial I came across this jQuery:
var encodedName = $('
').text(name).html();

I havent seen the '
' before. Doesnt look like a CSS selector. Any ideas?

A: I slightly differs if you say, selector.
That is Jquery Html attribute

If a string is passed as the parameter to $(), jQuery examines the string to see if it looks like HTML (i.e., it starts with <tag ... >). If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an HTML snippet, jQuery attempts to create new DOM elements as described by the HTML.

Ex
$( "
My new text
" ).appendTo( "body" );

A: This simply isn't a selector at all but some HTML
var encodedName = $('
').text(name).html();

is equivalent to
var encodedName = $('

').text(name).html();

or
var encodedName = $('
').text(name).html(); // HTML fragments are automatically closed

It builds a jQuery element from some HTML, gives it some text, and then gets the innerHTML.
The purpose of this code is obviously to encode a string as HTML. For example
console.log($('
').text("3 < 4").html());

logs
"3 < 4"

A: This construction creates new jQuery object which contains one div element. It can be slightly shorter though: $("
")

A:
 is an empty div element. With $('
') you create an empty div element as jquery object (not yet in the DOM / on the page) which you can then manipulate and later insert into your page if you wish.

A: The output of a $(...) jQuery selector is always a reference to a Document element (or a zero length collection). In order for that to be true. It will construct DOM elements in memory to satisfy this requirement.
So $('
') returns a reference to jQuery where a DIV element has been selected, but is not in the DOM. jQuery has created it in memory only.
You can then append this to the current document, like so;
$('
').appendTo('body');

You can also perform selection on the returned object, like so;
$('

').find('.stuff').html("something else");


text:
Q: Azure Synapse Analytics - CI/CD workspace and infrastructure - Design question I have an Azure Repos project with IaC code and ci/cd yaml pipelines to set up Azure Synapse infrastructure. Can you recommend what is right approach when I integrate the workspace to connect to git? Should I create a new project in Azure Repos for the Synapse artifacts or should I use the same repository as the infrastructure project?
I will be setting up ci/cd pipelines to deploy the azure synapse artifacts as well.
Thanks!

A: Here's an answer to a similar question I posted:

You'll want to follow Microsoft's guide on CI/CD with Synapse. This is a great walkthrough video for the process.

Work in your development environment and commit to your collaboration branch.
A pipeline triggers off of your workspace_publish branch, releasing your code to your next environment (preferably with an approval gate)
Continue releasing the same code to higher environments, again with approval gates.
For Azure DevOps, you can use variable groups to parameterize your pipeline. Also make sure to read through the custom parameters section on that link to parameterize parts of the template that are not parameterized by default.


text:
Q: Banach algebra definition Definition: A Banach algebra $A$ is a triple $(A, \Vert \cdot \Vert, m)$ where $\Vert \cdot\Vert$ is a norm on $A$ and $m: A \times A \to A$ is a $\mathbb{C}$-bilinear associative map such that $(A, \Vert\cdot \Vert)$ is a Banach space and such that $(A,m)$ is a $\mathbb{C}$-algebra, such that
$$\Vert xy \Vert = \Vert m(x,y)\Vert \leq \Vert x \Vert \Vert y\Vert$$
for all $x,y \in A$.
My notes say: Assume $A$ is unital with identity $1_A$. Changing to an equivalent norm, we may assume that $\Vert 1_A \Vert=1$.
How exactly is this done? If $(A, \Vert \cdot \Vert)$ is a Banach algebra, then I can define a new norm
$$p: A  \to [0, \infty[: a \mapsto \Vert a\Vert/\Vert 1_A\Vert $$
and I see $p$ and $\Vert \cdot \Vert$ are equivalent norms but $(A, p)$ does not satisfy $p(x,y) \leq p(x) p(y)$ so it can't give a Banach algebra.
Any insight is appreciated!

A: For $a \in A$ define $L_a: A \to A$ by $L_a(x):= ax.$ Then $L_a$ is linear and, since $||L_a(x)||=||ax|| \le ||a|| \cdot ||x||$, $L_a$ is bounded. Now put
$$|||a|||:= ||L_a||.$$
It is your job to show that $||| \cdot|||$ is a norm with the required properties.


text:
Q: How to get 24 hours before records from mongodb with python.? I have a requirement to delete records from my mongodb collection 24 hours before from present time.i have records like
{
"_id" : ObjectId("53993f67ccbc960c7d05b74d"),
"userName" : "krishna",
"countryCode" : "91",
"countryName" : "India",
"mobileNumber" : "99143xxxxx",
"name" : "Krishna",
"password" : "aXRvbkAxMjM=",
"registeredOn" : ISODate("2014-06-12T05:49:27.970Z"),

}
{
"_id" : ObjectId("53993f67ccbc960c7d05b74e"),
"userName" : "mulagala",
"countryCode" : "91",
"countryName" : "India",
"mobileNumber" : "99122xxxxx",
"name" : "Krishna",
"password" : "aXRvbkAxMjM=",
"registeredOn" : ISODate("2014-06-16T05:49:27.970Z"),

}

Now i want to remove a record that is registered 24 hours before from present time.How to delete it from python.Thanks in advance!

A: Well you can approach this with a query and run it periodically:
collection.remove({
    'registeredOn': { '$lte': datetime.now() - timedelta( hours=24 ) }
})

Or you could look at TTL Indexes. The mongodb server periodically checks these every few minutes without coding anything additional:
db.collection.ensureIndex( { "registeredOn": 1 }, { expireAfterSeconds: 86400 } )

So if you can make that work for you and you do not need any manual control it is probably a good approach for your application.


text:
Q: Angular and overlay - switch ON | OFF I'm actually on a 1.2.16 Angular Project.
I want to create an overlay, which turns on and off with a button.
Naturally, this button should not be in the overlay since it must remain available to disable the overlay.
What is the best way to achieve this? A feature of Angular, or just using a standard CSS / JS?
Thank you for your ideas

A: Just look at this example:

  <button type="button" ng-click="vm.showOverlay = true">Open Overlay</button>

Then you can style your overlay using standard CSS, e.g. position: fixed; etc.
Also, look at ngDialog module, it will provide you with ready-made overlay windows.


text:
Q: how to install AMD Catalyst or AMD Graphic Drivers and other drivers in Ubuntu 13.04 I recently purchased an HP laptop (Intel-AMD Hybrid). I successfully installed Ubuntu 13.04 on it.
But my battery is draining quite quickly. It hardly works for 30-50 minutes. I guess it might be due to the graphics driver.
Could anyone please suggest how to install below, recommended settings to increase battery life and performance of my laptop:
1. AMD Driver / AMD Catalyst for AMD HD Raedon 5400
2. Synaptics Touch pad driver
3. IDT High Definition Audio Driver

A: check: Is my ATI graphics card supported in Ubuntu?
or http://wiki.cchtml.com/index.php/Main_Page


text:
Q: How to make a projectile turn with a arc I have a cannon that fires a bullet in a parabolic arc. Right now when I fire the bullet stays in the same rotation as it was when it fired out of the cannon.

How do I make it so the bullet's rotation follows the arc as it travels through the air?
I tried the following as a script running on  the bullet
Exhibit 1
public class PointingBehaviour:MonoBehaviour
{
    private Rigidbody rb;

    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    public void Update()
    {
        transform.up = rb.velocity;
    }
}

And that works fairly well. but I see a slight flicker on the first frame the object exists (I think this is because the velocity is still 0 at this point) and the object spins uncontrollably once it hits the ground.

I got it to stop flickering at the start and stop spinning when it lands by doing the following
public class BulletController : MonoBehaviour
{
    private Rigidbody _rb;
    private bool _followArc;
    private bool _firstFrame;
    private void Start()
    {
        _rb = GetComponent<Rigidbody>();
        _firstFrame = true;
        _followArc = true;
    }

    public void LateUpdate()
    {
        if (_followArc && !_firstFrame)
            transform.up = _rb.velocity;
        _firstFrame = false;
    }

    public void OnCollisionEnter(Collision collision)
    {
        _followArc = false;
    }
}

But if I happen to bump something in the air it stops following the arc and just does a free tumble till it lands. What is the "Correct" way to do what I want to do?

Because people wanted to see it, here is the code for spawning the bullet.
public class TankController : MonoBehaviour
{

    private Transform _barrelPivot;
    private Transform _bulletSpawn;
    public GameObject Bullet;
    public float FirePower;
    public float RotationSpeed;
    public float TiltSpeed;

    private void Start()
    {
        _barrelPivot = GetComponentsInChildren<Transform>().First(x => x.CompareTag("BarrelPivotPoint"));
        _bulletSpawn = GetComponentsInChildren<Transform>().First(x => x.CompareTag("BulletSpawn"));
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            FireCannon();
        }
        //(SNIP) Handle turning left and right and pivoting up and down.
    }

    private void FireCannon()
    {
        var newBullet = SpawnBullet();
        var rb = newBullet.GetComponent<Rigidbody>();
        rb.AddForce(_bulletSpawn.up * FirePower, ForceMode.Impulse);
    }

    private GameObject SpawnBullet()
    {
        var newBullet = (GameObject) Instantiate(Bullet, _bulletSpawn.position, _bulletSpawn.rotation);
        newBullet.transform.localScale = Bullet.transform.localScale;
        return newBullet;
    }
}

A: I believe what you're saying is - your're script exhibit1 works great.
If you think about it, all you have to do is turn off that behavior, when you want to.
In this case, you're thinking "that behavior should stop when it hits the ground .. I assume that's what you mean physically.
It's very easy to turn off a MonoBehaviour, as you know just enabled = false;
So, you have some script somewhere like Bullet or perhaps BulletBoss
In there you'll have a variable private PointingBehaviour pb and you'll just pb.enabled = false
(I can't tell you "when" you want to do that, it depends on your game .. so it might be something like "when altitude is less than blah" or "when I hit something" ... probably OnCollisionEnter related.)
Note that - I'm sure you know this - for pointing behavior for a projectile, just setting it along the tangent is pretty basic.
A lovely very easy thing to do when you're writing a pointing behavior for a projectile like that, try lerping it gently to the tangent. The result is amazing real looking. Next perhaps add some random "wiggles" which is very bomb-like.  It's amazing how the user can see such things, only only a few frames. (The next step up would be real air physics I guess!)
Note that, certainly, PointingBehaviour should just be its own script.  You must keep behaviors totally isolated.

Regarding LateUpdate mentioned, there is never a need to use it.
Unity offer a "script order execution" system (see Preferences menu option), if one truly wants to order within the frame. But about the only reason to do that would be perhaps for some experimentation reason.
It's rather like "using a global" - there's just no reason for it. As with any code, if you have to do something in a given order, just call in order.


text:
Q: File import issue - python Django I have a file in my management/commands folder and I am trying to import my models into the report.py folder. However, I get the following error.
Traceback (most recent call last):
  File "c:\Users\Timmeh\source\Python\Django Projects\env\topxgym\members\management\commands\report.py", line 2, in <module>
    from members.models import ActiveMember
ModuleNotFoundError: No module named 'members'

I have a active.py file in that same folder with the same import and it works. However, the active.py is run from python manage.py active. The report.py I am just compiling/running it (not running it from python manage.py). That is the only difference.
the file structure.

A: Please don't forget to add __init__.py for every folder.
More here:
https://docs.python.org/3/reference/import.html#regular-packages
Try to made relative import.
from ..models import ActiveMember

if it works, this answer can help:
Absolute imports in python not working, relative imports work
Try to check your project settings.
Have you add yors members app in settings.INSTALLED_APPS list?

A: Here is a dirty hack which should solve the issue.
and I'll also point out an alternate one if that suits your use case.
First Option
import sys
sys.path.append(r'c:\Users\Timmeh\source\Python\Django Projects\env\topxgym')

# now your import should work
from members.models import ActiveMember

This is dirty because it manipulates sys path which is not a good practice. I'm assuming this script is just a standalone script you wish to run, hence it should not be an issue overall.
Second Option
IFF this is a possibility, you could just move your report.py and keep it inside topxgym folder (at the same level as requirements.txt)
In that case too, the same import statement would work.
side note
If you're looking to access the ORM from a standalone script, it looks like you might be missing to add the django configuration in the script as recommended by the documentation.
After your import issues are fixed by either of the above two methods, if it works, great. If it doesn't it would mean that you have to add the django.setup() config and specify a settings file.


text:
Q: yup array not inferring type I have a yup schema defined as:
const createSchema = (items) => yup.object({
  items: yup
    .array()
    .of(
      yup.object({
        id: yup.string(),
        value: yup.boolean(),
      }),
    )
    .default(
      items?.map(item =>
        ({
          id: item.id,
          value: true,
        } ?? []),
      ),
    )
  });

const scema = createSchema([...]);

There are 2 issues. Using
export type Schema = InferType<ReturnType<typeof createSchema>>;

and react-hooks-form with yupResolver to construct the form
const form = useForm({
  resolver: yupResolver(schema),
  defaultValues: schema.getDefault(),
});

in the submit function the type for items is any. I fixed this be using  as yup.SchemaOf<Item[]> after the default and this will work but the type will potentially be undefined, even though I will always have an array because of the  ?? []. I tried using .ensure() but this didn't do anything.
Is there a better way to properly define the array of types?


text:
Q: Placing text before every a href appearance? I am currently trying to place something like this https://shortdomain.com/api?p=a-href-url-here.com before every link on my website in a specific div.
$main = get_the_content_with_formatting();
$stripped = str_replace('<a href="http://example.net/', ' div.post-inner > div.entry > p > strong > a

A: This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '

link

';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
    $a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();

Output:

    link

Demo on 3v4l.org

A: Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "

Here is some sample text.

";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
    $href = $anchor->getAttribute("href");
    if ($href) {
        $anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
    }
}
echo $dom->saveHTML();

A: If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:

let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)
Don't change

      change these:

        some inside

         some other inside

A: You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href=\"http://example.net/\"]")
    .attr("href", "https://shortdomain.com/api?p=http://example.net/");

I didn't really test it, but it should work just fine.

A: Get rid of the dummy website then.

$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);


text:
Q: How to format number 300 to 3.0 in php I have a MySQL table which contains whole number.
Units
300,
900,
600,
125,
225,

I want it to display using PHP like thus
Units
3.0,
9.0,
6.0,
1.25,
2.25,

I have tried using number_format but doesn't do the trick.

A: This is basic math:
echo $num * .01;

If you always want two decimal points:
echo number_format($num * .01, 2, '.', '');

If you want one decimal for x00 numbers just use make the third parameter a variable that is either 1 or 2 based on the last two digits of the original number or use the modulus operator to determine if the number is divisible by 100.
$round = ($num % 100) ? 2 : 1;
echo number_format($num * .01, $round, '.', '');