probability – Random level reaching of Wiener process

The question:

$W$ denotes a Wiener process in filtration $mathcal{F}$, where $X$ is an $mathcal{F}_{0}$-measurable

a, Exponential

b, Cauchy

distributed random variable. Let us define $$tau=infleft{ tgeq0:left|W_{t}right|geq Xright} .$$
What is the probability, that $tau$ is finite, so $mathbf{P}left(tau<inftyright)=?$ And what is $mathbb{E}left(tauright)=?$ and $mathbb{E}left(W_{tau}cdotchi_{left{ tau<inftyright} }right)=?$, where $chi_{left{ tau<inftyright} }$ is the indicator variable of the $left{ tau<inftyright}$ event?

Here are my thoughts so far…

I know a Wiener process visits every deterministic level, but I don’t know if the same holds for random levels. Is there any plus boundary criterium? From the task I would say yes, there must be some criterium at least for the expected value for $X$, because why would the task give us two different random variables? I mean the exponential $X$ has finite expected value, but in the case of the Cauchy distribution we can’t say the same. For $mathbb{E}left(tauright)$ I would say it is $infty$, because a Wiener process visits every deterministic level with $1$ probability, but it costs $infty$ time in expectation, so $mathbb{E}left(tauright)=infty$. If the previous happens in the deterministic case, then it should holds for the random case as well, but I can’t say any compelling reason.

For $mathbb{E}left(W_{tau}cdotchi_{left{ tau<inftyright} }right)$ I wanted to use Wald’s identity, but there $mathbb{E}left(tauright)$ must be finite, so I couldn’t use it appropriately. I tried to use Doob’s Optional stopping theorem from this site: https://en.wikipedia.org/wiki/Optional_stopping_theorem. Unfortunatelly, I didn’t find the continuous-time version of the theorem so far, but as I know, the same holds for the continuous case. (Please, let me know, if I am wrong with this statement.) Using this theorem the answer should be $0$, but I am not so sure I can use this. Most of the times I have always used the words “bounded” and “finite” like they are synonims of each other. This example opened my eyes, that it is not necessary correct. I didn’t find it on wikipedia, but as I know Doob’s Optional stopping theorem is an “if and only if” statement. For example a Wiener process reaches every deterministic $aneq0$ level, so if $tau$ is the random level reaching time, then $mathbf{P}left(tau<inftyright)=1$, so we can say it is almost surely finite, but I can’t say any upper boundary for that, therefore we can’t use Doob’s Optional stopping theorem because $mathbb{E}left(W_{tau}right)=aneq W_{0}=0$. Is it a good train of thought? So if something is bounded or finite, then it doesn’t necessary mean the same.

Discrete stochastic process to stochastic differential equation

I was studying about stochastic processes and got stuck at a question.
Let’s say, I have a stochastic process like the following,

$X_i(t+1)=epsilon(X_i + X_j)$

$X_j(t+1)=(1-epsilon)(X_i + X_j)$

where $epsilon$ is a uniform random number $in(0,1)$ and $i,jin{1,2,3,…,N}$. I wanted to know if this process can be formulated in terms of $dX_i/dt$, with an unit of time being $N^2$.

Also is it possible to do this for any discrete stochastic process ? I mean, can any discrete stochastic process be casted into a corresponding stochastic differential equation ?

Thanks in advance

magento2 – Custom form in checkout process is not validated

I have created a new checkout step between shipping address step and payment step. Inside it, I have added a new form.

That step has the Next button. When I press that button, the form is not validated. How can I do it?

This is the step template:

<li id="billing_info" data-bind="fadeVisible: isVisible">
    <div class="step-title" data-bind="i18n: 'Datos de Facturación'" data-role="title"></div>
    <div id="checkout-step-billing"
         class="step-content checkout-shipping-method"
         data-role="content">

        <form class="form" data-bind="submit: navigateToNextStep" novalidate="novalidate">
            <div id="billing-form" class="billing-info fieldset" data-role="content">
                <!-- ko foreach: getRegion('billing-form-container') -->
                <!-- ko template: getTemplate() --><!-- /ko -->
                <!--/ko-->
            </div>
            <div class="actions-toolbar">
                <div class="primary">
                    <button data-role="opc-continue" type="submit" class="button action continue primary">
                        <span><!-- ko i18n: 'Next'--><!-- /ko --></span>
                    </button>
                </div>
            </div>
        </form>
    </div>
</li>

Note where the new form fields are placed.

This is the JS that controls the step:

define((
    'ko',
    'uiComponent',
    'underscore',
    'Magento_Checkout/js/model/step-navigator'
), function (ko, Component, _, stepNavigator) {
    'use strict';

    /**
     * mystep - is the name of the component's .html template,
     * <Vendor>_<Module>  - is the name of your module directory.
     */
    return Component.extend({
        defaults: {
            template: 'MyVendor_Checkout/billing-step'
        },

        // add here your logic to display step,
        isVisible: ko.observable(true),

        /**
         * @returns {*}
         */
        initialize: function () {
            this._super();

            // register your step
            stepNavigator.registerStep(
                // step code will be used as step content id in the component template
                'billing_info',
                // step alias
                null,
                // step title value
                'Billing Info',
                // observable property with logic when display step or hide step
                this.isVisible,

                _.bind(this.navigate, this),

                /**
                 * sort order value
                 * 'sort order value' < 10: step displays before shipping step;
                 * 10 < 'sort order value' < 20 : step displays between shipping and payment step
                 * 'sort order value' > 20 : step displays after payment step
                 */
                15
            );

            return this;
        },

        /**
         * The navigate() method is responsible for navigation between checkout steps
         * during checkout. You can add custom logic, for example some conditions
         * for switching to your custom step
         * When the user navigates to the custom step via url anchor or back button we_must show step manually here
         */
        navigate: function () {
            this.isVisible(true);
        },

        /**
         * @returns void
         */
        navigateToNextStep: function () {
           stepNavigator.next();
        }
    });
});

And this the JS that controls the form:

define((
    'Magento_Ui/js/form/form'
), function(Component) {
    'use strict';
    return Component.extend({
        initialize: function () {
            this._super();
            // component initialization logic
            return this;
        },

        /**
         * Form submit handler
         *
         * This method can have any name.
         */
        onSubmit: function() {
            // trigger form validation
            this.source.set('params.invalid', false);
            this.source.trigger('billingForm.data.validate');

            // verify that form data is valid
            if (!this.source.get('params.invalid')) {
                // data is retrieved from data provider by value of the customScope property
                var formData = this.source.get('billingForm');
                // do something with form data
                console.dir(formData);
            }
        }
    });
});

Should I add the code of the last JS as part of the first JS? Should I extend Magento_Ui/js/form/form there?

Please, can you give me a hand?

magento2.3 – How to show a form in an additional step in checkout process

I have created a new step to checkout page. This is the template:

<li id="billing_info" data-bind="fadeVisible: isVisible">
    <div class="step-title" data-bind="i18n: 'Billing Info'" data-role="title"></div>
    <div id="checkout-step-billing"
         class="checkout-shipping-method"
         data-role="content">

        <div id="billing-form" class="step-content" data-role="content">
            <!-- ko foreach: getRegion('billing-form-container') -->
            <!-- ko template: getTemplate() --><!-- /ko -->
            <!--/ko-->
        </div>

        <form data-bind="submit: navigateToNextStep" novalidate="novalidate">
            <div class="actions-toolbar">
                <div class="primary">
                    <button data-role="opc-continue" type="submit" class="button action continue primary">
                        <span><!-- ko i18n: 'Next'--><!-- /ko --></span>
                    </button>
                </div>
            </div>
        </form>
    </div>
</li>

As you know, all checkout steps let knockout to retrieve fields dynamically and this is not the exception.

This is the checkout_index_index.xml file:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <!-- The new step you add -->
                                        <item name="billingstep" xsi:type="array">
                                            <item name="component" xsi:type="string">Example_Checkout/js/view/billing-information-step</item>
                                            <!--To display step content before shipping step "sortOrder" value should be < 1-->
                                            <!--To display step content between shipping step and payment step  1 < "sortOrder" < 2 -->
                                            <!--To display step content after payment step "sortOrder" > 2 -->
                                            <item name="sortOrder" xsi:type="string">2</item>
                                            <item name="children" xsi:type="array">  
                                                <item name="billing-form-container" xsi:type="array">
                                                    <!-- Add this item to configure your js file  -->
                                                    <item name="component" xsi:type="string">Example_Checkout/js/view/billing-information-form</item>
                                                    <item name="displayArea" xsi:type="string">billing-form-fields</item>
                                                    <item name="children" xsi:type="array">
                                                        <!-- Here we will add the form fields  -->
                                                        <item name="text_field" xsi:type="array">
                                                            <item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
                                                            <item name="config" xsi:type="array">
                                                                <!-- customScope is used to group elements within a single form (e.g. they can be validated separately) -->
                                                                <item name="customScope" xsi:type="string">customCheckoutForm</item>
                                                                <item name="template" xsi:type="string">ui/form/field</item>
                                                                <item name="elementTmpl" xsi:type="string">ui/form/element/input</item>
                                                            </item>
                                                            <item name="provider" xsi:type="string">checkoutProvider</item>
                                                            <item name="dataScope" xsi:type="string">customCheckoutForm.text_field</item>
                                                            <item name="label" xsi:type="string">Text Field</item>
                                                            <item name="sortOrder" xsi:type="string">1</item>
                                                            <item name="validation" xsi:type="array">
                                                                <item name="required-entry" xsi:type="string">true</item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

The new step is shown, but the form is not placed in it.

Thanks
Jaime

hash map – Is there a more idiomatic way to process these strings?

New Scala dev here:

Is there a more idiomatic or efficient way to accomplish this in Scala?

Given a list of the following strings, I need to obtain the unique ‘main parts’ once any parts including and after a “-” have been removed.

The output should be a list of sorted strings. Also note both “;” and “,” have been used as separators.

Input:

val data: List(String) = List(
  "W22; O21; B112-WX00BK; G211; B112-WI00BK; G11",
  "W22; K122l; B112-WI00BK; O21; B112-WX00BK; G211",
  "W21, V32",
  "W21, N722",
  "S133-VU3150; S133-SU3150; R22-VK3150; R123-VH3"
)   

Desired Output:

List(
    B112 G11 G211 O21 W22,
    B112 G211 K122l O21 W22,
    V32 W21,
    N722 W21,
    R123 R22 S133
)

My solution:

def process(input: String): String =
    input.split(" ").map(word => {
        if (word contains "-")
            word.take(word.indexOf("-"))
        else word
        .replace(";", "").replace(",","")}).toSet.toList.sorted.mkString(" ")

val result: List(String) = data.map(process(_))

How to insert a pause in Photoshop batch process?

I am editing photos with a batch process in Photoshop with autosave turned off. When I go through the photos, I cannot actually preview the changes because it closes too fast. Is there a way to tell the batch process to pause or wait so the editor can view the changes as they go through the stack of images?

photoshop – Insert pause in batch process

I am editing photos with a batch process with autosave turned off. When I go through the photos, I cannot actually preview the changes, it closes so fast. Is there a way to tell the batch process to pause or wait so the editor can view the changes as they go through the stack of images?

computer networks – Why is TCP known as reliable process?

TCP is said to be reliable because when an application receives data, it knows that this is exactly the data that the sender sent. No part of the data was lost, reordered, etc.

Error control is the part of TCP that deals with ensuring the reliability of connections. For example, if the sender sends two packets A and B and the receiver received only B, the TCP implementation on the receiver side will wait a little in case A took longer than B to arrive. If A finally arrives, the receiver will release A to the application before B. If A doesn’t arrive after a while, the receiver will transmit a request to the sender to retransmit A. (I am simplifying somewhat, see the specification for details.)

This is not related to congestion and flow control. They help the performance of the network, but they aren’t needed or helpful to make a connection reliable.

bootloader – How factory reset process looks in details?

So I tried to find answer for this question, but it is very hard to find something other than simple instruction of doing factory reset and backuping data.

I’m interested of detailed process of the factory reset.
When I force system to do this, what is going under the shell.
It is some image on hidden partition from bootloader boots “clear” system? Or maybe it’s just deleting user configuration files, and every corrupted system file states same as before reset. Or maybe there is the way of checking hash of critical files and repair them from some kind of recovery image?