Google Drive – Manage apps only – Show product option

To have a complete machine learning environment, I created a new email specifically for Data Science to use the Google drive just for that purpose. However, when I went to Google Drive / Settings / Manage Apps, I was shown that Google colLab is already connected, but it doesn't appear in the Apps drop-down menu, it only shows this option – show product page, no disconnect options connection, I have searched a lot of documentation, even if it is automatically new emails, so that I could not find a resource. I am disappointed, by the way, that Google has not published a solution to this problem. What can I do?

Sound – What is the best option to run AmpliTube on Ubuntu Studio?

I want to use AmpliTube on my PC, but there are many problems when using it with wine, e.g. with the virtual box do i think much additional latency? Is that correct?

I also cannot find a program with which I can change my interface inputs or adjust the microphone preamplifier. It's an ESP1010 interface if that helps.
I tried using the control panel / driver with wine but it doesn't work at all.

Practical impact of using the / f option in hibernation with the Windows shutdown command?

In various examples on the Internet you can see many calls shutdown /h, but sometimes too shutdown /h /f to do the same thing, put Windows 7/8/10 PC to sleep – i. e. to shutdown the PC without closing running applications,

The shutdown documentation states that the /h The option that is used for hibernation can be used together with the option /f Option (and with no other).

The documentation also includes the following description of the /f Possibility:

Forces applications to close without warning users. Attention:
Use of / f This option can lead to the loss of unsaved data.

Provided that hibernation "with common sense" only pause applications i can only ask under what circumstances hibernation would really be conclude (Exit) an application. In other words, when exactly does it work? /f The option takes effect when used with shutdown /h? Or is it just a bad wording in the documentation?

Dual Boot – The "Test Ubuntu without installation" option from a bootable USB device with Ubuntu 19.10 suddenly crashes

I'm trying to dual boot my SSD. I installed Windows 10 on one partition and want to install Ubuntu 19.10 on the other.

I created a bootable USB drive with the Ubuntu 19.10 image. When I start my laptop via the USB drive, I choose the "Test Ubuntu without installation" option. The system appears to boot as usual, but it just crashes after 1-2 minutes.

Selecting the "Test Ubuntu Without Installation (Secure Graphics)" option will fix the problem mentioned above. However, when I try to install Ubuntu, the buttons in the window do not appear as they appear off the screen and there is no way I can do it by dragging to make the buttons visible, so I am not using the installation wizard can continue.

My laptop is an MSI with:
i7-8750H 2.20 GHz processor
NVIDIA GeForce GTX 1060 graphics card

How to end the translation of system menu / result / option / attributes into the national language

This picture could help everyone to understand it better

That's the problem

  1. Browser – Chrome Version 79.0.3945.88 (Official Build) (64-Bit)
  2. OS – MacOS High Sierra 10.13.6

What I've tried so far

  • In MacOS language setting in English and region in US
  • In the browser language in English
  • In Google A / C language after English

Now I'm done. Any help in this direction would be appreciated.

How is a text box displayed after clicking Select Option with Ajax?

You can use the Conditional Fields module, which allows you to show / hide fields based on the values ​​of other fields.

From the module description:

You can use conditional fields to manage dependencies between fields. If a field is "dependent", it can only be edited and displayed if the status of the field "dependent" corresponds to the correct condition.

When editing a node (or other entity type that supports fields such as users and categories), the dependent fields are dynamically changed using the status API.

A simple use case would be to define a custom Article Teaser field that only appears when the Hat Teaser check box is selected, but much more complex options are available.

Performance – How do I avoid duplicate code when processing query parameters for an optimally logical option?

I have custom code where I check request parameters for existence and query the database with the model

public function search(Request $request)
{
    $position = $request->get("position") ?? null;
    $location = $request->get("location") ?? null;
    $employment = $request->get("employment") ?? null;

    $jobsBy = null;
    $jobs = null;
    if($position) {
        $jobs = Job::where('title', 'LIKE', '%'.$position.'%');

        if($location) {
            $locations = ();
            if(is_array($location)) {
                foreach ($location as $name) {
                    $locations() = $name;
                }
            } else $locations() = $location;
            $jobs = $jobs->whereMetaIn("location", $locations);
        }

        if($employment) {
            $employments = ();
            if(is_array($employment)) {
                foreach ($employment as $name) {
                    $employments() = $name;
                }
            } else $employments() = $employment;
            $jobs = $jobs->withAnyTag($employments);
        }

        if($jobs->get()->count()) $jobsBy = "position";
    }
    if($location && $jobsBy === null) {
        $locations = ();
        if(is_array($location)) {
            foreach ($location as $name) {
                $locations() = $name;
            }
        } else $locations() = $location;
        $jobs = Job::whereMetaIn('location', $locations);

        if($employment) {
            $employments = ();
            if(is_array($employment)) {
                foreach ($employment as $name) {
                    $employments() = $name;
                }
            } else $employments() = $employment;
            $jobs = $jobs->withAnyTag($employments);
        }

        if($jobs->get()->count()) $jobsBy = "location";
    }
    if($employment && $jobsBy === null) {
        $employments = ();
        if(is_array($employment)) {
            foreach ($employment as $name) {
                $employments() = $name;
            }
        } else $employments() = $employment;
        $jobs = Job::withAnyTag($employments);

        if($jobs->get()->count()) $jobsBy = "employment";
    }

    if($jobs == null || !$jobs->get()->count()) {
        $jobs = Job::where("status", '<', 2);
        $jobsBy = "latest";
    }

    if(isset($jobs) && $jobs instanceof IlluminateDatabaseEloquentBuilder && $jobsBy != null) {
        $IDS = $jobs->where('status', '<', 2)->pluck('id');

        $partnerCompanyJobs = Job::with(('user' => function($user) {
            $user->without('roles', 'companies')
                 ->select('id', 'name');
        }))->withCount('views')->where('type', 0)
                               ->whereIn('id', $IDS)
                               ->where('status', 1)
                               ->orderBy('updated_at', 'DESC')
                               ->get();

        $companyJobs = Job::with(('user' => function($user) {
            $user->without('roles', 'companies')
                 ->select('id', 'name');
        }))->withCount('views')->where('type', 1)
                               ->where('status', 1)
                               ->whereIn('id', $IDS)
                               ->orderBy('updated_at', 'DESC')
                               ->get();

        $sampleJobs = Job::with(('user' => function($user) {
            $user->without('roles', 'companies')
                 ->select('id', 'name');
        }))->withCount('views')->where('type', 2)
                               ->where('status', 1)
                               ->whereIn('id', $IDS)
                               ->orderBy('updated_at', 'DESC')
                               ->get();

        $somonJobs = Job::withCount('views')->whereIn('type', (3,4))
                               ->whereIn('id', $IDS)
                               ->where('status', 1)
                               ->orderBy('updated_at', 'DESC')
                               ->get();

        $jobs = $partnerCompanyJobs->merge($companyJobs)
                               ->merge($sampleJobs)
                               ->merge($somonJobs);

        if(count($jobs)) {
            $page = $request->page ?? 1;
            $items = $jobs->forPage($page, 5);
            return response()->json((          
                'data' => JobResource::collection($items),
                'total' => count($jobs),
                'jobsBy' => $jobsBy
            ));
        }
    }

    return response()->json((          
        'data' => (),
        'total' => 0,
        'jobsBy' => ""
    ));
}

How can I avoid duplicating the code here and create an optimal database query in my case? I have a problem processing request parameters. Because of this, a lot is duplicated in my code. How can I fix such a case?

python – Optimize the option price code

I am new to Python and am trying to tweak the following code:

import sys
import numpy as np

def LSMPut(T, r, sigma, K, S0, TimeSteps, Paths, k):
    dt = T/TimeSteps
    t = np.arange(0, T+dt, dt).tolist()

    z=(np.random.standard_normal() for _ in range(Paths))
    w = (r-sigma**2/2)*T + sigma*np.sqrt(T)*np.array(z)

    S = S0*np.exp(np.array(w))
    P=np.maximum(K-np.array(S),0)

    for i in range(TimeSteps-1, -1, -1):
        z=(np.random.standard_normal() for _ in range(Paths))
        w = t(i)*np.array(w)/t(i+1) + sigma*np.sqrt(dt*t(i)/t(i+1))*np.array(z)

        S = S0*np.exp(np.array(w))
        itmPaths = (index for index,value in enumerate(K-np.array(S)) if value > 0)

        itmS = S(itmPaths)
        Pt = K - np.array(itmS)

        itmDiscP = P(itmPaths)*np.exp(-r*dt)

        A = BasisFunct(itmS, k)
        beta = np.linalg.lstsq(A,itmDiscP)(0)
        C = np.dot(A,beta)

        exPaths = (itmPaths(i) for i, value in enumerate(zip(Pt, C)) if value(0) > value(1))
        restPaths = np.setdiff1d(np.arange(0, Paths-1, 1).tolist(), exPaths) # Rest of the paths

        P(exPaths) = (Pt(i) for i, value in enumerate(zip(Pt, C)) if value(0) > value(1))
        P(restPaths) = np.array(P(restPaths))*np.exp(-r*dt)

        u=np.mean(P*np.exp(-r*dt))

    return u

def BasisFunct(X, k):
    Ones=(1 for _ in range(len(X)))
    if k == 1:
        A = np.column_stack((Ones,1 - np.array(X)))
    elif k == 2:
        A = np.column_stack((Ones,1 - np.array(X),1/2*(2-4*np.array(X) + np.array(X)**2)))
    elif k == 3:
        A = np.column_stack((Ones,1 - np.array(X),1/2*(2-4*np.array(X) + np.array(X)**2), 1/6*(6-18*np.array(X) + 9*np.array(X)**2-np.array(X)**3)))
    elif k == 4:
        A = np.column_stack((Ones,1 - np.array(X),1/2*(2-4*np.array(X) + np.array(X)**2), 1/6*(6-18*np.array(X) + 9*np.array(X)**2-np.array(X)**3),1/24*(24 - 96*np.array(X) + 72*np.array(X)**2 - 16*np.array(X)**3 + np.array(X)**4)))
    elif k == 5:
        A = np.column_stack((Ones,1 - np.array(X),1/2*(2-4*np.array(X) + np.array(X)**2), 1/6*(6-18*np.array(X) + 9*np.array(X)**2-np.array(X)**3),1/24*(24 - 96*np.array(X) + 72*np.array(X)**2 - 16*np.array(X)**3 + np.array(X)**4),1/120*(120-600*np.array(X)+600*np.array(X)**2-200*np.array(X)**3+25*np.array(X)**4-np.array(X)**5)))
    else:
            sys.exit("Too many basis functions requested")
    return A

print(LSMPut(1, 0.06, 0.15, 100, 90, 20, 1000000, 5))

The purpose of the code is to calculate the price of an American put option. The time to run if Paths > 1,000,000 takes a long time, especially when I do a sensitivity analysis. I want to find out if I can optimize the code or speed up processing time. Thank you very much.