text:
Q: "Unauthorized" - While making a call to SOAP api C# While using the below code to make a call to the SOAP, I am getting the "Unauthorized" as a response.
NetworkCredential credentials = new NetworkCredential("username", "password");
var request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = credentials;

   try
   {
       WebResponse response = request.GetResponse();
       using(Stream responseStream = response.GetResponseStream())
       {
            StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
            return reader.ReadToEnd();
       }
   }
   catch(WebException Ex)
   {
        WebResponse errorResponse = Ex.Response;
        using(Stream responseStream = errorResponse.GetResponseStream())
        {
            StreamReader reader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
            string errorText = reader.ReadToEnd();
        }
        throw;
    }

Can you please correct me where I am wrong?
I am getting the error :- "The remote server returned an error: (401) Unauthorized."

A: This should work
             HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest;
            string authInfo = "username" + ":" + "Password";
            authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));

            request.Headers[HttpRequestHeader.Authorization] = "Basic " + authInfo;
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

           using (var responseStream = response.GetResponseStream())
            {
               StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
        return reader.ReadToEnd();
            }

A: This is not an error. It is a warning about your credential. You should send legal user credential to get a response to your end-point. Please check-out this;
NetworkCredential credentials = new NetworkCredential{
Username=//fill your username,
Password=//fill your password but be carefull, is it hashed or not?
};
var request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = credentials;

   try
   {
       WebResponse response = request.GetResponse();
       using(Stream responseStream = response.GetResponseStream())
       {
            StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
            return reader.ReadToEnd();
       }
   }
   catch(WebException Ex)
   {
        WebResponse errorResponse = Ex.Response;
        using(Stream responseStream = errorResponse.GetResponseStream())
        {
            StreamReader reader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
            string errorText = reader.ReadToEnd();
        }
        throw;
    }


text:
Q: RecyclerView внутри NestedScrollView Сделал горизонтальный RecyclerView внутри NestedScrollView. В итоге при запуске активности если RecyclerView не торчит на определенную высоту, то он сам делает чтобы торчал и скроллит NestedScrollView. Очень непонятное поведение, не смог найти ничего.
Вот так, когда описания мало (торчит на определенную высоту)

И вот так, когда описания много (он сам скроллит, чтобы эта высота торчала)

Код. Xml
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:fitsSystemWindows="false">

<android.support.design.widget.AppBarLayout
    android:id="@+id/main_appbar"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:fitsSystemWindows="false">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/main_collapsing"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:fitsSystemWindows="true"
        app:titleEnabled="false"
        app:contentScrim="@color/toolbar_bg">

        <ImageView
            android:id="@+id/mainbackdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="parallax"/>

        <View
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="@drawable/scrim_top"
            app:layout_collapseMode="pin"/>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_collapseMode="pin">

            <TextView
                android:id="@+id/info_title"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:layout_width="wrap_content"
                android:textColor="#ffffff"
                android:textStyle="bold"
                android:textSize="19sp"/>

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:id="@+id/nsv"
    android:fillViewport="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <include layout="@layout/info_text"/>

</android.support.v4.widget.NestedScrollView>

<ImageView
    android:id="@+id/info_iv"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:scaleType="centerCrop"
    android:background="#cccccc"
    android:layout_marginRight="20dp"
    app:layout_anchor="@id/main_appbar"
    app:layout_anchorGravity="bottom|right|end"/>

</android.support.design.widget.CoordinatorLayout>

@layout/info_text:

<android.support.v7.widget.CardView
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:foreground="?android:attr/selectableItemBackground"
    android:layout_height="wrap_content"
    android:clickable="true"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="5dp"
    card_view:cardElevation="5dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginTop="16dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="15dp"
        android:paddingRight="15dp"
        android:orientation="vertical">

        <TextView
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_width="wrap_content"
            android:text="ОПИСАНИЕ"
            style="@style/InfoTitle"
            android:paddingBottom="25dp"
            android:paddingTop="25dp"/>

        <TextView
            android:id="@+id/info_description"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="match_parent"
            android:textColor="#000000"
            android:paddingBottom="25dp"/>

    </LinearLayout>

</android.support.v7.widget.CardView>

<TextView
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:layout_width="wrap_content"
    android:text="СКРИНШОТЫ"
    style="@style/InfoTitle"
    android:layout_marginLeft="32dp"
    android:layout_marginTop="21dp"/>

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:id="@+id/info_screens"
    android:overScrollMode="never"
    android:layout_marginTop="20dp"
    android:background="#9E413B"/>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="20dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Качество:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_quality"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Год выхода:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_year"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Перевод:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_translation"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Длительность:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_duration"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Страна:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_country"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Жанр:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_genre"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="В ролях:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_cast"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_marginTop="5dp">

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:textStyle="bold"
        android:text="Режиссер:"/>

    <TextView
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_marginLeft="3dp"
        android:id="@+id/info_producer"
        android:textColor="#000000"/>

</LinearLayout>

<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:layout_marginTop="20dp">

    <android.support.v7.widget.AppCompatButton
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:text="СМОТРЕТЬ"
        app:backgroundTint="@color/toolbar_bg"
        android:textColor="#ffffff"
        android:layout_weight="1.0"
        android:layout_marginRight="10dp"
        android:minHeight="70dp"
        android:maxHeight="70dp"
        android:id="@+id/info_view"/>

    <android.support.v7.widget.AppCompatButton
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:textColor="#ffffff"
        app:backgroundTint="@color/toolbar_bg"
        android:text="СКАЧАТЬ"
        android:layout_alignParentRight="true"
        android:layout_weight="1.0"
        android:layout_marginLeft="10dp"
        android:minHeight="70dp"
        android:maxHeight="70dp"
        android:id="@+id/info_download"/>

</LinearLayout>

Java
((NestedScrollView)(findViewById(R.id.nsv))).scrollTo(0,0); .//не катит
    scr = (RecyclerView)findViewById(R.id.info_screens);
    scr.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, false));
    scr.setNestedScrollingEnabled(false);

A: Нашел. Нужно добавить
android:focusableInTouchMode="true"

В ребенка NestedScrollView. Оригинал ответа с enSO

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android 5.1.1 lollipop return null file path if image chosen from gallery Android 5.1.1 lollipop return null file path if image chosen from gallery. The below code works fine in all the devices below 5.1.1, but doesn't work in lollipop 5.1.1
Uri contentUri = data.getData();
Cursor cursor = null;
    try {
        String[] proj = {MediaStore.Images.Media.DATA};
        cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

cursor.getString(column_index) this returns null.

A: For now I have ended up with this for getting an image from gallery. I've tested it on 4.4, 5.0.1 and 5.1.1 but it should work on previous versions too (with new and old Google photo app), should be less hacky and doesn't require a check on Android version.
public static Uri handleImageUri(Uri uri) {
    if (uri.getPath().contains("content")) {
        Pattern pattern = Pattern.compile("(content://media/.*\\d)");
        Matcher matcher = pattern.matcher(uri.getPath());
        if (matcher.find())
            return Uri.parse(matcher.group(1));
        else
            throw new IllegalArgumentException("Cannot handle this URI");
    }
    return uri;
}

And with this I used the same code I have ever used before for getting the image path:
public static String getRealPathFromURI(Context context, Uri uri) {
    Cursor cursor = null;
    try {
        Uri newUri = handleImageUri(uri);
        String[] proj = { MediaStore.Images.Media.DATA };
        cursor = context.getContentResolver().query(newUri,  proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } catch (Exception e){
        return null;
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
}

A: For a temporary hack-around for android lollipop 5.1.1. It Works fine now. But m not satisfied with this unofficial hack.
Uri selectedImage = data.getData();
        if (Build.VERSION.SDK_INT == 22) {
            if (selectedImage != null && selectedImage.toString().length() > 0) {
                try {
                    final String extractUriFrom = selectedImage.toString();
                    String firstExtraction = extractUriFrom.contains("com.google.android.apps.photos.contentprovider") ? extractUriFrom.split("/1/")[1] : extractUriFrom;
                    firstExtraction = firstExtraction.contains("/ACTUAL") ? firstExtraction.replace("/ACTUAL", "").toString() : firstExtraction;

                    String secondExtraction = URLDecoder.decode(firstExtraction, "UTF-8");
                    selectedImage = Uri.parse(secondExtraction);
                } catch (UnsupportedEncodingException e) {

                } catch (Exception e) {

                }
            }
        }


text:
Q: Plot the indices of the background Matrix instead of the calculated values I want to create a background 60*100 matrix and insert inside it the calculated values, for example
data = {{1, 60.51}, {2, 24.5115}, {3, 9.92919}, {4, 4.02214}, {5, 1.6293}, {6, 0.66}}

The rest elements of the matrix are zeros. Then instead of plotting data I want to plot their corresponding indices in the matrix. The result should look like this:

A: array = Array[Subscript[m, ##] &, {8, 5}];
{checkmark, dot} = {"✓", "\[FilledSmallCircle]"};

labeledcells = Join[Thread[{1, Range[5]}], {{2, 1}, {8, 1}}];
markedcells = {{2, 2}, {4, 3}, {6, 5}};
dottedcells = Complement[Tuples[{Range[8], Range[5]}], labeledcells, markedcells];

array2 = ReplacePart[array, {markedcells :> checkmark, dottedcells :> dot}];

MatrixForm[array2]

ArrayPlot[array2 /. {dot -> White, checkmark -> Green, _Subscript -> Red},
 Mesh -> All, Frame -> True, FrameTicks -> Automatic,
 Epilog -> MapIndexed[Text[Style[#, 16, Black], #2 - .5] &,
   Reverse /@ Transpose @ array2, {2}]]


text:
Q: Find the orthogonal complement of a subset of $L^2$ I can't find the orthogonal of this set $C= \left\{ u \in L^2(0,2): \int_0^2 u(t)dt=1 \right\}$.

By applying the standard definition I have to find some conditions on $v(x)$ such that $\int_0^2 u(x)v(x)dx=0$ for every $u \in L^2$. I tried to write $v(x)=v(x)+1-1$ in order to use the fact that $u$ belongs to $C$, but I still can't solve the problem. For sure $v(x)=0 \in C^{\perp}$
Any hint or else would be really appreciated

A: The orthogonal is trivial.
Indeed, assume $v \in C^\perp$.
If $\int_0^2 v(t)\,dt \ne 0$, then $$\int_0^2 \frac{v(x)}{\int_0^2 v(t)\,dt}\,dx = \frac{\int_0^2 v(x)\,dx}{\int_0^2 v(t)\,dt} = 1$$
so we have $\frac{v}{\int_0^2 v(t)\,dt} \in C$. Therefore $v \perp \frac{v}{\int_0^2 v(t)\,dt}$ which implies $v \perp v$ and hence $v = 0$.
If $\int_0^2 v(t)\,dt = 0$, then for any $u \in C$ we have $$\int_0^2 (u(t) + v(t))\,dt = \int_0^2 u(t)\,dt + \int_0^2 v(t)\,dt = 1$$
so $u+v \in C$. Hence $v \perp u$ and $v \perp u+v$ imply $v \perp v$. It follows $v = 0$.


text:
Q: Trouble dealing with asynchronous non-blocking model I'm having trouble with getting around asynchronous model of node, I have this function:
function getstream() {

    console.log('calling testAvail, Avail value is:' + available);
    testAvailability();
    console.log('Available:'+available);
    if (available || SelfSharing) {

         // Do something
         setDefaults();

         return;
    }
}

Which calls testAvailability() function defined as:
function testAvailability()
{
    console.log('entered test');
    var stat;
    var socket = io.connect('http://somedomain.com');
    socket.on('error', function() {

        console.log('There was an error at server end please try again');
        // chrome.runtime.reload();

        setTimeout(chrome.runtime.reload(),3000);
        //here i change options
        //socket = io.connect(host, options);
    });
    socket.emit('available');
    socket.on('available', function (status) {
        console.log('got status from server which is:'+ status);
        available=status;
        console.log("inside the socket.on"+available);
        console.log('leaving test, do you see any got status above?');
    });
}

I want getstream() to continue from where it left after testAvailability() is done and available variable has it's value set.

A: You need to pass a callback to testAvailability and then call it inside socket's available event:
function testAvailability(callback)
{
    console.log('entered test');
    var stat;
    var socket = io.connect('http://somedomain.com');
    socket.on('error', function() {

        console.log('There was an error at server end please try again');
        // chrome.runtime.reload();

        setTimeout(chrome.runtime.reload(),3000);
        //here i change options
        //socket = io.connect(host, options);
    });
    socket.emit('available');
    socket.on('available', function (status) {
        console.log('got status from server which is:'+ status);
        available=status;
        console.log("inside the socket.on"+available);
        console.log('leaving test, do you see any got status above?');

        callback(); <-- CALL YOUR CALLBACK FUNCTION HERE
    });
}

Then change your getstream function so that it passes a callback to testAvailability and move the rest of the function inside that callback:
function getstream() {

    console.log('calling testAvail, Avail value is:' + available);
    testAvailability(function() {
        console.log('Available:'+available);
        if (available || SelfSharing) {

             // Do something
             setDefaults();
        }
    });
}

A couple of things to note:

*

*getstream is now asynchronous. If something else is waiting for it to complete, you'll need to change it so that it takes a callback function as well.

*I see that you're doing some sort of retry in socket's error event. That might be ok in this case, it depends on your app but, typically, you'll want to pass the error back as the first parameter of the callback when an error occurs.

A: Here we go:
function getstream() {

    console.log('calling testAvail, Avail value is:' + available);
    testAvailability(function(available){
        console.log('Available:'+available);
        if (available || SelfSharing) {

             // Do something
             setDefaults();

             return;
        }
    });
}

function testAvailability(callback) {
    console.log('entered test');
    var stat;
    var socket = io.connect('http://somedomain.com');
    socket.on('error', function() {

        console.log('There was an error at server end please try again');
        // chrome.runtime.reload();

        setTimeout(chrome.runtime.reload(),3000);
        //here i change options
        //socket = io.connect(host, options);

        callback(false);
    });
    socket.emit('available');
    socket.on('available', function (status) {
        console.log('got status from server which is:'+ status);
        console.log('leaving test, do you see any got status above?');
        callback(true);
    });
}


text:
Q: How to run Websphere traditional in container on non-default port? I'm running a container based on the following image:
https://hub.docker.com/r/ibmcom/websphere-traditional
Everything works fine when i use the same ports on container and host, like so:
docker run --name test -h test -p 9043:9043 -p 9443:9443 -d ibmcom/websphere-traditional:latest

but if i want to use other ports like this:
docker run --name test -h test -p 8500:9043 -p 8600:9443 -d ibmcom/websphere-traditional:latest

container runs but i cannot reach the admin console.
I'm using windows 11 as host.

A: Remapping the container ports to arbitrary host ports isn't possible due to the way WebSphere's networking works.
By default, WebSphere will send redirect responses to clients using the port it has in serverindex.xml for the server's defaulthost or defaulthost_secure endpoint. If you do any sort of port mapping (like Docker or even reverse proxying via a webserver) and WebSphere issues a redirect, the URL it redirects to will have the wrong port (the one from serverindex.xml, not the one you are using to talk through the webserver) and the redirect will fail.
To deal with this, the WebSphere container image comes configured out of the box with some properties set to cause redirects to include the port in the Host header of the request, which is the port you're actually making the request to as the client (see https://www.ibm.com/docs/en/was-nd/8.5.5?topic=configuration-web-container-custom-properties#returningtheportnumberfromtherequesthostheaderfirst).
However, once WebSphere starts trusting the Host header's port, it starts using that port to associate the incoming request with a Virtual Host Host Alias. In the container image, WebSphere's default_host has host aliases for *:9080, *:9443, *:80 and *:443, so applications mapped to the default_host can be accessed by any hostname and any of those ports, even through a webserver. Similarly, the admin_host virtual host (which the admin console is configured to use) has aliases for *:9043 and *:9060.  Other ports, however, won't have hostaliases defined for them.
You'll need to use wsadmin to configure the appropriate virtual host to have a hostalias for the specific port you want to map your container to use on the host. (this page tells how). So in your example you would have to add a new host alias to admin_host specifying * for the hostname and 8500 for the port, and a new host alias to default_host specifying * for the hostname and 8600 for the port. Note that you can't have the same host:port combination as a host alias on multiple virtual hosts.


text:
Q: JAR File Creation in JDK 11 and JavaFx As we already know up to JDK-10 JavaFX used to be a part of JDK but with the release of JDK-11, JavaFX is to be included separately .
For doing that we need  to provide VM argument for JavaFX like this:-
--module-path "C:\javafx-sdk-11.0.1\lib" --add-modules=javafx.controls,javafx.fxml

Up to this point every thing is ok but when we are finally creating a JAR file for distribution then a message is appearing like this:

VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR

Therefore now JAR file is not able to open the application.
Now please help me by suggesting some way out so that user can open application just by clicking on JAR icon as it used to be earlier.
EDIT
After applying the solution provided by
openjfx.io (section non-modular projects), I am able to generate a Standalone Jar File with JavaFX.
Now I want to add some local dependencies like pdfbox and Sqlite:
sqlite =C:\sqlite-jdbc-3.6.20.1.jar
pdfbox=C:\pdfbox-app-2.0.10.jar

I am doing following steps:
Step-1
cd eclipse-workspace2018\test101

Step-2
set PATH_TO_FX="C:\javafx-sdk-11.0.1\lib"

Step-3
dir /s /b src\*.java > sources.txt & \
    javac --module-path %PATH_TO_FX% --add-modules=javafx.controls \
    -d out @sources.txt & del sources.txt

Step-4
cd out & jar xf "%PATH_TO_FX%\javafx.base.jar" & \
    jar xf "%PATH_TO_FX%\javafx.graphics.jar" & \
    jar xf "%PATH_TO_FX%\javafx.controls.jar" & \
    cd ..
copy "%PATH_TO_FX%\..\bin\prism*.dll" out & \
    copy "%PATH_TO_FX%\..\bin\javafx*.dll" out & \
    copy "%PATH_TO_FX%\..\bin\glass.dll" out & \
    copy "%PATH_TO_FX%\..\bin\decora_sse.dll" out
del out\META-INF\MANIFEST.MF & del out\module-info.class
mkdir libs
jar --create --file=libs/index101.jar \
    --main-class=test101.Launcher -C out .
java -jar libs\index101.jar

Kindly modify my steps for adding above mentioned two dependencies pdfBox & sqlite.

A: First of all, a word of advice: Creating fat jars on command line is not advised at all. It is a manual process that should be avoided. You should try Maven or Gradle and the existing plugins for this task, in case you still need a fat jar. You should try to create a modular project, instead, and create a custom image with jlink that you can distribute for a given platform.
Second, if you still want to do a fat jar manually, you should understand the above steps, in order to be able to modify them according to your needs. Basically the main idea of a fat jar is a single project with all the *.class files (and other resources) from all the possible dependencies, not only those from your source code. The tutorial at openjfx.io just mentions the case of JavaFX dependencies.
So if you have extra dependencies, the idea is to extract the content of their jars, in the same way you extract the JavaFX jars. See jar command options like xf.
That is done in the step 3:
cd out & jar xf "%PATH_TO_FX%\javafx.base.jar" & \
    jar xf "%PATH_TO_FX%\javafx.graphics.jar" & \
    jar xf "%PATH_TO_FX%\javafx.controls.jar" & \
    cd ..

You can modify that step with your existing jars:
cd out & jar xf "%PATH_TO_FX%\javafx.base.jar" & \
    jar xf "%PATH_TO_FX%\javafx.graphics.jar" & \
    jar xf "%PATH_TO_FX%\javafx.controls.jar" & \
    jar xf "C:\sqlite-jdbc-3.6.20.1.jar" & \
    jar xf "C:\pdfbox-app-2.0.10.jar" & \
    cd ..

Then you can proceed with the rest of the steps in the same way.
Note that while this might work, those third party jars might have other dependencies as well (see their pom.xml for that). If that's the case, you will need to download them manually, and add them to the fat jar in the same way. Should you use Maven or Gradle, they will do it automatically for you.
As mentioned before, this is not advised at all.


text:
Q: Strange words people say when leaving I've been at parties or other gatherings, and, when it was time to leave, native speakers would come up with odd ways of saying "It's time to go."
One way would be:

Let's make like a bakery truck and haul buns.

Another was:

Let's blow this clambake.

I'm wondering if someone could explain why these phrases get used, and if there are any underlying puns or jokes that I may not be catching.
In short, why do these mean, "It's time to leave?"

Disclaimer: I already understand these expressions, but thought they would be interesting for the English language learner. (In fact, this question is based on an "actual problem I have faced": in the past, some non-native friends have asked me to explain these phrases; I found them easy for me to understand, but hard to explain in a way that a non-native speaker could fully appreciate their whimsicality. Non-natives, feel free to give this one a try – it might be a fun "practice question."

A: "Let's make like a bakery truck and haul buns" is jokingly said when one wants to leave a party. Our buns (buttocks) are compared to a bakery truck, that is, they are as heavy and big as a bakery truck which hauls (drags) heavily.
On the other hand a bakery truck also sells buns (small, sometimes sweet breads) having a shape that resembles to a curvy contour of a girls gluteus maximus muscles as seen from behind: "Margie's buns look nice and tight now that she's working out."
In other words buns sold by the bakery truck are compared to the slang word of ass, cheeks, buttocks. There is a pun which mixes our buns with the buns sold by a bakery truck.
As a result we can understand the pun this way: "let's move our asses out of here" or "let's get out of here".
"Let's blow this clambake" it's a very silly way to say "Let's get a move on", where blow is the slang word for " to go, leave, exit" or "leave this less than an interesting place".

A: I'm watching a movie from 1939 called They Made Me a Criminal, where one of the characters says, "Let's blow!" It's possible that this usage predated versions that specified from whence to blow, viz "Let's blow this [whatever]." So "blow" might have been slang that pre-dated such terms as "book," "jet," "boogie," or possibly even "scram." "Twenty-three skidoo", however, is almost certainly older. The import is not so much that it's time to leave but rather that those who are "blowing" are too cool for school.

A: The way I have come to understand these phrases:

Let's make like a bakery truck and haul buns.

Much in the way a bakery truck would "haul buns" (haul>pull>move) (buns>bread) from one location to another. A person would (haul>pull>move) their own (buns>butt(slang)) from one location to another.

Let's blow this clambake.

To blow when talking in the context of leaving is talking about how the wind will "Blow" and/or move.
While the term clambake can be replaced with any descriptive word meaning the current location:

Let's blow this clambake.
Let's blow this party.
Let's blow this pop stand (soda shop).
Let's blow this Popsicle stand.
Let's blow this joint (an establishment). <~~ this one can also be used as a drug reference
Let's blow this place.
Let's blow this bitch.
Let's blow this town.

in all instances it means to move (like the wind can blow) from your current location defined by the descriptive word you use.
the term clambake itself when used can mean different types of places also:

an outdoor social gathering at which clams and other seafood (and often chicken,
      potatoes, and sweet corn) are baked or steamed, traditionally in a pit, over heated
      stones and under a bed of seaweed.

or (informally)

a place where the crowd is mostly female (where a clam is referencing the female
      genitalia)

and lastly (again informally and mostly used in the north east america)

a small area where drugs are emitting a large amount of smoke causing the air to be
      mostly polluted with said smoke. Such as a group of people smoking in a car or a
      larger group of people smoking at a festival. (this term comes from the resemblance
      marijuana smoke has to the smoke emitted during the cooking process at the outdoor
      social gathering at which clams and other seafood steamed)


text:
Q: How exactly is docker circumventing my nftables? My aim is to block all ports from non "lo" interfaces except for 22, 80, 443.
I don't want external devices to my Rasberry pi to be able to access anything else except for 22, 80, 443.
I have a nc server running on port 9123. My nftables rightly blocks LAN devices from accessing that port.
However - any service I start in docker seems to be NOT blocked - other LAN devices can access docker servers on the PI. I don't quite understand how this is happening. On line 107 my defauly policy is to DROP, the proceeding line adds an exception on the "lo" interface. What exactly is going on here? And how can I achieve the desired behaviour (i.e.) to block LAN devices from accessing anything on the pi except for 22,80,443? thanks
   root@raspberrypi:/home/pi/tmp # nft  list ruleset   | awk '{printf "%d\t%s\n", NR, $0}'
    1   table ip nat {
    2       chain DOCKER {
    3           iifname "docker0" counter packets 0 bytes 0 return
    4           iifname "docker_gwbridge" counter packets 0 bytes 0 return
    5           iifname "br-7a4b6e0a5c6f" counter packets 3840 bytes 115200 return
    6           iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 8920 counter packets 0 bytes 0 dnat to 172.20.0.2:8920
    7           iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 8096 counter packets 0 bytes 0 dnat to 172.20.0.2:8096
    8           iifname != "docker0" meta l4proto tcp tcp dport 8080 counter packets 0 bytes 0 dnat to 172.17.0.2:8080
    9           iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 445 counter packets 0 bytes 0 dnat to 172.20.0.3:445
    10          iifname != "docker0" meta l4proto tcp tcp dport 3389 counter packets 0 bytes 0 dnat to 172.17.0.2:3389
    11          iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 9125 counter packets 8306 bytes 531572 dnat to 172.20.0.5:80
    12          iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 9123 counter packets 0 bytes 0 dnat to 172.20.0.6:80
    13          iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 139 counter packets 0 bytes 0 dnat to 172.20.0.3:139
    14          iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 9124 counter packets 0 bytes 0 dnat to 172.20.0.7:80
    15          iifname != "br-7a4b6e0a5c6f" meta l4proto tcp tcp dport 32400 counter packets 0 bytes 0 dnat to 172.20.0.8:32400
    16      }
    17
    18      chain POSTROUTING {
    19          type nat hook postrouting priority srcnat; policy accept;
    20          oifname != "docker0" ip saddr 172.17.0.0/16 counter packets 958 bytes 399977 masquerade
    21          oifname != "docker_gwbridge" ip saddr 172.19.0.0/16 counter packets 0 bytes 0 masquerade
    22          oifname != "br-7a4b6e0a5c6f" ip saddr 172.20.0.0/16 counter packets 184 bytes 12810 masquerade
    23          oifname != "docker0" ip saddr 172.17.0.0/16 counter packets 0 bytes 0 masquerade
    24          oifname != "br-7a4b6e0a5c6f" ip saddr 172.20.0.0/16 counter packets 8 bytes 502 masquerade
    25          oifname != "docker_gwbridge" ip saddr 172.19.0.0/16 counter packets 0 bytes 0 masquerade
    26          oifname != "docker0" ip saddr 172.17.0.0/16 counter packets 0 bytes 0 masquerade
    27          oifname != "docker_gwbridge" ip saddr 172.19.0.0/16 counter packets 0 bytes 0 masquerade
    28          oifname != "br-7a4b6e0a5c6f" ip saddr 172.20.0.0/16 counter packets 8 bytes 502 masquerade
    29          oifname != "docker0" ip saddr 172.17.0.0/16 counter packets 45 bytes 3148 masquerade
    30          oifname != "docker_gwbridge" ip saddr 172.19.0.0/16 counter packets 0 bytes 0 masquerade
    31          oifname != "br-7a4b6e0a5c6f" ip saddr 172.20.0.0/16 counter packets 36 bytes 2324 masquerade
    32          oifname != "docker0" ip saddr 172.17.0.0/16 counter packets 0 bytes 0 masquerade
    33          oifname != "br-7a4b6e0a5c6f" ip saddr 172.20.0.0/16 counter packets 36 bytes 2324 masquerade
    34          oifname != "docker_gwbridge" ip saddr 172.19.0.0/16 counter packets 0 bytes 0 masquerade
    35          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 8080 counter packets 0 bytes 0 masquerade
    36          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 8920 counter packets 0 bytes 0 masquerade
    37          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 3389 counter packets 0 bytes 0 masquerade
    38          ip saddr 172.20.0.4 ip daddr 172.20.0.4 tcp dport 32400 counter packets 0 bytes 0 masquerade
    39          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 8096 counter packets 0 bytes 0 masquerade
    40          ip saddr 172.20.0.5 ip daddr 172.20.0.5 tcp dport 80 counter packets 0 bytes 0 masquerade
    41          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 445 counter packets 0 bytes 0 masquerade
    42          ip saddr 172.20.0.7 ip daddr 172.20.0.7 tcp dport 80 counter packets 0 bytes 0 masquerade
    43          ip saddr 172.20.0.8 ip daddr 172.20.0.8 tcp dport 80 counter packets 0 bytes 0 masquerade
    44          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 139 counter packets 0 bytes 0 masquerade
    45          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 80 counter packets 0 bytes 0 masquerade
    46          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 8080 counter packets 0 bytes 0 masquerade
    47          ip saddr 172.20.0.3 ip daddr 172.20.0.3 tcp dport 32400 counter packets 0 bytes 0 masquerade
    48          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 3389 counter packets 0 bytes 0 masquerade
    49          ip saddr 172.20.0.5 ip daddr 172.20.0.5 tcp dport 80 counter packets 0 bytes 0 masquerade
    50          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 80 counter packets 0 bytes 0 masquerade
    51          ip saddr 172.20.0.7 ip daddr 172.20.0.7 tcp dport 445 counter packets 0 bytes 0 masquerade
    52          ip saddr 172.20.0.8 ip daddr 172.20.0.8 tcp dport 8920 counter packets 0 bytes 0 masquerade
    53          ip saddr 172.20.0.7 ip daddr 172.20.0.7 tcp dport 139 counter packets 0 bytes 0 masquerade
    54          ip saddr 172.20.0.8 ip daddr 172.20.0.8 tcp dport 8096 counter packets 0 bytes 0 masquerade
    55          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 445 counter packets 0 bytes 0 masquerade
    56          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 8080 counter packets 0 bytes 0 masquerade
    57          ip saddr 172.20.0.3 ip daddr 172.20.0.3 tcp dport 80 counter packets 0 bytes 0 masquerade
    58          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 3389 counter packets 0 bytes 0 masquerade
    59          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 139 counter packets 0 bytes 0 masquerade
    60          ip saddr 172.20.0.4 ip daddr 172.20.0.4 tcp dport 32400 counter packets 0 bytes 0 masquerade
    61          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 80 counter packets 0 bytes 0 masquerade
    62          ip saddr 172.20.0.8 ip daddr 172.20.0.8 tcp dport 80 counter packets 0 bytes 0 masquerade
    63          ip saddr 172.20.0.9 ip daddr 172.20.0.9 tcp dport 8920 counter packets 0 bytes 0 masquerade
    64          ip saddr 172.20.0.9 ip daddr 172.20.0.9 tcp dport 8096 counter packets 0 bytes 0 masquerade
    65          ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 80 counter packets 0 bytes 0 masquerade
    66          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 8080 counter packets 0 bytes 0 masquerade
    67          ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 3389 counter packets 0 bytes 0 masquerade
    68          ip saddr 172.20.0.3 ip daddr 172.20.0.3 tcp dport 80 counter packets 0 bytes 0 masquerade
    69          ip saddr 172.20.0.4 ip daddr 172.20.0.4 tcp dport 80 counter packets 0 bytes 0 masquerade
    70          ip saddr 172.20.0.5 ip daddr 172.20.0.5 tcp dport 8920 counter packets 0 bytes 0 masquerade
    71          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 445 counter packets 0 bytes 0 masquerade
    72          ip saddr 172.20.0.7 ip daddr 172.20.0.7 tcp dport 32400 counter packets 0 bytes 0 masquerade
    73          ip saddr 172.20.0.5 ip daddr 172.20.0.5 tcp dport 8096 counter packets 0 bytes 0 masquerade
    74          ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 139 counter packets 0 bytes 0 masquerade
    75          meta l4proto tcp ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 8920 counter packets 0 bytes 0 masquerade
    76          meta l4proto tcp ip saddr 172.20.0.2 ip daddr 172.20.0.2 tcp dport 8096 counter packets 0 bytes 0 masquerade
    77          meta l4proto tcp ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 8080 counter packets 0 bytes 0 masquerade
    78          meta l4proto tcp ip saddr 172.20.0.3 ip daddr 172.20.0.3 tcp dport 445 counter packets 0 bytes 0 masquerade
    79          meta l4proto tcp ip saddr 172.17.0.2 ip daddr 172.17.0.2 tcp dport 3389 counter packets 0 bytes 0 masquerade
    80          meta l4proto tcp ip saddr 172.20.0.5 ip daddr 172.20.0.5 tcp dport 80 counter packets 0 bytes 0 masquerade
    81          meta l4proto tcp ip saddr 172.20.0.6 ip daddr 172.20.0.6 tcp dport 80 counter packets 0 bytes 0 masquerade
    82          meta l4proto tcp ip saddr 172.20.0.3 ip daddr 172.20.0.3 tcp dport 139 counter packets 0 bytes 0 masquerade
    83          meta l4proto tcp ip saddr 172.20.0.7 ip daddr 172.20.0.7 tcp dport 80 counter packets 0 bytes 0 masquerade
    84          meta l4proto tcp ip saddr 172.20.0.8 ip daddr 172.20.0.8 tcp dport 32400 counter packets 0 bytes 0 masquerade
    85      }
    86
    87      chain PREROUTING {
    88          type nat hook prerouting priority dstnat; policy accept;
    89          fib daddr type local counter packets 86612 bytes 5842738 jump DOCKER
    90          fib daddr type local counter packets 59086 bytes 4082250 jump DOCKER
    91          fib daddr type local counter packets 58016 bytes 4020180 jump DOCKER
    92          fib daddr type local counter packets 58010 bytes 4019512 jump DOCKER
    93          fib daddr type local counter packets 21891 bytes 1551454 jump DOCKER
    94      }
    95
    96      chain OUTPUT {
    97          type nat hook output priority -100; policy accept;
    98          ip daddr != 127.0.0.0/8 fib daddr type local counter packets 11 bytes 660 jump DOCKER
    99          ip daddr != 127.0.0.0/8 fib daddr type local counter packets 10 bytes 600 jump DOCKER
    100         ip daddr != 127.0.0.0/8 fib daddr type local counter packets 9 bytes 540 jump DOCKER
    101         ip daddr != 127.0.0.0/8 fib daddr type local counter packets 8 bytes 480 jump DOCKER
    102         ip daddr != 127.0.0.0/8 fib daddr type local counter packets 1 bytes 60 jump DOCKER
    103     }
    104 }
    105 table ip filter {
    106     chain INPUT {
    107         type filter hook input priority -450; policy drop;
    108         iifname "lo" counter packets 19231 bytes 156043045 accept
    109         ip daddr 127.0.0.0/8 counter packets 0 bytes 0 reject
    110         ct state established,related counter packets 67781 bytes 452733513 accept
    111         icmp type echo-request accept
    112         ct state new tcp dport 22 counter packets 119 bytes 7020 accept
    113         ct state new tcp dport 443 counter packets 324 bytes 19343 accept
    114         ct state new tcp dport 80 counter packets 17 bytes 916 accept
    115         ip protocol icmp counter packets 0 bytes 0 accept
    116         limit rate 5/minute counter packets 685 bytes 107167 log prefix "iptables denied: " level debug
    117         tcp dport 9125 drop
    118         counter packets 27066 bytes 4826608 drop
    119     }
    120
    121     chain OUTPUT {
    122         type filter hook output priority filter - 1; policy drop;
    123         counter packets 133164 bytes 583633753 accept
    124     }
    125 }


text:
Q: Пришедшая по почте картинка не открывается Отправляю картинку на почту средствами PHP, пришедшая картинка не открывается:
function send_mail($mail_to, $thema, $html, $path)
{
if ($path) {
    $fp = fopen($path, "rb");
    if (!$fp) {
        print "Cannot open file";
        exit();
    }
    $file = fread($fp, filesize($path));
    fclose($fp);
}
$name     = "foto.jpg"; // в этой переменной надо сформировать имя файла (без всякого пути)
$EOL      = "\r\n"; // ограничитель строк, некоторые почтовые сервера требуют \n - подобрать опытным путём
$boundary = "--" . md5(uniqid(time())); // любая строка, которой не будет ниже в потоке данных.
$headers  = "MIME-Version: 1.0;$EOL";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"$EOL";
$headers .= "From: zakaz@energy-trucks.ru\n";
$headers .= "Reply-To: zakaz@energy-trucks.ru\n";
$headers .= "X-Priority: 1\n";

$multipart = "--$boundary$EOL";
$multipart .= "Content-Type: text/html; charset=utf-8$EOL";
$multipart .= $EOL; // раздел между заголовками и телом html-части
$multipart .= $html;

$multipart .= "$EOL--$boundary$EOL";
$multipart .= "Content-Type: application/octet-stream; name=\"$name\"$EOL";
$multipart .= "Content-Disposition: attachment; filename=\"$name\"$EOL";
$multipart .= $EOL; // раздел между заголовками и телом прикрепленного файла
$multipart .= $file;

$multipart .= "$EOL--$boundary--$EOL";

if (!mail($mail_to, $thema, $multipart, $headers)) {
    //// если письмо не отправлено
    echo "Повторите пожалуйста отправку сообщения, не сработало..";
}
}

A: Не путайте MIME'ы, это плохая практика. Ваш файлик - это image/jpg. Еще нужно саму картинку получить, base64 кодировать, сплитить.
Вот работающий пример.
А вообще, советую PHP Mailer.


text:
Q: How to know the column width of a two column article? I'm writing an article with 2 columns. If my document is this:
\documentclass[10pt,a4paper, twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
left=2.00cm,
right=2.00cm,
top=2.00cm,
bottom=2.00cm
]{geometry}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}

Is there a way tho know exactly the width of the column (see picture)? I need it for draw in others softwares using this lenght.

A: The column width is stored in the length \columnwidth. It's value can be turned into a text representation using \the\columnwidth. Either use this inside \message{...} to print it to the LaTeX compiler output and log file or directly in the text if you want. The value is in Points (pt) which are 1/72.27 of an inch. (Not that PDF and Postscript have points with 1/72 inches for simplify calculations. These are called "big points" (bp) in TeX.)
\documentclass[10pt,a4paper, twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
left=2.00cm,
right=2.00cm,
top=2.00cm,
bottom=2.00cm
]{geometry}
\usepackage{lipsum}
\begin{document}
\section{bla}
some text \message{The column width is: \the\columnwidth}
The column width is: \the\columnwidth
\lipsum
\lipsum
\end{document}

Which gives me: The column width is: 236.84843pt


text:
Q: Why does an order still come through on Magento if the customer uses an invalid debit/credit card? When a customer uses an invalid debit/credit card on a Magento checkout, is there a reason as to why the order still comes through to the orders section?
The order says it is pending payment even though no credit/debit card information has come through.


text:
Q: What's the minimum SDK version for new iOS apps? Is there a page on the Apple website listing the minimum iOS SDK required for new app submissions?

A: The Apple Developer news feed is where Apple announces all hard deadlines on SDK requirements that are not enforced when you submit an app. Watching here, you can prepare for future requirements before they are enforced.

*

*https://developer.apple.com/news/
Today (October 2020) it's the iOS 13 SDK and iOS 14 was announced as the mandatory minimum in April 2021.

Starting April 2021, all iOS and iPadOS apps submitted to the App Store must be built with Xcode 12 and the iOS 14 SDK.

Find the News Link here.


text:
Q: How to upload files using folder path and Microsoft Graph API 1.0 I am working on a script to upload files to a folder using Microsoft Graph API 1.0. I am trying to make it so the user running the script can copy and paste the path of a sharepoint/onedrive folder. I of course want to use the path as a destination for the files to be uploaded too. So far I cannot find a way to get this to work.
Path example: https://example.sharepoint.com/sites/TheSite/Shared%20Documents/User
API Reference: https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0
I have tried making GET calls to the API using the path, part of the path, and every variation of the hostname, and path. I am using the Python Requests library, and authentication is not an issue.
Errors received:
 "error": {
    "code": "itemNotFound",
    "message": "The resource could not be found."

and
  "error": {
    "code": "invalidRequest",
    "message": "Invalid hostname for this tenancy",

A: When we are using the storage path. we have to choose complete path for calling.whether it is Azure blob container or Sharepoint or Drive.
Please refer below link for uploading data
https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
https://medium.com/@rahul.metangale/upload-a-file-to-sharepoint-using-azure-graph-api-9deacce57449
steps to upload:
1)Generate Token - using tenant, client id, client secret
2)Get drive id
GET https://graph.microsoft.com/v1.0/drives
3)Upload Document Smaller than 4MB:
PUT https://graph.microsoft.com/v1.0/drives/{{drive-id}}/items/root:/{{file-name}}:/content
Header:
"Authorization" : "Bearer
Body: binary (select binary option in body in postman)
Upload a file using select file option
file-name: is file name along with extension example: test.txt
4)Upload Document Greater than 4MB
GET: https://graph.microsoft.com/v1.0/drives/{{drive-id}}/items/root:/{{file-name}}:/createUploadSession
Header:
"Authorization" : "Bearer
This will return upload url
Upload Document
PUT
Header:
"Authorization" : "Bearer
Body: binary (select binary option in body in postman)
4)Upload Document Greater than 4MB:
Header:
"Authorization" : "Bearer


text:
Q: How does Google Books work? Are there any open source alternatives? I have been asked to publish a complete book online similar way Google Books does? i.e. it's viewable and printable but not download-able.
Is the process is basically "high quality scanning"? are there any open source solution to "mass generation" of "watermark" on those high quality images. Suppose you have an original image. and when the user views it online, I re-create the image add watermark and some other text on top of the image "on-the-fly" are there such library exist in python off course :)
Any tips? If you have done this before please share.
Thanks

A: Unfortunately Google uses a patented technique for scanning it's books, so you will probably have to stick to traditional methods.

Google created some seriously nifty
  infrared camera technology that
  detects the three-dimensional shape
  and angle of book pages when the book
  is placed in the scanner. This
  information is transmitted to the OCR
  software, which adjusts for the
  distortions and allows the OCR
  software to read text more accurately.
  No more broken bindings, no more
  inefficient glass plates.

Basically you will need to scan the book using an OCR application (tesseract is good), then I would generate a PDF/image from the scanned text, and finally add the watermark on top. The Python Imaging Library would seem to be the best tool for this.

A: Don't know much about Google Books, but Python Imaging Library can do watermarking (there's ASPN recipe for that).

A: See the slashdot question on reproducing Google's photo + laser grid technique.


text:
Q: Copy to clipboard button does not work properly I need some help regarding a copytoclipboard button. I can't seem to get it to work. Right now it copies the complete div, but i only want it to copy the text inside, including the breaks between paragraphs. I think I need to keep the paragraph  coding setup because I have buttons elsewhere that change the inner html.
HTML and JS below.
Thanks a lot. Bart

function copyToClipboard(element) {
  var $temp = $("<textarea>");
  var brRegex = /
/gi;
  $("body").append($temp);
  $temp.val($(element).text().replace(brRegex, "\r\n")).select();
  document.execCommand("copy");
  $temp.remove();
}

Report:

Report 1.

entry 1:

entry 2:

entry 3:

entry 4:

entry 5:

entry 6:

Concluding:

  <button type="button" onclick="copyToClipboard('div#report')">
      Copy div to clipboard
  </button>

So the easy answer was replacing .html with .text. I'm still very new to this. Thanks for the help.

A: Try using $(element).text() instead of $(element).html()

function copyToClipboard(element) {
  var $temp = $("<textarea>");
  $("body").append($temp);
  $temp.val($(element).text() ).select();
  document.execCommand("copy");
  $temp.remove();
}

Report:

Report 1.

entry 1:

entry 2:

entry 3:

entry 4:

entry 5:

entry 6:

Concluding:

  <button type="button" onclick="copyToClipboard('div#report')">
      Copy div to clipboard
  </button>

A: Call that function copyToClipboard('#p1') in button.
than that function add
function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();
}

function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();
}
body {
              background-color:#999999;
              font-family: 'Oswald', sans-serif;
      }
p
{
  color:#000000;
  font-size:20px;
}

.textBox
{
  height:30px;
  width:300px;
}

button
{
  height:30px;
  width:150px;
  border-radius:8px;
  padding:10px;
  font-size:20px;
  font-family: 'Oswald', sans-serif;
  height:52px;
  cursor:pointer;
  background-color:wheat;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>How to copy TEXT to Clipboard on Button-Click</title>

  <link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

How to copy a TEXT to Clipboard on a Button-Click

entry 1:

entry 2:

entry 3:

entry 4:

entry 5:

entry 6:

Hi, I'm the 2nd TEXT

<button onclick="copyToClipboard('#p1')">Copy TEXT 1</button>
<button onclick="copyToClipboard('#p2')">Copy TEXT 2</button>

<input class="textBox" type="text" id="" placeholder="Dont belive me?..TEST it here..;)" />


text:
Q: Operator += giving undefined results I am creating a post processor for our CAM software and hit a roadblock...the following Javascript is generating the results below.  I am very close, but how can I get rid of the "undefined" at the beginning?  I am at wit's end.
Thank you
function onSection() {
    var Comp = hasParameter("operation:compensationType")
        ? getParameter("operation:compensationType")
        : " ";
    var dComp = "";

    if (Comp == "control") {
        dComp = "D" + tool.diameterOffset + ", ";
    } else {
        return;
    }
    programInfo["program.comp"] += dComp;
}

results:
undefinedD46, D46, D25,

A: programInfo["program.comp"] is apparently undefined before you reach the last line of your code.  That's the only possible source of the undefined.
Ensure it contains a valid string before concatenating to it.
if (!programInfo["program.comp"]) {
    programInfo["program.comp"] = "";
}

programInfo["program.comp"] += dComp;

A: You will need an initial value before you can append.  In javascript, uninitialized values are undefined.
function onSection() {
    var Comp = hasParameter("operation:compensationType")
        ? getParameter("operation:compensationType")
        : " ";
    var dComp = "";

    if (Comp == "control") {
        dComp = "D" + tool.diameterOffset + ", ";
    } else {
        return;
    }

    // Ensure the field exists, if not, set it to empty string
    var hasField = programInfo["program.comp"] !== undefined;
    if (!hasField) programInfo["program.comp"] = ""

    programInfo["program.comp"] += dComp;
}

A: programInfo["program.comp"] is probably not initialized yet.
As you don't want to erase its value, that should probably be done conditionally:
function onSection() {
    var Comp = hasParameter("operation:compensationType")
        ? getParameter("operation:compensationType")
        : " ";
    var dComp = "";

    if (Comp == "control") {
        dComp = "D" + tool.diameterOffset + ", ";
    } else {
        return;
    }
    if (!programInfo["program.comp"]) {
      programInfo["program.com"] = "";
    }
    programInfo["program.comp"] += dComp;
}

A: So you get an undefined because the property is undefined. So you need to initialize it.
Best solution, when you define programInfo, set "program.comp" to an empty string
Other solutions is to see if it is set, if not set it to an empty string
programInfo["program.comp"] = programInfo["program.comp"] || ''
programInfo["program.comp"] += dComp;

Or use an if/else to add it
if!(programInfo["program.comp"]) {
  programInfo["program.comp"] = dComp;
} else {
  programInfo["program.comp"] += dComp;
}


text:
Q: Is it correct to say that $\lim_{x\to -\infty} e^x = \lim_{x\to \infty} \frac{1}{e^x}$? I just see it logical...
Actually I think I can claim that
$$\lim_{x\to -\infty} a^x = \lim_{x\to \infty} \frac{1}{a^x}$$
$a$ being a parameter.

Is it correct?

A: Substitute:
$$y:=-x\;,\;\;\text{so that}\;\;x\to-\infty\iff y\to\infty\;,\;\;\text{and from here}:$$
$$\lim_{x\to-\infty} e^x=\lim_{y\to\infty} e^{-y}=\lim_{y\to\infty}\frac1{e^y}=0$$


text:
Q: i want to add a break or new line to an XML which i am forming using CDataXMLStreamWriter I would like to add a break or new line to XML which I am forming using CDataXMLStreamWriter
I tried below code but it didn't worked.
CDataXMLStreamWriter cdataStreamWriter = null;
cdataStreamWriter.writeCharacters("\n");

Please give me some suggestion on this.


text:
Q: Prepare for multi language capability. Have I missed a trick? My asp.net web app is currently being developed and I want to handle any language input by the user. This input will then be displayed to other users on the site.
So far I have done the following:

*

*Put this is the head - meta http-equiv="Content-Type" content="text/html; charset=utf-8"

*Saved inputs in NVARCHAR fields
Do I need to do anything else? Do I need any other meta tags (content-language, etc)?

A: Also think of a way to localize your UI, either via resources or with an appropriate support in your database. If the users are expected to generate non-English content, they will definitely appreciate seeing UI in their native language.

A: You should remember not to make assumptions that are not valid in general.
A fairly common assumption that is wrong is that (str.ToUpper().ToLower() == str) for any string str. A more subtle assumption is that the concept of "upper" and "lower" case even makes sense for any given language.
Another frequent problematic assumption is that a single char in the input is always an actual character from user's perspective. This is wrong - even setting things such as surrogate pairs aside, there are also combining characters. You either have to normalize your strings (and even that isn't 100% foolproof), or just avoid dealing with individual chars.
If you want to deal with more than just plain text input displayed verbatim - i.e. full, proper localization - you'll also have to handle number, date, currency etc formats correctly; and, for example, do not assume that decimal separator is a dot.
My best general advice would be to just go and read Michael Kaplan's blog, Microsoft's local guru on localization and related issues. Look for categories (tags) such as "Collation/Casing", "Encoding/Codepages" and "Int'l Programming". There's a lot of stuff there, and most of it is either directly relevant to your question, or interesting, or both. If, after reading a couple of his blog posts, you start thinking that maybe hiring a localization expert just to point out potential non-obvious problems in that area is a good idea, then you're probably right :)

A: *

*Whenever you use String.Format append client's culture spec. Using FxCop allows to explore these places.

*Exclude string constants from .cs code

*Place images (that can contain culture specific text) into skin files or resources.

A: The browsers determine the charset in the following order:

*

*Content-Type http header (value example: "text/html; charset=utf-8")

*XML declaration

*meta attribute

You should check that the web server does not send conflicting content type information in headers.
Make sure you save the files in UTF-8.


text:
Q: How to set bash files globally executable in git by default? In git when i commit bash files i want those files to be executable like this command do
git update-index --chmod=+x <file>

But i want it to be set globally by default.
Is there anyway of doing that by default ?

A: No, there isn't any way of doing that.  On Unix systems, Git honors the executable bit of the files that are in the repository.  So on such a system, by the fact that you've set them executable in the working tree, they'll automatically be tracked as executable in Git.
If you're on Windows, there is no executable bit, so you have to update them by hand.  You can try using Windows Subsystem for Linux, which has an executable bit, so you can check out the repository there and work with it.
This feature doesn't exist as a default because (a) it would be hard to implement since it would require intuiting which files are shell scripts (which is nontrivial) and (b) there are many shell scripts which wouldn't be safe to run by themselves.  If you know that this is appropriate for your project, you can write a shell script to set all of your shell scripts executable by default.


text:
Q: Sync files between 2 remote computers using Linux terminal I want to be able to synchronise files between 2 remote computers in both directions. Say for example that I want to synchronise my /home/Documents directory with <username>@example.com:/home/Documents
What's the easiest way to update the folders in both directions, so that new/updated files on my home computer get transferred to the remote computer, and new/updated files on the remote computer get transferred to my home computer?

A: You can use Unison. Here are some guides:

*

*Using Unison to Synchronize Two Directories

*File Synchronization with Unison

*Synchronize computers with Unison

*Synchronizing 2 Ubuntu Systems with Unison

A: I use rsync (over ssh), just because it's easy and simple.
To sincronize two ways, you can do two commands, like this:
rsync --recursive --progress --partial --rsh=ssh /home/Documents <username>@example.com:/home/Documents
rsync --recursive --progress --partial --rsh=ssh <username>@example.com:/home/Documents /home/Documents

EDIT: I've just remembered somebody suggesting duplicity at a sprint. As the home page states, duplicity is an "encrypted bandwidth-efficient backup using the rsync algorithm".


text:
Q: cv2.imshow() function displays correct image but while saving it using cv2.imwrite() funtion, its saves all black pixel image? I am trying to resize the input image to 736 x 736 as output size preserving the aspect ratio of the original image and add zero paddings while doing so.
The function image_resize_add_padding() works fine and is doing what I am trying to do. The resized image looks good while displaying using cv2.imshow() function
but while saving using cv2.imwrite() function it seems to be a fully black image.
How do I save the correct image as it was displayed?
import cv2
import numpy as np

def image_resize_add_padding(image, target_size):
    ih, iw = target_size
    h,  w, _ = image.shape

    scale = min(iw/w, ih/h)
    nw, nh = int(scale * w), int(scale * h)
    image_resized = cv2.resize(image, (nw, nh))

    image_paded = np.full(shape=[ih, iw, 3], fill_value=128.0)
    dw, dh = (iw - nw) // 2, (ih-nh) // 2
    image_paded[dh:nh+dh, dw:nw+dw, :] = image_resized
    image_paded = image_paded / 255.

    return image_paded

input_size = 736
image_path = "test_image.jpg"
original_image = cv2.imread(image_path)
output_image = image_resize_add_padding(
    np.copy(original_image), [input_size, input_size])
cv2.imshow('image', output_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite('test_output.jpg', output_image)

A: The imshow function and imwrite using the JPG format handle floating-point image buffers differently.
The line where you divided the image by 255. changed the image format to floating point. For the image data to be handled properly by the JPG writer, you can, for example, convert your buffer to uint8 (and make sure the values are in the range 0-255) before calling imwrite.
edit:
The code converts the image to floating point and also changes the range to 0-1. It is unclear why this is done, but if you want to keep the function as is, you can prepare the image for the imwrite call like this:
output_image = (output_image * 255).astype('uint8')


text:
Q: Integer homology of double loop space of odd-dimensional sphere I have checked everything "homology of loop spaces"-like, but was not able to find what is $H_*(\Omega^2S^3, \mathbb{Z})$. Therefore I ask you how to compute that?

A: There are homology isomorphisms $K(Br,1)\to \Omega^2_0 S^2$ and $\Omega^2 S^3\to \Omega^2_0 S^2$, so you are really asking about the homology of the stable braid group $Br$ (the colimit of the natural inclusions $Br_n\hookrightarrow Br_{n+1}$).
As expected there is no neat description with integral coefficients, but much is known. You'll find a nice summary in Section 4 of this paper of Vershinin .

A: The calculation you want is described in detail in Joe Neisendorfer's book Algebraic Methods in Unstable Homotopy Theory, Cambridge University Press, 2010.   In particular, the Eilenberg--Moore spectral sequence collapses to give that $H_*(\Omega^2 S^3;\mathbb Z) = Cotor_*^{\mathbb Z[y]}(\mathbb Z, \mathbb Z)$.  By calculating mod p, and then using the very simple Bockstein spectral sequence, he shows in Corollary 10.26.5, that $p$ annihilates the $p$--torsion for all primes $p$.  Thus $H_*(\Omega^2 S^3;\mathbb Z)_{(p)}$ is a graded $\mathbb Z/p$ vector space (above dimension 1) whose Poincare series could easily be worked out from $H_*(\Omega^2 S^3;\mathbb Z/p)$.

A: The next two claims completely describe
$H_*(\Omega^2S^3;\mathbb{Z})$.
This follows from several sources. For example, from already mentioned
in the answer of Nicholas Kuhn book of Joe Neisendorfer.
Theorem 1.
The space $H_*(\Omega^2S^3;\mathbb{Z}_p)$ is a
primitively generated Hopf algebra such that
$$
H_*(\Omega^2S^3;\mathbb{Z}_p)=
\begin{cases}
\Lambda_p[x_0,x_1,x_2,\cdots]\bigotimes\mathbb{Z}_p[y_0,y_1,y_2,\cdots]
&\quad\mbox{for}\quad p>2,\\[1mm]
\mathbb{Z}_2[x_0,x_1,x_2,\dots]&\quad\mbox{for}\quad p=2,
\end{cases}
$$
where $\deg(x_r)=2p^r-1,\,\deg(y_r)=2p^{r+1}-2$.
In particular
\begin{eqnarray*}
\sum_{q=0}^\infty\dim H_q\big(\Omega^2S^3;\mathbb{Z}_p\big)\,t^q&=&
\prod_{r=0}^\infty\frac{1+t^{2p^r-1}}{1-t^{2p^{r+1}-2}}\qquad\text{for $p>2$},\\
\sum_{q=0}^\infty\dim H_q\big(\Omega^2S^3;\mathbb{Z}_2\big)\,t^q&=&
\prod_{r=0}^\infty\frac{1}{1-t^{2^{r+1}-1}}\,.
\end{eqnarray*}
Theorem 2.
There is an isomorphism of $\mathbb{Z}$--modules
$$
H_q(\Omega^2S^3;\mathbb{Z})=
\begin{cases}
\mathbb{Z}&\text{for $q=0,1$},\\[1mm]
\bigoplus_{p\geqslant 2}\beta_p(H_{q+1}(\Omega^2S^3;\mathbb{Z}_p))&\text{for $q\geqslant 2$},
\end{cases}
$$
where $\beta_p:H_{q+1}(\Omega^2S^3;\mathbb{Z}_p)\longrightarrow H_q(\Omega^2S^3;\mathbb{Z})$ is the Bockstein homomorphism corresponding to the exact sequence of coefficients
$0\longrightarrow\mathbb{Z}\stackrel{\times p}\longrightarrow\mathbb{Z}\longrightarrow\mathbb{Z}_p\longrightarrow 0$
for prime $p\geqslant 2$.
Homomorphisms $\beta_p$ are the graded injective differentiations.
The action of $\beta_p$ is defined by the formulas
$$
\beta_p(x_0)=0,\qquad\beta_2(x_r)=x^2_{r-1},\qquad
\begin{cases}
\beta_p(x_r)=y_{r-1},\\
\beta_p(y_r)=0
\end{cases}
\quad\text{for $p>2$},
$$
where $r\geqslant 1$.


text:
Q: Numerical differentiation with Binomial Theorem In George Shilov's Elementary Real and Complex Analysis, there is a problem which asks us prove

If $f$ is twice differentiable on some open interval and the second derivative is continuous at $x$, then prove that
  $$f''(x)=\lim_{h\rightarrow 0}\frac{f(x)-2f(x+h)+f(x+2h)}{h^2}\,.$$

This is a common fact in numerical differentiation to approximate derivatives at the left-hand point and is fairly immediate from two applications of Taylor's Theorem with Lagrange Remainder. However, this was not the end of Shilov's problem. He also states

Find a similar expression for $f^{(n)}(x)$ (with appropriate hypotheses).

In the back of his book, he asserts that

$$f^{(n)}(x)=\lim_{h\rightarrow 0}\frac{1}{h^n}\sum_{k=0}^n (-1)^k\binom{n}{k}f(x+kh)$$

which I found interesting enough to at least remember, if not attempt. However, I recently came upon an application where this formula would be useful and attempted to prove it. However, it seems there was an error in Shilov's claim. He must have meant

$$(-1)^nf^{(n)}(x)=\lim_{h\rightarrow 0}\frac{1}{h^n}\sum_{k=0}^n (-1)^k\binom{n}{k}f(x+kh)$$

because working out $n=3$ and applying Lagrange's Remainder three times results in

$$\frac{f(x)-3f(x+h)+3f(x+2h)-f(x+3h)}{h^3}=\frac{1}{3!}\left(-3f'''(\xi_1)+24f'''(\xi_2)-27f'''(x_3)\right)$$

which gives the corrected limit (with continuity of $f^{(3)}$ at $x$ assumed).

Is there an easy way to go about proving this result in general?

We can attack this fairly directly, without induction. But this becomes equivalent to proving several interesting binomial identities:

$$\sum_{k=0}^n(-1)^k\binom{n}{k} k^m=\begin{cases} (-1)^n n!&\text{ if }m=n\\0&\text{ if }0\leq m<n\end{cases}$$

The first of which was tackled here while the others seem to have gone largely unasked. The case $m=1$ is tackled here and here, and I can see that I could continue the approaches taken in these answers by differentiating several times. The book-keeping isn't too awful because all these identities are just sums of $0$s. Thus $0\leq m<n$ isn't too bad, if we can do $m=1$. However, proving the cases $m=1$ and $m=n$ aren't entirely trivial.
Shilov seems to have hidden an interesting exercise in a terse sentence without any hint that it would be interesting. This makes me wonder if there's an easier way to go about proving this result.

A: Here we show the validity of the binomial identity.

We  obtain for integral $0\leq m  \leq n$:
  \begin{align*}
\color{blue}{\sum_{k=0}^n}&\color{blue}{(-1)^k\binom{n}{k}k^m}\\
&=\sum_{k=0}^n\binom{n}{k}(-1)^km![z^m]e^{kz}\tag{1}\\
&=m![z^m]\sum_{k=0}^n\binom{n}{k}\left(-e^{z}\right)^k\tag{2}\\
&=m![z^m](1-e^z)^n\tag{3}\\
&=m![z^m]\left(1-\left(1+z+\frac{z^2}{2}\cdots\right)\right)^n\tag{4}\\
&=(-1)^nm![z^m]\left(z+\frac{z^2}{2}+\cdots\right)^n\tag{5}\\
&\color{blue}{=}
\begin{cases}
\color{blue}{(-1)^nn!}&\qquad\color{blue}{m=n}\\
\color{blue}{0}&\qquad\color{blue}{0\leq m<n}
\end{cases}
\end{align*}

Comment:

*

*In (1) we use the coefficient of operator $[z^n]$ to denote the coefficient of $z^n$ of a series and we note that
$$k^m=m![z^m]e^{kz}=m![z^m]\sum_{j=0}^\infty\frac{(kz)^{j}}{j!}$$

*In (2) we do some rearrangements as preparation for the next step.

*In (3) we apply the binomial theorem.

*In (4) we expand the exponential series to better see what's going on.

*In (5) we simplify the expression and observe that the series starts with powers in $z$ which  are   greater or equal to $n$.

A: Traditionally used numerical approaches start from the minimally possible  polynomial model.
Estimation of the errors uses the next order polynomial in accordance with the Taylor series.
Let us build Lagrange interpolation polynomial in the form of

\begin{align}
&L_n(x) = \dfrac{(x-x_1)(x-x_2)\dots(x-x_n)}{(x_0-x_1)(x_0-x_2)\dots(x_0-x_n)} f(x_0)\\[4pt]
&+ \dfrac{(x-x_0)(x-x_2)(x-x_3)\dots(x-x_n)}{(x_1-x_0)(x_1-x_2)(x_1-x_3)\dots(x_1-x_n)} f(x_1)+\dots\\[4pt]
&+ \dfrac{(x-x_0)(x-x_1)\dots(x-x_{k-1})(x-x_{k+1})(x-x_{k+2})\dots(x-x_n)}
{(x_k-x_0)(x_k-x_1)\dots(x_k-x_{k-1})(x_k-x_{k+1})(x_k-x_{k+2})\dots(x_k-x_n)} f(x_k)\\[4pt]
&+\dots + \dfrac{(x-x_0)(x-x_1)\dots(x-x_{n-2})(x-x_n)}
{(x_{n-1}-x_0)(x_{n-1}-x_1)\dots(x_{n-1}-x_{n-2})(x_{n-1}-x_n)} f(x_{n-1})+\dots\\[4pt]
&+ \dfrac{(x-x_0)(x-x_1)\dots(x-x_{n-1})}
{(x_n-x_0)(x_n-x_1)\dots(x_n-x_{n-1})} f(x_n).
\end{align}

If $\quad x_k=x_0+kh,$ then
\begin{align}
&L_n(x) = \dfrac{(x-x_1)(x-x_2)\dots(x-x_n)}{(-h)(-2h)\dots(-nh)} f(x_0)\\[4pt]
&+ \dfrac{(x-x_0)(x-x_2)(x-x_3)\dots(x-x_n)}{(h)(-h)(-2h)\dots(-(n-1)h)} f(x_0+h)+\dots\\[4pt]
&+ \dfrac{(x-x_0)(x-x_1)\dots(x-x_{k-1})(x-x_{k+1})(x-x_{k+2})\dots(x-x_n)}
{(kh)((k-1)h)\dots(h)(-h)(-2h)\dots(-(n-k)h)} f(x_0+kh)+\dots\\[4pt]
&+ \dfrac{(x-x_0)(x-x_1)\dots(x-x_{n-2})(x-x_n)}
{((n-1)h)((n-2)h)\dots(h)(-h)} f(x_0+(n-1)h)+\dots\\[4pt]
&+ \dfrac{(x-x_0)(x-x_1)\dots(x-x_{n-1})}
{(nh)((n-1)h)\dots(h)} f(x_0+nh),\\[8pt]
\end{align}

\begin{align}
&L_n^{(n)}(x) = \dfrac1{h^n}\Big(f(x_0+nh) - nf(x_0+(n-1)h)+\dots
+(-1)^{n-k}\dbinom nkf(x_0+kh)\\[4pt]
&+\dots +(-1)^{n-1}nf(x+h)+(-1)^nf(x_0)\Big)
\end{align}

A: I will exhibit a proof by induction here. Actually I will prove a slightly more general result, constructing, for $f$, a family of functions $F_k(x,h)$ satisfying that, for any net $(a_h)$ such that $\displaystyle\lim_{h\to0} a_h=x$,

$$
\displaystyle\lim_{h\to0} \frac{F_k(a_h,h)}{h^k} = f^{(k)}(x).
$$

The net $(a_h)$ such that $\displaystyle\lim_{h\to0} a_h=x$ is necessary for the induction step. To obtain the result we want, just pick $a_h=x$ for all $h$.
The family $F_k(x,h)$ is defined by $F_1(x,h)= f(x+h)-f(x)$ and $F_k(x,h) = F_{k-1}(x+h,h) - F_{k-1}(x,h)$, which we will see that are given by the formula

$$
F_k(x,h) = \sum_{j=0}^{k} (-1)^{k-j}{{n}\choose{j}}f(x+jh).
$$

So what you said is accurate. There is a mistake at the formula given by the book.
Let us first prove the result for $F_1(x,h) = f(x+h)-f(x)$. If we have $\displaystyle\lim_{h\to0}a_h=x$, then, using L'Hospital, we easily verify that

$$
\lim_{h\to0} \frac{F_1(a_h,h)}{h}=\lim_{h\to0} \frac{f(a_h+h)-f(a_h)}{h}=\lim_{h\to0} f'(a_h+h)=f'(x).
$$

Define the auxiliary function $\widehat{F_1} = f'(x+h)-f'(x)$. We easily verify that

$$
\frac{\partial F_1}{\partial x}=\widehat{F_1}.
$$

And substituing $f$ by $f'$ since the begining, we get that for any $\displaystyle\lim_{h\to0}a_h=x$,

$$
\lim_{h\to0} \frac{\widehat{F_1}(a_h,h)}{h}=f''(x).
$$

Consider $F_2(x,h)=F_1(x+h,h)-F_1(x,h)$. Suppose that $\displaystyle\lim_{h\to0}a_h=x$ and let us evaluate
$$
\displaystyle\lim_{h\to0} \frac{F_2(a_h,h)}{h^2} = \displaystyle\lim_{h\to0} \frac{F_1(a_h+h,h)-F_1(a_h,h)}{h^2}.
$$
 For each $h$, using the mean value theorem on the first variable, there exists $c_h$ in the interval between $a_h$ and $a_h+h$ (so certainly $|c_h-a_h|\leq |h|$) such that
$$
F_1(a_h+h,h)-F_1(a_h,h) = \frac{\partial F_1}{\partial x}(c_h,h)h=\widehat{F_1}(c_h,h)h.
$$
Then, certainly $\displaystyle\lim_{h\to0}c_h=x$ and we have that

$$
\displaystyle\lim_{h\to0} \frac{F_2(a_h,h)}{h^2} = \displaystyle\lim_{h\to0} \frac{\widehat{F_1}(c_h,h)}{h}=f''(x).
$$

Define the auxiliary function $\widehat{F_2}=\widehat{F_1}(x+h,h)-\widehat{F_1}(x,h)$. It is easy to check that

$$
\frac{\partial F_2}{\partial x}=\widehat{F_2}.
$$

And, substituing $f$ by $f'$ since the begining, we get that

$$
\lim_{h\to0} \frac{\widehat{F_2}(a_h,h)}{h^2}=f^{(3)}(x).
$$

We may proceed by induction, defining for each $k\in\mathbb N$, $F_k(x,h)=F_{k-1}(x+h,h)-F_{k-1}(x,h)$, in an argument similar to what we did for $F_2$, if $\lim_{h\to0} a_h=x$, we obtain $\lim_{h\to0} c_h=x$ such that

$$
\displaystyle\lim_{h\to0} \frac{F_k(a_h,h)}{h^k} = \displaystyle\lim_{h\to0} \frac{\widehat{F_{k-1}}(c_h,h)}{h^{k-1}}=f^{(k)}(x).
$$

Then define the auxiliary function $\widehat{F_k}=\widehat{F_{k-1}}(x+h,h)-\widehat{F_{k-1}}(x,h)$ and check that

$$
\frac{\partial F_k}{\partial x}=\widehat{F_k}.
$$

And, substituing $f$ by $f'$ since the begining, we get that

$$
\lim_{h\to0} \frac{\widehat{F_k}(a_h,h)}{h^k}=f^{(k+1)}(x).
$$

Finally, it is easy to verify that $F_2(x,h)= F_1(x+h,h)-F_1(x,h) = f(x+2h)-2f(x+h)+f(x)$. Then $$F_3(x,h) = F_2(x+h,h)-F_2(x,h)= f(x+3h) - 3f(x+2h) + 3f(x+h) - f(x).$$
We derive the formula:
$$
F_k(x,h) = \sum_{j=0}^{k} (-1)^{k-j}{{n}\choose{j}}f(x+jh),
$$
which we will not be entering in more details, but can be easily proved by induction.

A: I'm not sure I'm contributing anything, maybe I misunderstood since this feels like essentially a duplicate of this link.  $\newcommand{\fd}{\Delta}$ Its not so hard (via e.g. repeated applications of l'Hopital, as Paramanand shows in that link) to show that you are actually interested in iterated forward finite differences
$$ \fd_h^1 f(x) := f(x+h)-f(x), \quad \fd_h^{n+1} f(x) := \fd_h^1[\fd_h ^nf] (x)=\fd_h ^nf(x+h) - \fd_h ^nf(x)$$
And your hope is that
$$ \fd_h ^nf (x) = \sum_{k=0}^{n} (-1)^{n-k} \binom{n}k f(x+kh)$$
By rescaling $f$, and choosing a different $x$, it would suffice to do this for $h=1$; let $\fd:=\fd^1_1$ for easy typing. Now the inductive proof for this is  straightforward using the Pascal triangle,
\begin{align} \fd^{n+1}f(x)&=\Delta\left[\sum_{k=0}^{n} (-1)^{n-k} \binom{n}k f(\bullet +k)\right](x) \\ &= \sum_{k=0}^{n} (-1)^{n-k} \binom{n}k f(x +k+1) - \sum_{k=0}^{n} (-1)^{n-k} \binom{n}k f(x+k)\\
&= \sum_{k=1}^{n+1} (-1)^{n+1-k} \binom{n}{k-1} f(x +k) + \sum_{k=0}^{n} (-1)^{n+1-k} \binom{n}k f(x+k)\\
&=(-1)^{n+1}  f(x) + f(x+n+1) + \sum_{k=1}^n (-1)^{n+1-k} \underbrace{\left(\binom{n}{k-1} +\binom{n}{k}\right)}_{=\binom{n+1}{k}}f(x +k)\\
&=\sum_{k=0}^{n+1} (-1)^{n+1-k} \binom{n+1}{k}f(x +k) \end{align}


text:
Q: How to get Mutable data from an NSURLRequest I'm trying to retrieve a text file from a URL and then process that text file in the swift Data form. It's like a CSV file but uses "|" for the column delimiter and "}" for the row delimiter.
I'd like to remove the first "line" up to a "}" character (my line delimiter is a "}" so that I can cycle through the file until it's empty.
However NSURLRequest returns an immutable Swift Data object.
I guess I can copy it into a mutable copy but I prefer it if I could persuade NSURLRequest to return a mutable Data object. Is that possible?
My URL request looks like this:
    func load(url: String) {

    debugPrint(#function)
    let url = URL(string: url)!
    let task = URLSession.shared.dataTask(with: url) { data, response, error in
        if let error = error {
            self.handleClientError(error: error)
            return
        }
        guard let httpResponse = response as? HTTPURLResponse,
            (200...299).contains(httpResponse.statusCode) else {
                self.handleServerError(error: response)
                return
        }
        debugPrint("data got")

        self.dataGot(data: data!)
        DispatchQueue.main.async {

                self.loadingDelegate!.stockLoadComplete()

        }

    }
    task.resume()

}

currently I'm creating a string from the entire file and doing some string operations to split rows and columns:
        let asString = String(data: data, encoding: String.Encoding.utf8)

    let rows = asString!.components(separatedBy: "}")
    for row in rows {
        self.addPriceLine(line: row)
    }

This approach is failing with a malloc error (after successfully processing a few hundred rows) so I suspect that I'm going down the wrong road somehow.
Is there a "good" or recommended approach? Using just a Data object seems a lot more elegant to me.
Advice appreciated.

A: OK so I solved the problem.
I was getting a runtime malloc error which made me think there was some problem with the Data buffer or its conversion to a string.
I wandered if it was something failing with memory allocation in the closure so I put the gotData() processing onto the main dispatch queue. Voila - the malloc went away.
Clearly there are limits to what you should do in the closure, rather than the main dispatch queue and I guess I was misusing the approach.
:)
        let task = URLSession.shared.dataTask(with: url) { data, response, error in
        if let error = error {
            self.handleClientError(error: error)
            return
        }
        guard let httpResponse = response as? HTTPURLResponse,
            (200...299).contains(httpResponse.statusCode) else {
                self.handleServerError(error: response)
                return
        }
        debugPrint("data got")

        DispatchQueue.main.async {
                self.dataGot(data: data!)

                self.loadingDelegate!.stockLoadComplete()

        }

    }


text:
Q: Dealing with sparse categories in binary cross-entropy In Keras, I'm using something similar to the  Keras IMDB example to build a topic modelling example. However, unlike the example, which has a single "positive/negative" classification, I have
over a hundred topics which are not mutually exclusive. Every training example has a corresponding output which is a vector of zeros with 3 or 4 ones.
ex :[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 ..... 0]
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(120, activation='sigmoid'))

# try using different optimizers and different optimizer configs
model.compile(loss='binary_crossentropy',
          optimizer='adam',
          metrics=['accuracy'])

print('Train...')
model.fit(x_train, y_train,
      batch_size=batch_size,
      epochs=15,
      validation_data=(x_test, y_test))
score, acc = model.evaluate(x_test, y_test,
                        batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)

Of course the model quickly jumps up to 95-97% accuracy, but when I look at the output, of course its predicting nothing but zeroes. Clearly the class imbalance (every class has more negative examples then positive examples is causing my predictions to stay at 0) is there a way to tweak the model to understand sparse binary examples?

A: I think the problem is the sigmoid activation function in your output layer. Binary crossentropy computes the sigmoid again as part of the loss computation (see the description in tensor flow: https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_logits). Just changing the activation function in the output layer to linear worked in our (similarly structured) case.


text:
Q: How is portal ownership decided? I have a portal where this happened:

*

*Player A conquered the portal, placed one resonator. Player A was listed as owner.

*Player B, C and D placed more resonators. B is listed as owner.
Currently there's still the one resonator from A, two resonators are from C, five resonators are from D. And two mods from B and one mod from C.
So how is portal ownership (for the Guardian badge) decided? Is the owner the player who initially conquered the portal and still has one resonator in it or can it change?

A: Portal ownership is designated by who the first person to place a resonator on the portal is. Even if all of their resonators decay, but the portal never goes unclaimed or flips teams, it will still count towards guardian days.
It is to note that the guardian badge will only count if you have resonators on a portal. Even if you have a 150+ day guardian that you own but you have no resonators, you will not get the badge until you upgrade one of the existing resonators to your own. Then the badge will pop.
As for your observation. There has to have been a time in which the portal was either unclaimed or the other teams. It is impossible for a portal to change ownership without changing color.

A: What you have seen can happen if you are player A, and for a short time.
If two players of same faction place a resonator on an unclaimed portal at about the same time (no more than a few seconds delay), A may see its resonator and its name as owner on the portal, then see it switch to the other player B. That means (I suppose) that on Niantic server B was first to place the resonator, but locally on A scanner the portal status is wrong for a few seconds.


text:
Q: ADF - startTime & endTime dynamic content - 1st and last day of the month I'm trying to add dynamic content to the relative URL of a REST connection in Azure Data factory that is making an API call to the azure consumption API. I want to automate the fetching of data from the current billing period which is defined by the 1st and last day of the current month.
I've tried adding the following dynamic content, but it is returning dates that are further away. I want to have it return the 1st and last day of the current month. I know this is not simple as there are not the same amount of days in each month.
@concat('?startTime=', adddays(utcnow(),-31,'yyyy-MM-dd'),'&endTime=',
adddays(utcnow(),+31,'yyyy-MM-dd'))

Expected result: return 1st day of the month in startTime and last day of the month in endTime.
Actual results:
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorHttpStatusCodeIndicatingFailure,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The HttpStatusCode 400 indicates failure.  {\"error\":{\"code\":\"400\",\"message\":\"Parameter: endTime. Value is greater than 2019-06-01\"}},Source=Microsoft.DataTransfer.ClientLibrary,'",
"failureType": "UserError",
"target": "Copy Data2"
}

A: first day: adddays(utcnow(), 0,'yyyy-MM-'), '01'
expression:
@concat('?startTime=', adddays(utcnow(), 0,'yyyy-MM-'), '01','&endTime=',
adddays(utcnow(), 0,'yyyy-MM-dd'))


text:
Q: CSRF Referer checking failed Django 1.8 I have searched about this but could not find any workable solution.
I have a website like www.example.com and subdomains a.example.com and b.example.com. When I try to post a request from a.example.com to b.example.com I get the error of Referer checking failed.
I have following settings in a.example.com and b.example.com:
CSRF_COOKIE_DOMAIN = ".example.com"

But I am not able to make use of CSRF_COOKIE_DOMAIN correctly.

A: Django 1.8 has strict referer checking for HTTPS. You cannot post from a.example.com to b.example.com with CSRF protection enabled in Django 1.8.
With Django 1.9 they added CSRF trusted origins.


text:
Q: React Redirect Post I am trying make this call where url is the base domain name and model is the object being passed into the POST but for react. (Do not want to use jquery in my react application):
$.redirect(url + "external-entrance", model, "POST");

The form information is being sent to a third party where they are calculating the information from the form and displaying information to me on their site. In my current solution, I am using refs to submit the form. However, I want to use state since I can validate/mask the fields better and also send the information to my own backend. But when I uue state I cannot do a post redirect like in form ref="form" method="post" action="url", using axios post then windows.location.href it just takes me to the link but doesn't POST to it.
import React from 'react'
import axios from 'axios'
import { H3, P } from '../../components/StyledHeading'
import Button from '../../components/Button'

class ContactForm extends React.Component {
  constructor(props) {
  super(props)
  this.state = {
    firstName: '',
    lastName: '',
    email: '',
    phone: '',
    zipCode: '',
    errors: [],
  }
  this.textInput = React.createRef();
}

_handleSubmit = evt => {
  evt.preventDefault()
  const payload = {
    "first_name": "Thomas",
    "last_name": "Edison",
    "email": "edison@email.com",
    "phone": "555-555-5355",
    "zip_code": 239062,
  }
  this.refs.myForm.submit();
}

render() {
  return (
    <Container>
      <form ref="myForm" method="post" action="https://externalsite.co/external-entrance">

Ready to reserve your spot?

Fill out the form below and we’ll get in touch soon.

            First Name:
            <input
              type="text"
              ref={this.textInput}
              disabled={isSending}
              name="firstName"
              placeholder="Thomas"/>

            Last Name:
            <input
            type="text"
            ref={this.textInput}
            disabled={isSending}
            name="lastName"
            placeholder="Edison"/>

          Phone Number:
          <input
            type="text"
            ref={this.textInput}
            disabled={isSending}
            name="phoneNumber"
            placeholder="555-555-5555"/>

          Email address:
          <input
            type="text"
            ref={this.textInput}
            disabled={isSending}
            name="emailAddress"
            placeholder="edison@email.com"/>

        <input type="hidden" ref={this.textInput} name="zipCode" value={29006}/>

      <Button color={Color.secondaryColor} onClick={this._handleSubmit}>Submit My Reservation</Button>
    </form>
  </Container>
)
}
}

export default ContactForm

A: There are a couple of things that I believe you are doing the wrong way in my estimations.

*

*There's no need to create a reference of the form as well as adding the "post" and "action" tags to the form. You just need to set the "onSubmit" property to a function that you will use to make the API call <form onSubmit={this._handleSubmit}>

*Based on my first point, you need to set the type of the button inside the form you will use to submit your form to <button type="submit"></button>.

*When declaring a function if you do not use ES6, you will have to bind the function in the class constructor (the case of your "SendLead()" function) like this.SendLead = this.SendLead.bind(this)

*It will be better to save the form inputs on the class state, that way it will be easier to perform validations or pass those to another component or whatever.

*Instead of using a hidden input field you could set that value on the state in the constructor of your class.

*Since we are saving the input fields values in the state, you need to add a function to the "onChange" event of each input field. onChange={this._handleInputChange}
Those are the main things I could point to in your code. I tweaked yours a little bit to make it work but basically I just did what I mentioned above.
import React from 'react'
import axios from 'axios'
// import { H3, P } from '../../components/StyledHeading'
// import Button from '../../components/Button'

class ContactForm extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      firstName: '',
      lastName: '',
      email: '',
      phone: '',
      zipCode: 29006,
      errors: [],
    }
  }

  SendLead = payload => {
    const URL = "http://localhost:3001/v1"
    const authToken = "Token token=5e2pJ5P234234123"
    const config = { "headers": { Authorization: authToken } }
    const bodyParams = payload

    axios.post(`${URL}/leads`, bodyParams, config)
      .then(res => console.log({res}))
      .catch(error => {
        console.log({error})
        this.setState({
          errors: error.response.data,
        })
      })

  }

  _handleInputChange = e =>
    this.setState({
      [e.target.name]: e.target.value
    })

  _handleSubmit = evt => {
    evt.preventDefault()
    const {
      firstName,
      lastName,
      email,
      phone,
      zipCode
    } = this.state;

    const payload = {
      "first_name": firstName,
      "last_name": lastName,
      "email": email,
      "phone": phone,
      "zip_code": zipCode,
    }
    this.SendLead(payload)
  }

  render() {
    const {
      firstName,
      lastName,
      email,
      phone,
      zipCode
    } = this.state;

    return (
      <form onSubmit={this._handleSubmit}>

Ready to reserve your spot?

Fill out the form below and we’ll get in touch soon.

            First Name:
            <input
              type="text"
              value={firstName}
              onChange={this._handleInputChange}
              // disabled={isSending}
              name="firstName"
              placeholder="Thomas" />

            Last Name:
            <input
              type="text"
              value={lastName}
              onChange={this._handleInputChange}
              // disabled={isSending}
              name="lastName"
              placeholder="Edison" />

            Phone Number:
              <input
              type="text"
              value={phone}
              onChange={this._handleInputChange}
              // disabled={isSending}
              name="phone"
              placeholder="555-555-5555"
            />

            Email address:
              <input
              type="text"
              value={email}
              onChange={this._handleInputChange}

              // disabled={isSending}
              name="email"
              placeholder="edison@email.com"
            />

          <input type="hidden" name="zipCode" value={29006} />

        <button type="submit">Submit My Reservation</button>
      </form>
    )
  }
}

export default ContactForm


text:
Q: Are there more convenient ways of getting the number of digits of a positive integer? I want to define $n$th power of $10$ for a positive integer. Say for $43$ it would be $2$, for $5$ it would be $1$, for $9999$ it would be $4$. As for $1$, $10$, $100$, ... I am still shifting between two options. $10$ would result either $1$ or $2$. But for simplicity I select it to be $2$.
In other words I want to get the number of digits of a positive integer with proper mathematical notation.
So far I have managed to do it with log and round:
$$\operatorname{floor}(\log_{10}(43))+1 = 2$$
I'm just not sure if this is good approach. As a bonus it would be nice to have a solution working with any base, not just 10.

A: I'm not sure what you find inconvenient; given any natural number $b\geq 2$, the number of base-$b$ digits of a given natural number $n$ is exactly equal to
$$\lfloor\strut\log_b(n)\rfloor+1$$
That's because, if
$$n=(d_kd_{k-1}\ldots d_1d_0)_b=d_kb^k+d_{k-1}b^{k-1}+\cdots+d_1b+d_0$$
where each digit $d_i$ satisfies $0\leq d_i\leq b-1$ and $d_k\neq 0$, we have
$$b^k\leq n<b^{k+1}$$
and because the logarithm is convex, this implies
$$k\leq \log_b(n)<k+1$$
so that $\lfloor\log_b(n)\rfloor = k$, and therefore $\lfloor\log_b(n)\rfloor+1=k+1$, which is indeed the number of digits in the base $b$ expansion of $n$.