javascript: how to create a NodeJS project with babel that supports deconstruction of parameters with default values ​​in the class constructor

Hello, I am creating a project in NodeJS and I will use babel to make the necessary transformations. In this project, I want to use the latest changes proposed in ECMAScript as deconstruction with default values. FORMER:

class Foo {
    constructor({ bar = 'bar' }) {
        this.bar = bar
    }
}

The problem is that even with the @babel/core and the @babel/node installed by calling the command babel-node index.js defined in the "start" script of my package.json, the project presents me with the following error:

TypeError: Cannot read property 'bar' of undefined
    at new Foo (/index.js:4:17)

Could someone tell me what plugin or preset I have to use to be able to use this in NodeJS? I am used to using React projects, but I have never created a project from scratch that accepts this. I tried using presets-react but it still didn't work.

Help?

how to send parameters of different test cases from powershell with Pester

I have a powershell script in azure

Invoke-Pester -Script @{Path = 'C:TuringTestFrida-launcher.ps1'; Parameters = @{frida_process_id = '1655944245'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -OutputFile "frida-results.xml" -OutputFormat "NUnitXML"

which calls another powershell script on the machine where the pipeline runs

param($frida_process_id, $frida_user, $frida_psw)
"current location: $(Get-Location)"
"script root: $PSScriptRoot"
"retrieve available modules"
$modules = Get-Module -list
if ($modules.Name -notcontains 'pester') {
    Install-Module -Name Pester -Force -SkipPublisherCheck
}

#$frida_process_id = $args(0)
#$frida_user = $args(1)
#$frida_psw  = $args(2)



Describe "Suites - Prueba" {

    It "Test Case Script - HEB - FRIDA - eCommerce - 706161449 _ Conexion Exitosa " {

        Start-Process -FilePath "C:TuringAppTuringExpo.exe"  "$frida_process_id $frida_user $frida_psw"  -Wait
        Set-Content -Path TestDrive:log.txt -Value 'I am a file'
        $actual = "Actual value"
        $actual | Should -Be "Actual value" # Test will pass / Assert 
        $actual | Should -Not -Be "Some other value" # Test will pass / Assert Negative 
        # $actual | Should -Be "not actual value"  # Test will fail
        'C:TuringApplog.txt' | Should -Exist
        Set-Content -Path TestDrive:log.txt -Value 'Success'
        'TestDrive:log.txt' | Should -FileContentMatch 'Success' # Test will pass 
    }
}

the problem is that so far I have only had the need to run a single test case but now I need to run a test suite but I don't know how to send the parameters of each test suite
I tried to do it like this

Invoke-Pester -Script @{Path = 'C:TuringTestFrida-launcher.ps1'; Parameters = @{frida_process_id = '807028544'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}
@{frida_process_id = '1354584657'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -OutputFile "frida-results.xml" -OutputFormat "NUnitXML"

but I got this error

"C: Windows System32 WindowsPowerShell v1.0 powershell.exe" -NoLogo
  -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C: agent_work_temp 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1'" At
  C: agent_work_temp 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1: 3
  char: 99
  + … ida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -Outpu …
  + ~ Missing '=' operator after key in hash literal. At
  C: agent_work_temp 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1: 3
  char: 99
  + … ida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -Outpu …
  + ~ The literal hash was incomplete.
      + CategoryInfo: ParserError: (:) (), ParseException
      + FullyQualifiedErrorId: MissingEqualsInHashLiteral

(error) PowerShell exited with code '1'. Finishing: PowerShell Script

any help I appreciate it, thank you very much

algorithms: convert a function with a single parameter into a function with multiple parameters

I have been solving some questions about algorithms recently and a pattern that I have observed in some problems is the following:

Given a string or list, perform an aggregation operation on each of its elements. Here in each of these elements we apply some recurrence to solve it.

An example of one of these problems is below.


Issue: Dice n integers return the total number of binary search trees that can be formed using the n integers

To solve this problem, I define a recurrence relationship as follows:

f(n) = 1 // if n = 0
f(n) = ∑ f(i) * f(n-i-1) where 0 <= i <= n-1

This works and I get the correct answer, however, I want to modify the function a bit.

Instead of expressing the function in terms of f(n) I want to express it in terms of f(n, i) So you can delete the summary. However, I can't do it correctly.


Code

My code to solve the problem by defining recurrence in terms of f (n) is as follows: (I am aware that DP can optimize it, but that is not what I am trying to do here)

public int f(int n) {
    if(n == 0)
        return 1;

    int result = 0;
    for(int i = 0; i< n; i++)
        result += f(i) * f(n-i-1);
    return result;
}

I want to remove that for the loop and instead express the function in terms of f(n,i) instead of f(n).


Question

  1. How to convert the recurrence shown above f(n) to f(n,i) and delete the summary?
    • Here & # 39; n & # 39; is the size of the list of elements e & # 39; i & # 39; It is the ith element of the list that we choose to be the root of the tree.

null: default reference type parameters that cannot be canceled in C # 8

I was working to update some code to C # 8.0 and found an interesting pattern with default parameters and non-nullable reference types. I am working if it is clear enough for the caller.

Given this pre C # 8.0 code,

Task FooAsync(
   Bar bar = null,
   CancellationToken ct = default)
{
    bar = bar ?? new Bar(); // some sensible default
}

the bar The parameter is marked as one to make it potentially voidable (Bar? bar = null) This would indicate to the caller that they can pass null.

However, if I want to encourage the caller not to pass null For the parameter, I could do something like this in C # 8.0:

Task FooAsync(
   Bar bar = null!,
   CancellationToken ct = default)
{
    bar ?? = new Bar(); // some sensible default
}

Is this a sensible approach to avoid passing null in the parameter? I know that the caller can still do: FooAsync(bar: null!) But that obviously stands out.

nt.number theory – Relations between spectral parameters of automorphic representations

Leave $ pi $ be an automatic representation (say, trivial central character) of $ GL (2) $. Leave $ alpha (p) $ Y $ beta (p) $ denote its spectral parameters in place $ p $, that is, the associated local L function takes the form
$$ L_p (s, pi) = (1- alpha (p) p ^ – s) -1 – (1-? (P) p ^ – s) ^ {-1) . $$

Using the expression of $ L (s, pi) $ as a Dirichlet series $ sum_n
c_n n ^ {- s} $
and Hecke's relationships, I can deduce the usual relationships

$$ alpha (p) + beta (p) = c_p qquad text {y} qquad alpha (p) ^ 2 + beta (p) ^ 2 = c_ {p ^ 2} – 1. $ $

Is there a similar relationship for parameters and spectral coefficients in the case of "twisted", such as
$$ alpha (p_1) alpha (p_2) + beta (p_1) beta (p_2) qquad text {o} qquad alpha (p_1) ^ {v_1} beta (p_2) ^ {v_2} + alpha (p_2) ^ {v_1} beta (p_1) ^ {v_2} $$

for some powers $ v_i $even $ 1 $ or $ 2 $? I have no idea how to get it from the L functions or other arguments (symmetric square or Rankin-Selberg?).

ssrs: is it possible to create a master report with 4 subreports and the master report and subreports have different parameters?

I have 4 reports that I run with different parameters. Each report creates a table.

I want to create a master report that contains the 4 reports.

The problem is that I don't know how to show the parameters for the subreports other than those shown in the master report

Is there any way to do that in a report?

Sorry for my poor English. I hope you can understand my question

computer vision: how to automatically detect the intrinsic parameters of the camera with a single grid?

Thank you for contributing a response to Computer Science Stack Exchange!

  • Please make sure answer the question. Provide details and share your research!

But avoid

  • Ask for help, clarifications or respond to other answers.
  • Make statements based on opinion; Support them with references or personal experience.

Use MathJax to format equations. MathJax reference.

For more information, see our tips on how to write excellent answers.

javascript: XSS demo reflected with GET parameters and URL encoding

A customer is developing a website that is vulnerable to XSS reflected through a GET parameter:

https://example.com/vulnerable-url?")||true)alert("XSS");

I would like to demonstrate this vulnerability by providing a link like the one above but the text contains characters (such as ") which are URLs encoded by a browser, which results in an invalid unsuccessful script.
I also discovered that using a form within HTML to make a GET request also results in the URL encoding of the payload chain.

However, I can use the BurpSuite proxy to make the request without URL encoding, which results in the execution of the script.

I would like to demonstrate the script using only a browser available in the client environment. Any ideas on how this could be achieved?

.net: incorrect output to call with invalid parameters

Hi

I am creating a web API in .NET.

I have the following route defined in the controller:

(HttpPost("/bulk/compras"))
(ProducesResponseType(typeof(IEnumerable), 200))
public async Task GetBulkCompras((FromBody)string() ids)
{
    var result = await manager.GetBulkCompras(ids).ConfigureAwait(false);

    return Ok(result);
}

Is there any way to control the response if the input is not an array of strings?

Some tests:

one)

Body: (123123123)

Returns:
404

{
  "Code": "BUY_ERROR",
  "Message": "Compra nao encontrada."
}

It means that I converted the integers into strings. I do not know why…

two)

Body: (sdcsdcsdc)

Returns:
400

{
  "": (
    "The input was not valid.",
    "The input was not valid."
  )
}

Why repeated? With a matrix? I do not understand what happens to return an array with a duplicate value.

I would like that if the entry is not a set of strings, the answer was simply: "The entry was not valid."

Any ideas?

Fit: Mathematica is slow to estimate the parameters of the vector autoregressive model

I have been trying to get the parameters of the VAR model using EstimatedProcess and FindProcessParameters. It seems to take a long time as soon as I have more than 6 or 7 time series and a delay length> 2.

The data I am using is the daily return record z of financial time series, with around 1000 data points.

It works well for up to 8 series with delay 2 and only up to 6 series with delay 3 (it takes 15 minutes for the last one). All of the above does not seem to work or is really slow. EstimatedProcess has been running for 3 hours for a VAR process p = 3 with 7 time series.

I have also tried this on data that I simulated using ARProcess and the problem is the same, it takes a long time and above a certain number of series and length of delay does not return results (unless I have not waited long enough).

Any help would be highly appreciated.