问:
How to separate functional logic and user interface when getting data
In the application, I get data on the user by clicking on the button. I use Axios for this. Now the problem is that I need to move the logic of getting data into a separate file. How can i do this? In the App component I use createContext and pass the user change function to the button and in the other component I need to display the username when clicked. I can't figure out how to properly separate the logic for getting data into a separate service.js file

//App.js
export const AppContext = createContext();

function App() {
  const [userInfo, setUserInfo] = useState();
  const value = { userInfo, setUserInfo };
  return (

      <AppContext.Provider value={value}>
        <User/>
      </AppContext.Provider>

  );
}

//NextButton.js

const NextButton = () => {
  const handleUser = () => {
    getUser();
  };
  return <button onClick={handleCharacter}>NEXT</button>;
};

//User.js
const User = () => {
const { userInfo } = useContext(AppContext);
  return (
    <>
      <NextButton />

{characterInfo}

    </>
  );
};```
</div>
</div>
</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>//services.js

export default function getUser() {
  axios.get("https://api/user/1/").then((res) => {
    console.log(res.data.name);
  });
}</code>```

Body:
In the application, I get data on the user by clicking on the button. I use Axios for this. Now the problem is that I need to move the logic of getting data into a separate file. How can i do this? In the App component I use createContext and pass the user change function to the button and in the other component I need to display the username when clicked. I can't figure out how to properly separate the logic for getting data into a separate service.js file

//App.js
export const AppContext = createContext();

function App() {
  const [userInfo, setUserInfo] = useState();
  const value = { userInfo, setUserInfo };
  return (

      <AppContext.Provider value={value}>
        <User/>
      </AppContext.Provider>

  );
}

//NextButton.js

const NextButton = () => {
  const handleUser = () => {
    getUser();
  };
  return <button onClick={handleCharacter}>NEXT</button>;
};

//User.js
const User = () => {
const { userInfo } = useContext(AppContext);
  return (
    <>
      <NextButton />

{characterInfo}

    </>
  );
};

//services.js

export default function getUser() {
  axios.get("https://api/user/1/").then((res) => {
    console.log(res.data.name);
  });
}


来源: stackexchange

问:
My custom error page is not used when errors occur in the production environment
I have configured my ASP.NET Core Razor Pages project to use custom Error.cshtml page.

```<code>if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseHsts();
}
</code>```

And inside that page's code behind, I get the exception and put it inside a public property, and in the razor view, I render information related to that error.

However, when an error occurs in the production mode, I just see a string representation of my exception.

Even if I view page source, I just see a simple string returned from the server.

Why is it so? What should I do?

ContentLicense: CC BY-SA 4.0

Body:
I have configured my ASP.NET Core Razor Pages project to use custom Error.cshtml page.

if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseHsts();
}

And inside that page's code behind, I get the exception and put it inside a public property, and in the razor view, I render information related to that error.

However, when an error occurs in the production mode, I just see a string representation of my exception.

Even if I view page source, I just see a simple string returned from the server.

Why is it so? What should I do?


问:
How can I create a secure application-database connection?
Introduction :
I have a desktop application (.net framework 4.8.2 winform) and successfully connected to MSSQL. But I am afraid that the connection string in the application will be decompiled because it contains all the confidential information of the database. I will use the application I made for a private school project (for students), so I will distribute it.

What I want :
I want to extract data securely from my MSSQL database by connecting to the database via a desktop program.

What I have :
I have a website and hosting provider.

I've seen similar questions to my question on Stackoverflow, but unfortunately, the questions could not be answered.

In short, what should I do? I will continue my research according to the answer given because unfortunately, I am stuck... Thank you.


问:
Automate Azure SSO AD integration with snowflake
I want to automate azure single sign on with snowflake as described in below article using python :-

https://community.snowflake.com/s/article/HOW-TO-Setup-SSO-with-Azure-AD-and-the-Snowflake-New-URL-Format-or-Privatelink

I have got the microsoft graph api for the same.

https://learn.microsoft.com/en-us/graph/application-saml-sso-configure-api?tabs=http%2Cpowershell-script

However, I find it difficult to code the same scenario in python. Could anyone please help with this.


问:
MSVC compiler generates ineffective code for unrolled loop with pointer comparison
MSVC compiler generates ineffective code if we have the loop with more than 2 unrolled iterations and pointer comparison.

MSVC compiler inserts one unnecessary instruction in loop to work with pointer comparison.
It changes pointer before loop, and then it inserts unnecessary LEA instruction in loop to restore pointer value for pointer comparison.

```<code>msvc compiler for x86 (32-bit):
-O2 -arch:IA32

void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a[2]++;
    a[3]++;
    a += 4;
  }
  while (a != stop);
}

void proc(unsigned int *,unsigned int *) PROC                             ; proc, COMDAT
        mov     eax, DWORD PTR _a$[esp-4]
        mov     edx, DWORD PTR _stop$[esp-4]
        add     eax, 8
        npad    5
$LL4@proc:
        inc     DWORD PTR [eax-8]
        lea     eax, DWORD PTR [eax+16]
        inc     DWORD PTR [eax-20]
        lea     ecx, DWORD PTR [eax-8]
        inc     DWORD PTR [eax-16]
        inc     DWORD PTR [eax-12]
        cmp     ecx, edx
        jne     SHORT $LL4@proc
        ret     0

</code>```

There is same behavior for any other loops including AVX or SSE loops, if there are more than 2 unrolled iterations and pointer comparison for loop exit.

Is there any reason for that weired behavior of compiler?
And is there any way to fix it?

The code with counter can be more effective with MSVC than code with pointer comparison.
But another compilers can generate optimal code for such loops with
pointer comparison.

Only if there are 1 or 2 unrolled iterations, then the generated code is optimal:

```<code>void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a += 2;
  }
  while (a != stop);
}
_a$ = 8                                       ; size = 4
_stop$ = 12                                   ; size = 4
_proc   PROC                                      ; COMDAT
        mov     ecx, DWORD PTR _stop$[esp-4]
        mov     eax, DWORD PTR _a$[esp-4]
$LL4@proc:
        inc     DWORD PTR [eax]
        inc     DWORD PTR [eax+4]
        add     eax, 8
        cmp     eax, ecx
        jne     SHORT $LL4@proc
        ret     0
_proc   ENDP
</code>```

Another example with more pressure for ALU resource:

https://godbolt.org/z/ccGvTsWM9

```<code>unsigned Sum(unsigned *a, unsigned *stop)
{
  unsigned sum = 0;
  do {
    sum += a[0] + a[1] + a[2] + a[3];
    a += 4;
  }
  while (a != stop);
  return sum;
}

        mov     ecx, DWORD PTR _a$[esp-4]
        xor     eax, eax
        push    esi
        mov     esi, DWORD PTR _stop$[esp]
        add     ecx, 8
        npad    2
$LL4@Sum:
        mov     edx, DWORD PTR [ecx-8]
        lea     ecx, DWORD PTR [ecx+16]
        add     edx, DWORD PTR [ecx-20]
        add     edx, DWORD PTR [ecx-12]
        add     edx, DWORD PTR [ecx-16]
        add     eax, edx
        lea     edx, DWORD PTR [ecx-8]
        cmp     edx, esi
        jne     SHORT $LL4@Sum
        pop     esi
        ret     0
</code>```

UPDATE:
Workaround for that problem is to update pointer several times per one loop iteration. In that case MSVS creates smaller code without two LEA instructions. The speed looks the same in my tests. Probably best pointer step is 2, because msvc for arm64 uses ldp / stp instructions in another loops if pointer_step==2, and it doesn't use ldp / stp if pointer_step==1.

```<code>void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a += 2;
    a[0]++;
    a[1]++;
    a += 2;
  }
  while (a != stop);
}

; proc, COMDAT
        mov     ecx, DWORD PTR _stop$[esp-4]
        mov     eax, DWORD PTR _a$[esp-4]
$LL4@proc:
        inc     DWORD PTR [eax]
        inc     DWORD PTR [eax+4]
        inc     DWORD PTR [eax+8]
        inc     DWORD PTR [eax+12]
        add     eax, 16                             ; 00000010H
        cmp     eax, ecx
        jne     SHORT $LL4@proc
        ret     0
</code>```

Body:
MSVC compiler generates ineffective code if we have the loop with more than 2 unrolled iterations and pointer comparison.

MSVC compiler inserts one unnecessary instruction in loop to work with pointer comparison.
It changes pointer before loop, and then it inserts unnecessary LEA instruction in loop to restore pointer value for pointer comparison.

msvc compiler for x86 (32-bit):
-O2 -arch:IA32

void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a[2]++;
    a[3]++;
    a += 4;
  }
  while (a != stop);
}

void proc(unsigned int *,unsigned int *) PROC                             ; proc, COMDAT
        mov     eax, DWORD PTR _a$[esp-4]
        mov     edx, DWORD PTR _stop$[esp-4]
        add     eax, 8
        npad    5
$LL4@proc:
        inc     DWORD PTR [eax-8]
        lea     eax, DWORD PTR [eax+16]
        inc     DWORD PTR [eax-20]
        lea     ecx, DWORD PTR [eax-8]
        inc     DWORD PTR [eax-16]
        inc     DWORD PTR [eax-12]
        cmp     ecx, edx
        jne     SHORT $LL4@proc
        ret     0

There is same behavior for any other loops including AVX or SSE loops, if there are more than 2 unrolled iterations and pointer comparison for loop exit.

Is there any reason for that weired behavior of compiler?
And is there any way to fix it?

The code with counter can be more effective with MSVC than code with pointer comparison.
But another compilers can generate optimal code for such loops with
pointer comparison.

Only if there are 1 or 2 unrolled iterations, then the generated code is optimal:

void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a += 2;
  }
  while (a != stop);
}
_a$ = 8                                       ; size = 4
_stop$ = 12                                   ; size = 4
_proc   PROC                                      ; COMDAT
        mov     ecx, DWORD PTR _stop$[esp-4]
        mov     eax, DWORD PTR _a$[esp-4]
$LL4@proc:
        inc     DWORD PTR [eax]
        inc     DWORD PTR [eax+4]
        add     eax, 8
        cmp     eax, ecx
        jne     SHORT $LL4@proc
        ret     0
_proc   ENDP

Another example with more pressure for ALU resource:

https://godbolt.org/z/ccGvTsWM9

unsigned Sum(unsigned *a, unsigned *stop)
{
  unsigned sum = 0;
  do {
    sum += a[0] + a[1] + a[2] + a[3];
    a += 4;
  }
  while (a != stop);
  return sum;
}

        mov     ecx, DWORD PTR _a$[esp-4]
        xor     eax, eax
        push    esi
        mov     esi, DWORD PTR _stop$[esp]
        add     ecx, 8
        npad    2
$LL4@Sum:
        mov     edx, DWORD PTR [ecx-8]
        lea     ecx, DWORD PTR [ecx+16]
        add     edx, DWORD PTR [ecx-20]
        add     edx, DWORD PTR [ecx-12]
        add     edx, DWORD PTR [ecx-16]
        add     eax, edx
        lea     edx, DWORD PTR [ecx-8]
        cmp     edx, esi
        jne     SHORT $LL4@Sum
        pop     esi
        ret     0

UPDATE:
Workaround for that problem is to update pointer several times per one loop iteration. In that case MSVS creates smaller code without two LEA instructions. The speed looks the same in my tests. Probably best pointer step is 2, because msvc for arm64 uses ldp / stp instructions in another loops if pointer_step==2, and it doesn't use ldp / stp if pointer_step==1.

void proc(unsigned *a, unsigned *stop)
{
  do {
    a[0]++;
    a[1]++;
    a += 2;
    a[0]++;
    a[1]++;
    a += 2;
  }
  while (a != stop);
}

; proc, COMDAT
        mov     ecx, DWORD PTR _stop$[esp-4]
        mov     eax, DWORD PTR _a$[esp-4]
$LL4@proc:
        inc     DWORD PTR [eax]
        inc     DWORD PTR [eax+4]
        inc     DWORD PTR [eax+8]
        inc     DWORD PTR [eax+12]
        add     eax, 16                             ; 00000010H
        cmp     eax, ecx
        jne     SHORT $LL4@proc
        ret     0


问:
How to write a Datadog monitor cardinality service to exclude AWS, GCP, and Azure services
I am working in a Datadog environment working with Datasource from Salesforce, AWS, GCP, and Azure services, I need to create a Datadog monitor for Logs with cardinality, that excludes
(using a filter) other services than Salesforce, but after creating the Monitor Query the services such as   AWS, GCP, and Azure are still appearing in the Query result.

I wrote this Datadog cardinality Monitor Log Query

 log("(cardinality:@activity.session_id[@log_stream.file_prefix:orderinfo @ordererror:true @service:salesforce.commerce.cloud] / cardinality:@activity. session_id[@log_stream.file_prefix:orderinfo @service:salesforce.commerce.cloud]) * 100"). last("5m") >= 40

the AWS, GCP, and Azure services were not excluded from the Query result.

I do need help

Gone through documentation


问:
Laravel9 Query using search is using all rows in table after filtering
I have a table which filters by the logged in user and the table has a search bar, however when i use the search it's ignoring the user and filtering all the records. My code as follows:

```<code>    /**
     * @param Request $request
     * @return array
     */
    public static function getDesktopJson(Request $request): array
    {
        $sortColumns = array(
            0 => 'number',
            1 => 'clients.title',
            2 => 'jobs.title',
            3 => 'time',
            4 => 'proof_deadline',
            5 => 'artwork_deadline',
            6 => 'final_deadline',
            7 => 'eclipse-contact',
            8 => 'progress',
            9 => 'actions',
        );

        try {
            $query = Job::select( 'jobs.*' )
                ->whereHas( 'jobUserItems', fn( $qry ) => $qry->where( 'user_id', auth()->id() ) )
                ->where( 'is_active', 1 )
                ->where( 'is_complete', 0 );

            $searchFields = ['clients.title', 'jobs.title', 'number'];
            $with         = ['client'];

            [$query, $json] = getDataSourceQuery( $query, $request, $with, $sortColumns, $searchFields );

            $jobs = $query->get();

        } catch ( RecordsNotFoundException $e ) {
            $jobs = [];
        }

        foreach ($jobs as $job) {
            $json['data'][] = [
                '<a href="job/' . $job->number . '/show">#' . sprintf( '%07d', $job->number ) . '</a>',
                $job->client->title,
                $job->title,
                $job->getTimeChart( auth()->user()->work_group ),
                $job->proof_deadline,
                $job->artwork_deadline,
                $job->final_deadline,
                $job->getEclipseContact(),
                $job->getJobStateValue( false ),
                '<a href="/job/' . $job->number . '/show">' . config( 'ecl.EDIT' ) . '</a>'
            ];
        }

        return $json;
    }
</code>```

the getDataSourceQuery function is in a helpers.php file (it is shared with other tables)

```<code>/**
 * @param Builder|HasManyThrough $query
 * @param Request $request
 * @param array $with
 * @param array $sortColumns
 * @param array $searchFields
 * @return array
 */
function getDataSourceQuery(Builder|HasManyThrough $query,
                            Request $request,
                            array   $with,
                            array   $sortColumns,
                            array   $searchFields
) :array
{
    $total = $query->count();
    $search = $request->query('search', array('value' => '', 'regex' => false));
    $draw = $request->query('draw', 0);
    $start = $request->query('start', 0);
    $length = $request->query('length', 25);
    $order = $request->query('order', [['column' => 0, 'dir' => 'asc']]);

    $column = $sortColumns[$order[0]['column']];
    $dir    = $order[0]['dir'];

    $filter = $search['value'];

    if ( !in_array($column, $searchFields, true) || empty( $filter ) ) {
        addJoin($column, $query);
    }

    if (!empty($filter)) {
        foreach ( $searchFields as $index => $field ) {
            addJoin( $field, $query );
            if ( $index === 0 ) {
                $query->where($field, 'like', '%' . $filter . '%');
            } else {
                $query->orWhere($field, 'like', '%' . $filter . '%');
            }
        }
    }

    $qry = $query->toSql();

    $count = $query->count();

    $query->orderBy($column, $dir)
        ->with( $with )
        ->take($length)
        ->skip($start);

//    $qry = $query->toSql();
//    $bindings = $query->getBindings();

    $json = array(
        'draw' => $draw,
        'recordsTotal' => $total,
        'recordsFiltered' => $count,
        'data' => [],
    );

    return [$query, $json];
}
</code>```

and the addJoin function in the helpers.php file is:

```<code>/**
 * @param mixed $column
 * @param HasManyThrough|Builder $query
 * @return void
 */
function addJoin(mixed $column, HasManyThrough|Builder $query): void
{
    if (str_contains($column, '.')) {
        $boom = explode('.', $column);
        $table = $query->getModel()->getTable();
        if ( $boom[0] !== $table ) {
            if ($boom[0] === 'invoices' || $boom[0] === 'jobs') {
                $iid = 'number';
            } else {
                $iid = 'id';
            }

            if ($table === 'jobs' || $table === 'invoices' || $table === 'subscriptions') {
                $id = 'client_id';
            } else {
                $id = 'id';
            }
            $query->join($boom[0], $table . '.' . $id, '=', $boom[0] . '.' . $iid);
        }
    }

}
</code>```

If the search is unused the correct number of rows are returned (say this is 15) as soon as I enter a search term in the search bar it uses all 1000+ records.

I'm using datatables.net (https://datatables.net/manual/index) for the table.

thanks

Body:
I have a table which filters by the logged in user and the table has a search bar, however when i use the search it's ignoring the user and filtering all the records. My code as follows:

    /**
     * @param Request $request
     * @return array
     */
    public static function getDesktopJson(Request $request): array
    {
        $sortColumns = array(
            0 => 'number',
            1 => 'clients.title',
            2 => 'jobs.title',
            3 => 'time',
            4 => 'proof_deadline',
            5 => 'artwork_deadline',
            6 => 'final_deadline',
            7 => 'eclipse-contact',
            8 => 'progress',
            9 => 'actions',
        );

        try {
            $query = Job::select( 'jobs.*' )
                ->whereHas( 'jobUserItems', fn( $qry ) => $qry->where( 'user_id', auth()->id() ) )
                ->where( 'is_active', 1 )
                ->where( 'is_complete', 0 );

            $searchFields = ['clients.title', 'jobs.title', 'number'];
            $with         = ['client'];

            [$query, $json] = getDataSourceQuery( $query, $request, $with, $sortColumns, $searchFields );

            $jobs = $query->get();

        } catch ( RecordsNotFoundException $e ) {
            $jobs = [];
        }

        foreach ($jobs as $job) {
            $json['data'][] = [
                'number . '/show">#' . sprintf( '%07d', $job->number ) . '',
                $job->client->title,
                $job->title,
                $job->getTimeChart( auth()->user()->work_group ),
                $job->proof_deadline,
                $job->artwork_deadline,
                $job->final_deadline,
                $job->getEclipseContact(),
                $job->getJobStateValue( false ),
                'number . '/show">' . config( 'ecl.EDIT' ) . ''
            ];
        }

        return $json;
    }

the getDataSourceQuery function is in a helpers.php file (it is shared with other tables)

/**
 * @param Builder|HasManyThrough $query
 * @param Request $request
 * @param array $with
 * @param array $sortColumns
 * @param array $searchFields
 * @return array
 */
function getDataSourceQuery(Builder|HasManyThrough $query,
                            Request $request,
                            array   $with,
                            array   $sortColumns,
                            array   $searchFields
) :array
{
    $total = $query->count();
    $search = $request->query('search', array('value' => '', 'regex' => false));
    $draw = $request->query('draw', 0);
    $start = $request->query('start', 0);
    $length = $request->query('length', 25);
    $order = $request->query('order', [['column' => 0, 'dir' => 'asc']]);

    $column = $sortColumns[$order[0]['column']];
    $dir    = $order[0]['dir'];

    $filter = $search['value'];

    if ( !in_array($column, $searchFields, true) || empty( $filter ) ) {
        addJoin($column, $query);
    }

    if (!empty($filter)) {
        foreach ( $searchFields as $index => $field ) {
            addJoin( $field, $query );
            if ( $index === 0 ) {
                $query->where($field, 'like', '%' . $filter . '%');
            } else {
                $query->orWhere($field, 'like', '%' . $filter . '%');
            }
        }
    }

    $qry = $query->toSql();

    $count = $query->count();

    $query->orderBy($column, $dir)
        ->with( $with )
        ->take($length)
        ->skip($start);

//    $qry = $query->toSql();
//    $bindings = $query->getBindings();

    $json = array(
        'draw' => $draw,
        'recordsTotal' => $total,
        'recordsFiltered' => $count,
        'data' => [],
    );

    return [$query, $json];
}

and the addJoin function in the helpers.php file is:

/**
 * @param mixed $column
 * @param HasManyThrough|Builder $query
 * @return void
 */
function addJoin(mixed $column, HasManyThrough|Builder $query): void
{
    if (str_contains($column, '.')) {
        $boom = explode('.', $column);
        $table = $query->getModel()->getTable();
        if ( $boom[0] !== $table ) {
            if ($boom[0] === 'invoices' || $boom[0] === 'jobs') {
                $iid = 'number';
            } else {
                $iid = 'id';
            }

            if ($table === 'jobs' || $table === 'invoices' || $table === 'subscriptions') {
                $id = 'client_id';
            } else {
                $id = 'id';
            }
            $query->join($boom[0], $table . '.' . $id, '=', $boom[0] . '.' . $iid);
        }
    }

}

If the search is unused the correct number of rows are returned (say this is 15) as soon as I enter a search term in the search bar it uses all 1000+ records.

I'm using datatables.net (https://datatables.net/manual/index) for the table.

thanks


问:
geoserver as cascading wmts cache for os maps api is slow for some requests
I've configured geoserver to cascade the OS Maps API wmts service following the excellent article here:

https://blog.ianturton.com/2021/07/22/Cascading-OS-Map-Tiles.html

If I preview the tile layer for this however some initial requests are taking ~4 seconds to complete.

Are there any obvious reasons why the requests maybe taking this long? Is geoserver recalculating the tiles? If so, how can this be avoided?


问:
ValueError: Columns must be same length as key in querycat.Categorize(df_merge_col, 'Keyword', min_lift=10, alg='apriori')
¡Hi! I have a problem when I try to run this code:

https://colab.research.google.com/drive/1T-Jyph_qJ1k3nDX_HQU7YVS_SGrWKsGL#scrollTo=zzCySpzWpTfG

I have the next error:

ValueError: Columns must be same length as key
```
<p>At this line:</p>
<pre class="lang-py prettyprint-override"><code>querycat.Categorize(df_merge_col, 'Keyword', min_lift=10, alg='apriori')
</code>```

Table example about dataframe:
Value df_merge_col

Pic Error:
Error Colab

In the past this code was work, but now doesn't works. Maybe it's for an update or something.

I want to group keywords, maybe I try by other ways =/

Body:
¡Hi! I have a problem when I try to run this code:

https://colab.research.google.com/drive/1T-Jyph_qJ1k3nDX_HQU7YVS_SGrWKsGL#scrollTo=zzCySpzWpTfG

I have the next error:

ValueError: Columns must be same length as key

At this line:

querycat.Categorize(df_merge_col, 'Keyword', min_lift=10, alg='apriori')

Table example about dataframe:
Value df_merge_col

Pic Error:
Error Colab

In the past this code was work, but now doesn't works. Maybe it's for an update or something.

I want to group keywords, maybe I try by other ways =/


问:
Simple-salesforce package does not return expected report
I am using simple_salesforce package in python to be able to get a report from my salesforce account. I am able to login to salesforce successfully with simple_salesforce. However, when I try to download the report (code runs with no errors), I do not get the expected output. Sample code is:

from simple_salesforce import Salesforce
import requests
import pandas as pd
from io import StringIO

sf = Salesforce(username='myusername',
                password='mypassword',
                security_token='mytoken',
                version='46.0')

sf_instance = 'https://companyname.lightning.force.com/' #Your Salesforce Instance URL
reportId = 'myreportid' # add report id
export = '?isdtp=p1&export=1&enc=UTF-8&xf=csv'
sfUrl = sf_instance + reportId + export
response = requests.get(sfUrl, headers=sf.headers, cookies={'sid': sf.session_id})
download_report = response.content.decode('utf-8')
df1 = pd.read_csv(StringIO(download_report))
```
<p>Output for <code>df1</code> is not the expected report:</p>
<pre class="lang-py prettyprint-override"><code>df1.head()
</code>```

output

Is there anything wrong with the code? I am open to suggestions on another strategy to download the report.

Body:
I am using simple_salesforce package in python to be able to get a report from my salesforce account. I am able to login to salesforce successfully with simple_salesforce. However, when I try to download the report (code runs with no errors), I do not get the expected output. Sample code is:

from simple_salesforce import Salesforce
import requests
import pandas as pd
from io import StringIO

sf = Salesforce(username='myusername',
                password='mypassword',
                security_token='mytoken',
                version='46.0')

sf_instance = 'https://companyname.lightning.force.com/' #Your Salesforce Instance URL
reportId = 'myreportid' # add report id
export = '?isdtp=p1&export=1&enc=UTF-8&xf=csv'
sfUrl = sf_instance + reportId + export
response = requests.get(sfUrl, headers=sf.headers, cookies={'sid': sf.session_id})
download_report = response.content.decode('utf-8')
df1 = pd.read_csv(StringIO(download_report))

Output for df1 is not the expected report:

df1.head()

output

Is there anything wrong with the code? I am open to suggestions on another strategy to download the report.


问:
WebGL Application Horizontal Lines Appear when Resizing Buffer Objects
I have a working fluid simulation (written in vanilla webgl) that works great but when the window is resized, the simulation gets a bunch of horizontal lines and glitches until the resize is complete.

here are the resize functions that (i think) are causing the issue:

```<code>export function resizeFBO (target, w, h, internalFormat, format, type, param) {
    let newFBO = createFBO(w, h, internalFormat, format, type, param);
    copyProgram.bind();
    gl.uniform1i(copyProgram.uniforms.uTexture, target.attach(0));
    blit(newFBO);
    return newFBO;
}

export function resizeDoubleFBO (target, w, h, internalFormat, format, type, param) {
    if (target.width == w && target.height == h)
        return target;
    target.read = resizeFBO(target.read, w, h, internalFormat, format, type, param);
    target.write = createFBO(w, h, internalFormat, format, type, param);
    target.width = w;
    target.height = h;
    target.texelSizeX = 1.0 / w;
    target.texelSizeY = 1.0 / h;
    return target;
}

export const copyShader = compileShader(gl.FRAGMENT_SHADER, `
precision mediump float;
precision mediump sampler2D;

varying highp vec2 vUv;
uniform sampler2D uTexture;

void main () {
    gl_FragColor = texture2D(uTexture, vUv);
}
`);
</code>```

for good order, the vertex shader in copyProgram is trival thus not included for brevity (used in other areas working fine). finally my style:

```<code>        <style>
            @font-face {
                font-family: 'iconfont';
                src: url('iconfont.ttf') format('truetype');
            }

            * {
                user-select: none;
            }

            html, body {
                overflow: hidden;
                background-color: #000;
            }

            body {
                margin: 0;
                position: fixed;
                width: 100%;
                height: 100%;
            }

            canvas {
                width: 100%;
                height: 100%;
                display: block;
            }
</code>```

i will note that before refactoring

full code here in case i missed anything (resizeFBO, createFBO, etc in js/WebGL.js file) https://github.com/lakeheck/Fluid-Simulation-WebGL

example of issue (try resizing window to see): https://lakeheck.github.io/Fluid-Simulation-WebGL/

running on chrome Version 108.0.5359.94 (Official Build) (64-bit)

thanks in advance

Have tried to use various css setups, such as display: block and display: inline-block ad using window.innerWidth/Height to pass for resizing instead of canvas dimensions

Body:
I have a working fluid simulation (written in vanilla webgl) that works great but when the window is resized, the simulation gets a bunch of horizontal lines and glitches until the resize is complete.

here are the resize functions that (i think) are causing the issue:

export function resizeFBO (target, w, h, internalFormat, format, type, param) {
    let newFBO = createFBO(w, h, internalFormat, format, type, param);
    copyProgram.bind();
    gl.uniform1i(copyProgram.uniforms.uTexture, target.attach(0));
    blit(newFBO);
    return newFBO;
}

export function resizeDoubleFBO (target, w, h, internalFormat, format, type, param) {
    if (target.width == w && target.height == h)
        return target;
    target.read = resizeFBO(target.read, w, h, internalFormat, format, type, param);
    target.write = createFBO(w, h, internalFormat, format, type, param);
    target.width = w;
    target.height = h;
    target.texelSizeX = 1.0 / w;
    target.texelSizeY = 1.0 / h;
    return target;
}

export const copyShader = compileShader(gl.FRAGMENT_SHADER, `
precision mediump float;
precision mediump sampler2D;

varying highp vec2 vUv;
uniform sampler2D uTexture;

void main () {
    gl_FragColor = texture2D(uTexture, vUv);
}
`);

for good order, the vertex shader in copyProgram is trival thus not included for brevity (used in other areas working fine). finally my style:


问:
Blazor Wasm Hosting on Nginx Ubuntu Server (Not Container)
I have tried to host blazor wasm on  nginx ubuntu server with no luck accssing from other machines apart from localhost, error : Loading...
An unhandled error has occurred. Reload  On inspecting Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR
My current configs for nginx.conf:

```<code>user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    include /etc/nginx/sites-available/*.conf;

        server {
        listen 80;
        listen [::]:80;

        server_name localhost;

        location / {
                root /var/www/Suites/wwwroot;
                try_files $uri $uri/ index.html =404;

                include /etc/nginx/mime.types;
                types {
                        application/wasm wasm;
                }
                default_type application/octet-stream;
        }

}

}

</code>```

I want it to run any other port besides port 100 since am already using that for the web api which is running well.

What am I missing?

I have followed the resource by Microsoft and a few others in this forum but clearly am missing something

Body:
I have tried to host blazor wasm on  nginx ubuntu server with no luck accssing from other machines apart from localhost, error : Loading...
An unhandled error has occurred. Reload  On inspecting Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR
My current configs for nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    include /etc/nginx/sites-available/*.conf;

        server {
        listen 80;
        listen [::]:80;

        server_name localhost;

        location / {
                root /var/www/Suites/wwwroot;
                try_files $uri $uri/ index.html =404;

                include /etc/nginx/mime.types;
                types {
                        application/wasm wasm;
                }
                default_type application/octet-stream;
        }

}

}

I want it to run any other port besides port 100 since am already using that for the web api which is running well.

What am I missing?

I have followed the resource by Microsoft and a few others in this forum but clearly am missing something


问:
how to adjust position of selectViewport in radix react-select?
EXPLANATION OF THE PHOTOS AND CODE BELOW

In the following component (CODE BELOW) I am trying to achieve something like in the screenshot 1 (Where the availableList, the data, is passed from the parent component but it shows an empty space before the data passed) but as soon as I select the data (screenshot 2), and I click again, the drop-down does not show the empty space as I had in the screenshot 1, because I am now in the currentItem -selectItem. By doing what I did in the below code the drop-down is moved up. I am wondering what would be the best strategy to achieve (point 1 in point 3 too) and avoid this movement of the div UP or let it be in place of the actual selection.

```<code>import { FC, useEffect, useState } from 'react';
import {
  Select,
  SelectContent,
  SelectItem,
  SelectItemText,
  SelectPortal,
  SelectScrollUpButton,
  SelectTrigger,
  SelectValue,
  SelectViewport
} from '@radix-ui/react-select';
import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/outline';

import cn from 'classnames';
import { twMerge } from 'tailwind-merge';

interface BatchSelectorClassNames {
  loadingClassName?: string;
  formButtonClassName?: string;
  selectedItemClassName?: string;
  selectContentClassName?: string;
  selectItemListClassName?: string;
  className?: string;
}
export interface SelectChoice {
  value: string;
  label: string;
}

interface Props {
  defaultValue?: string;
  onChange?: (value: string) => void;
  classNames?: BatchSelectorClassNames;
  data: SelectChoice[];
  name?: string;
  disabled?: boolean;
  value?: string;
}

const Selector: FC<Props> = ({
  defaultValue,
  onChange,
  classNames,
  data,
  name,
  disabled,
  value
}) => {
  const [currentItem, setCurrentItem] = useState<SelectChoice | undefined>(
    undefined
  );
  const [availableList, setAvailableList] = useState<SelectChoice[]>([]);
  const [opened, onOpenChange] = useState<boolean>(false);
  const selectTriggerProps = {
    className: twMerge(
      cn(
        'group flex items-center h-12 select-none rounded-lg bg-white px-4 text-left shadow-plain',
        classNames?.className,
        classNames?.formButtonClassName,
        {
          'group hover:shadow-plain-lg cursor-pointer': !disabled,
          'stroke-inpay-black-haze-700 stroke-1.5 group hover:none text-inpay-black-haze-700':
            disabled
        }
      )
    )
  };

  const selectedItemProps = {
    className: twMerge(
      cn(
        'group flex h-12 cursor-pointer items-center px-4 rounded-t-lg outline-offset-[-1px] hover:bg-inpay-green-200 hover:text-inpay-green-700 border-none focus:outline-none',
        classNames?.className,
        classNames?.selectedItemClassName,
        {
          'px-4': disabled
        }
      )
    )
  };

  const selectItemListProps = {
    className: twMerge(
      cn(
        'group h-12 flex items-center cursor-pointer px-4 outline-offset-[-1px] first:rounded-t-lg last:rounded-b-lg hover:bg-inpay-green-200 hover:text-inpay-green-700 border-none focus:outline-none',
        classNames?.className,
        classNames?.selectItemListClassName
      )
    )
  };

  const selectContentProps = {
    className: twMerge(
      cn(
        'relative z-50 select-none overflow-hidden rounded-lg bg-white shadow-plain-lg w-72',
        classNames?.selectContentClassName
      )
    )
  };

  const onValueChange = (value: string) => {
    if (data) {
      const matchingValue = data.find((element) => element.value == value);
      if (matchingValue) {
        setCurrentItem({ ...matchingValue });
        setAvailableList(data.filter((i) => i.value != matchingValue.value));
        onChange && onChange(value);
      }
    }
  };

  useEffect(() => {
    setAvailableList(data);
    setCurrentItem(undefined);
  }, [data]);

  useEffect(() => {
    if (defaultValue) {
      const newValue = data.find((i) => i.value === defaultValue);
      if (newValue) {
        setCurrentItem(newValue);
      } else {
        setCurrentItem(newValue);
      }
      setAvailableList(data.filter((i) => i.value != defaultValue));
    }
  }, [defaultValue, data]);

  return (
    <Select
      onValueChange={onValueChange}
      onOpenChange={onOpenChange}
      name={name}
      disabled={disabled}
      defaultValue={defaultValue || ''}
      value={value}
    >
      <SelectTrigger {...selectTriggerProps}>
        <SelectValue />
      </SelectTrigger>
      <SelectPortal>
        <SelectContent {...selectContentProps}>
          <SelectScrollUpButton className="flex justify-center">
            <ChevronUpIcon className="h-10 w-6 stroke-1.5" />
          </SelectScrollUpButton>
          <SelectViewport>
            {currentItem && (
              <div>
                <SelectItem
                  key={null}
                  disabled
                  value=""
                  {...selectItemListProps}
                >
                  <SelectItemText>
                    <div className="flex">
                      <div className="flex-1"></div>
                      {opened ? (
                        <ChevronUpIcon className="w-1/12 stroke-inpay-black-500 stroke-1.5" />
                      ) : (
                        <ChevronDownIcon
                          className={cn(
                            'w-1/12 stroke-inpay-black-haze-700 stroke-1.5',
                            {
                              'w-1/12 stroke-inpay-black-haze-700 stroke-1.5 group-hover:stroke-inpay-black-500':
                                !disabled
                            }
                          )}
                        />
                      )}
                    </div>
                  </SelectItemText>
                </SelectItem>
                <SelectItem
                  key={currentItem.value}
                  value={currentItem.value}
                  {...selectedItemProps}
                >
                  <SelectItemText>
                    <div className="flex">
                      <div className="flex-1">{currentItem.label}</div>
                    </div>
                  </SelectItemText>
                </SelectItem>
              </div>
            )}
            {!currentItem && (
              <SelectItem key={null} disabled value="" {...selectItemListProps}>
                <SelectItemText>
                  <div className="flex">
                    <div className="flex-1"></div>
                    <ChevronDownIcon className="w-1/12 stroke-inpay-black-500 stroke-1.5" />
                  </div>
                </SelectItemText>
              </SelectItem>
            )}
            {/* {opened && (
              <SelectItem key={null} disabled value="" {...selectItemListProps}>
                <SelectItemText>
                  <div className="flex">
                    <div className="flex-1"></div>
                  </div>
                </SelectItemText>
              </SelectItem>
            )} */}
            {availableList.map((item) => (
              <SelectItem
                key={item.value}
                value={item.value}
                {...selectItemListProps}
              >
                <SelectItemText>
                  <div className="flex">
                    <div className="flex-1">{item.label}</div>
                  </div>
                </SelectItemText>
              </SelectItem>
            ))}
          </SelectViewport>
        </SelectContent>
      </SelectPortal>
    </Select>
  );
};

export default Selector;
</code>```

Body:
EXPLANATION OF THE PHOTOS AND CODE BELOW

In the following component (CODE BELOW) I am trying to achieve something like in the screenshot 1 (Where the availableList, the data, is passed from the parent component but it shows an empty space before the data passed) but as soon as I select the data (screenshot 2), and I click again, the drop-down does not show the empty space as I had in the screenshot 1, because I am now in the currentItem -selectItem. By doing what I did in the below code the drop-down is moved up. I am wondering what would be the best strategy to achieve (point 1 in point 3 too) and avoid this movement of the div UP or let it be in place of the actual selection.

import { FC, useEffect, useState } from 'react';
import {
  Select,
  SelectContent,
  SelectItem,
  SelectItemText,
  SelectPortal,
  SelectScrollUpButton,
  SelectTrigger,
  SelectValue,
  SelectViewport
} from '@radix-ui/react-select';
import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/outline';

import cn from 'classnames';
import { twMerge } from 'tailwind-merge';

interface BatchSelectorClassNames {
  loadingClassName?: string;
  formButtonClassName?: string;
  selectedItemClassName?: string;
  selectContentClassName?: string;
  selectItemListClassName?: string;
  className?: string;
}
export interface SelectChoice {
  value: string;
  label: string;
}

interface Props {
  defaultValue?: string;
  onChange?: (value: string) => void;
  classNames?: BatchSelectorClassNames;
  data: SelectChoice[];
  name?: string;
  disabled?: boolean;
  value?: string;
}

const Selector: FC<Props> = ({
  defaultValue,
  onChange,
  classNames,
  data,
  name,
  disabled,
  value
}) => {
  const [currentItem, setCurrentItem] = useState<SelectChoice | undefined>(
    undefined
  );
  const [availableList, setAvailableList] = useState<SelectChoice[]>([]);
  const [opened, onOpenChange] = useState<boolean>(false);
  const selectTriggerProps = {
    className: twMerge(
      cn(
        'group flex items-center h-12 select-none rounded-lg bg-white px-4 text-left shadow-plain',
        classNames?.className,
        classNames?.formButtonClassName,
        {
          'group hover:shadow-plain-lg cursor-pointer': !disabled,
          'stroke-inpay-black-haze-700 stroke-1.5 group hover:none text-inpay-black-haze-700':
            disabled
        }
      )
    )
  };

  const selectedItemProps = {
    className: twMerge(
      cn(
        'group flex h-12 cursor-pointer items-center px-4 rounded-t-lg outline-offset-[-1px] hover:bg-inpay-green-200 hover:text-inpay-green-700 border-none focus:outline-none',
        classNames?.className,
        classNames?.selectedItemClassName,
        {
          'px-4': disabled
        }
      )
    )
  };

  const selectItemListProps = {
    className: twMerge(
      cn(
        'group h-12 flex items-center cursor-pointer px-4 outline-offset-[-1px] first:rounded-t-lg last:rounded-b-lg hover:bg-inpay-green-200 hover:text-inpay-green-700 border-none focus:outline-none',
        classNames?.className,
        classNames?.selectItemListClassName
      )
    )
  };

  const selectContentProps = {
    className: twMerge(
      cn(
        'relative z-50 select-none overflow-hidden rounded-lg bg-white shadow-plain-lg w-72',
        classNames?.selectContentClassName
      )
    )
  };

  const onValueChange = (value: string) => {
    if (data) {
      const matchingValue = data.find((element) => element.value == value);
      if (matchingValue) {
        setCurrentItem({ ...matchingValue });
        setAvailableList(data.filter((i) => i.value != matchingValue.value));
        onChange && onChange(value);
      }
    }
  };

  useEffect(() => {
    setAvailableList(data);
    setCurrentItem(undefined);
  }, [data]);

  useEffect(() => {
    if (defaultValue) {
      const newValue = data.find((i) => i.value === defaultValue);
      if (newValue) {
        setCurrentItem(newValue);
      } else {
        setCurrentItem(newValue);
      }
      setAvailableList(data.filter((i) => i.value != defaultValue));
    }
  }, [defaultValue, data]);

  return (
    <Select
      onValueChange={onValueChange}
      onOpenChange={onOpenChange}
      name={name}
      disabled={disabled}
      defaultValue={defaultValue || ''}
      value={value}
    >
      <SelectTrigger {...selectTriggerProps}>
        <SelectValue />
      </SelectTrigger>
      <SelectPortal>
        <SelectContent {...selectContentProps}>
          <SelectScrollUpButton className="flex justify-center">
            <ChevronUpIcon className="h-10 w-6 stroke-1.5" />
          </SelectScrollUpButton>
          <SelectViewport>
            {currentItem && (

                <SelectItem
                  key={null}
                  disabled
                  value=""
                  {...selectItemListProps}
                >
                  <SelectItemText>

                      {opened ? (
                        <ChevronUpIcon className="w-1/12 stroke-inpay-black-500 stroke-1.5" />
                      ) : (
                        <ChevronDownIcon
                          className={cn(
                            'w-1/12 stroke-inpay-black-haze-700 stroke-1.5',
                            {
                              'w-1/12 stroke-inpay-black-haze-700 stroke-1.5 group-hover:stroke-inpay-black-500':
                                !disabled
                            }
                          )}
                        />
                      )}

                  </SelectItemText>
                </SelectItem>
                <SelectItem
                  key={currentItem.value}
                  value={currentItem.value}
                  {...selectedItemProps}
                >
                  <SelectItemText>

{currentItem.label}

                  </SelectItemText>
                </SelectItem>

            )}
            {!currentItem && (
              <SelectItem key={null} disabled value="" {...selectItemListProps}>
                <SelectItemText>

                    <ChevronDownIcon className="w-1/12 stroke-inpay-black-500 stroke-1.5" />

                </SelectItemText>
              </SelectItem>
            )}
            {/* {opened && (
              <SelectItem key={null} disabled value="" {...selectItemListProps}>
                <SelectItemText>

                </SelectItemText>
              </SelectItem>
            )} */}
            {availableList.map((item) => (
              <SelectItem
                key={item.value}
                value={item.value}
                {...selectItemListProps}
              >
                <SelectItemText>

{item.label}

                </SelectItemText>
              </SelectItem>
            ))}
          </SelectViewport>
        </SelectContent>
      </SelectPortal>
    </Select>
  );
};

export default Selector;


问:
How to solve an OutOfMemory exception when I load a big number of JSON files in Spark using and HDFS source

The problem:

I have a hdfs source hdfs:///data that contains 500 GB of JSON files.

My executor node memory limit is 64 GB, my Spark version is 3.3.0, and I am running on AWS EMR 6.8.

val df = spark.read.option("recursiveFileLookup","true").json("hdfs:///data")
```
<h1>The issue</h1>
<p>I got an exception when I use this spark command. How do I solve this issue ?</p>
<p>I have just used this command and never executed a side effect such as "save", but I got the memory exception.</p>
<pre class="lang-bash prettyprint-override"><code>#
# java.lang.OutOfMemoryError: GC overhead limit exceeded
# -XX:OnOutOfMemoryError="kill -9 %p"
#   Executing /bin/sh -c "kill -9 4314"...
</code>```

Stack trace:

org.apache.spark.SparkException: Job aborted due to stage failure: Total size of serialized results of 9571 tasks (1024.0 MiB) is bigger than spark.driver.maxResultSize (1024.0 MiB)
  at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:2863)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:2799)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:2798)
  at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
  at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
  at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
  at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:2798)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1(DAGScheduler.scala:1239)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1$adapted(DAGScheduler.scala:1239)
  at scala.Option.foreach(Option.scala:407)
  at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:1239)
  at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:3051)
  at org.apache.spark.scheduler.DAGSchedulerEventProcessLoo
```

Body:
The problem:

I have a hdfs source hdfs:///data that contains 500 GB of JSON files.

My executor node memory limit is 64 GB, my Spark version is 3.3.0, and I am running on AWS EMR 6.8.

val df = spark.read.option("recursiveFileLookup","true").json("hdfs:///data")

The issue

I got an exception when I use this spark command. How do I solve this issue ?

I have just used this command and never executed a side effect such as "save", but I got the memory exception.

#
# java.lang.OutOfMemoryError: GC overhead limit exceeded
# -XX:OnOutOfMemoryError="kill -9 %p"
#   Executing /bin/sh -c "kill -9 4314"...

Stack trace:

org.apache.spark.SparkException: Job aborted due to stage failure: Total size of serialized results of 9571 tasks (1024.0 MiB) is bigger than spark.driver.maxResultSize (1024.0 MiB)
  at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:2863)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:2799)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:2798)
  at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
  at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
  at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
  at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:2798)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1(DAGScheduler.scala:1239)
  at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1$adapted(DAGScheduler.scala:1239)
  at scala.Option.foreach(Option.scala:407)
  at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:1239)
  at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:3051)
  at org.apache.spark.scheduler.DAGSchedulerEventProcessLoo


问:
pd.read_csv only parsing one out of two column dates
I'm trying to read data from a csv and parsing dates but I found this issue in which only one of the columns gets a datetime format and the other one still remains an object.

dtype = {'col1':'category','col2':'category','Start Date':'str','End Date':'str'}
dates = ['col3','col4']
df = pd.read_csv(filepath,dtype=dtype,parse_dates=dates,dayfirst=False)
```
<p>Both date columns have same format.</p>
<p>when I do <code>df.info()</code> I get the following:
df.info() output</p>
<p>I tried using dayfirst input and the formatter but it didn't help.</p>
<p>I expect that both columns in the list would get datetime object but for some reason they aren't.</p>
<p>Update: tried to recreate a minimal reproducible data set by doing the code block below but this is behaving as expected, producing both Start Date and End Date columns as datetime.</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd

df = pd.DataFrame({'col1':['ABC','ABC','DCF','DCF'],
                   'Start Date':['12-31-2022','12-31-2022','12-31-2022','12-31-2022'],
                   'End Date':['12-31-2023','12-31-2023','12-31-2023','12-31-2023']
                  })

df.to_csv('test.csv',index=0)

df2 = pd.read_csv('test.csv',
                  dtype={'col1':'category','Start Date':'str','End Date':'str'},
                  parse_dates = ['Start Date','End Date'],
                  dayfirst=False
                 )
df2.info()
</code>```

Body:
I'm trying to read data from a csv and parsing dates but I found this issue in which only one of the columns gets a datetime format and the other one still remains an object.

dtype = {'col1':'category','col2':'category','Start Date':'str','End Date':'str'}
dates = ['col3','col4']
df = pd.read_csv(filepath,dtype=dtype,parse_dates=dates,dayfirst=False)

Both date columns have same format.

when I do df.info() I get the following:
df.info() output

I tried using dayfirst input and the formatter but it didn't help.

I expect that both columns in the list would get datetime object but for some reason they aren't.

Update: tried to recreate a minimal reproducible data set by doing the code block below but this is behaving as expected, producing both Start Date and End Date columns as datetime.

import pandas as pd

df = pd.DataFrame({'col1':['ABC','ABC','DCF','DCF'],
                   'Start Date':['12-31-2022','12-31-2022','12-31-2022','12-31-2022'],
                   'End Date':['12-31-2023','12-31-2023','12-31-2023','12-31-2023']
                  })

df.to_csv('test.csv',index=0)

df2 = pd.read_csv('test.csv',
                  dtype={'col1':'category','Start Date':'str','End Date':'str'},
                  parse_dates = ['Start Date','End Date'],
                  dayfirst=False
                 )
df2.info()


问:
How can I change Material UI tag component color in IntelliJ?

How can I change Material UI tag component color in IntelliJ?


问:
How can I provide single credential (login) for multiple Zoho Creator cloud data connection in PowerBI?
I am fetching multiple Zoho Creator reports by using built-in cloud data connection in one single PowerBI file.

There are almost 45 separate Zoho creator tables(connections) inside the PowerBI file. When I trigger data refresh, PowerBI asks for my credentials for each datasource separately, even though the credentials are the same for all data sources.

Is there a better way to provide my Zoho Creator credentials once for multiple data source?

I tried to contact Zoho creator for allowing 3rd party connections after one successfull authentication but no result so far.


问:
What is the order of the peerList in onPeersAvailable, WiFi Direct?
I have been wondering whether the peerList, comes within the onPeersAvailable function is ordered in some specificity, such as wifi signal strength. I couldn't find any information regarding this. My main concern is to order the peerList according to the signal strength. I know that we can find the calculateSignalLevel after connection. However, I need that information beforehand to filter the unwanted devices.


问:
Decrypt xml p7m in VbNet Invalid characters issue
Using Vb Net, I tried to decrypt a digitally signed XML file, and I did it using a procedure I found on the net. In the first part, by copying an xml file entirely as a template and using Paste Special inside a class, I got the methods for the document automatically, and these work fine for unsigned xml documents, but in the case of signed documents, after After decrypting I get the Invalid Characters in String error. Here's how I do it:

```<code>        Dim sSignedBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(sFile)
        Dim sContentBytes() As Byte
        Dim SignedCms As New SignedCms()
        SignedCms.Decode(sSignedBytes)
        sContentBytes = SignedCms.ContentInfo.Content

        sXML = System.Text.Encoding.Default.GetString(sContentBytes)
</code>```

So, if I use Msgbox(sXML), it's possible to read entire file and every node.
then I continue by recalling the created class like this

```<code>            Dim PercorsoFile As String = sXML
            Dim fatturaElettronica As Fattura_XML.FatturaElettronica = New Fattura_XML.FatturaElettronica()
            Dim serializzare As XmlSerializer = New XmlSerializer(GetType(Fattura_XML.FatturaElettronica))
            Dim readerLettura As StreamReader = New StreamReader(PercorsoFile)
            fatturaElettronica = CType(serializzare.Deserialize(readerLettura), Fattura_XML.FatturaElettronica)
            readerLettura.Close()
            Dim NomeFornitore As String = fatturaElettronica.FatturaElettronicaHeader.CedentePrestatore.DatiAnagrafici.Anagrafica.Denominazione
            Dim totaleImporto As Decimal = fatturaElettronica.FatturaElettronicaBody.DatiGenerali.DatiGeneraliDocumento.ImportoTotaleDocumento
            Dim Prodotti As String = ""
            For Each DescrizioneProdotti In fatturaElettronica.FatturaElettronicaBody.DatiBeniServizi.DettaglioLinee
                Prodotti &= "NomeProdotto: " & DescrizioneProdotti.Descrizione & " Quantità: " & DescrizioneProdotti.Quantita & " Prezzo per singolo prodotto: " & DescrizioneProdotti.PrezzoUnitario & " Prezzo Totale: " & DescrizioneProdotti.PrezzoTotale & vbCrLf
            Next
            MessageBox.Show(Prodotti)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
</code>```

here I get the error. What I would like to achieve is to decrypt the XML file, and be able to read it in each of its nodes to put the values that interest me in some text boxes. Could anyone give me suggestions? Thank you

Body:
Using Vb Net, I tried to decrypt a digitally signed XML file, and I did it using a procedure I found on the net. In the first part, by copying an xml file entirely as a template and using Paste Special inside a class, I got the methods for the document automatically, and these work fine for unsigned xml documents, but in the case of signed documents, after After decrypting I get the Invalid Characters in String error. Here's how I do it:

        Dim sSignedBytes() As Byte = My.Computer.FileSystem.ReadAllBytes(sFile)
        Dim sContentBytes() As Byte
        Dim SignedCms As New SignedCms()
        SignedCms.Decode(sSignedBytes)
        sContentBytes = SignedCms.ContentInfo.Content

        sXML = System.Text.Encoding.Default.GetString(sContentBytes)

So, if I use Msgbox(sXML), it's possible to read entire file and every node.
then I continue by recalling the created class like this

            Dim PercorsoFile As String = sXML
            Dim fatturaElettronica As Fattura_XML.FatturaElettronica = New Fattura_XML.FatturaElettronica()
            Dim serializzare As XmlSerializer = New XmlSerializer(GetType(Fattura_XML.FatturaElettronica))
            Dim readerLettura As StreamReader = New StreamReader(PercorsoFile)
            fatturaElettronica = CType(serializzare.Deserialize(readerLettura), Fattura_XML.FatturaElettronica)
            readerLettura.Close()
            Dim NomeFornitore As String = fatturaElettronica.FatturaElettronicaHeader.CedentePrestatore.DatiAnagrafici.Anagrafica.Denominazione
            Dim totaleImporto As Decimal = fatturaElettronica.FatturaElettronicaBody.DatiGenerali.DatiGeneraliDocumento.ImportoTotaleDocumento
            Dim Prodotti As String = ""
            For Each DescrizioneProdotti In fatturaElettronica.FatturaElettronicaBody.DatiBeniServizi.DettaglioLinee
                Prodotti &= "NomeProdotto: " & DescrizioneProdotti.Descrizione & " Quantità: " & DescrizioneProdotti.Quantita & " Prezzo per singolo prodotto: " & DescrizioneProdotti.PrezzoUnitario & " Prezzo Totale: " & DescrizioneProdotti.PrezzoTotale & vbCrLf
            Next
            MessageBox.Show(Prodotti)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

here I get the error. What I would like to achieve is to decrypt the XML file, and be able to read it in each of its nodes to put the values that interest me in some text boxes. Could anyone give me suggestions? Thank you


问:
Getting Error :- FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
Whenever I am running my react project in local host by npm start I am getting the below error.

enter image description here

**Already tried solutions **

After reading lot of solutions online I tried increasing size of cache using

export NODE_OPTIONS=--max-old-space-size=2048 Still same error (also tried for 4,8,16 GB)


问:
Black color at cropped borders when using it in gdi, but looks transparent in photo editor
Borrowed this code to circle crop an image output.

```<code>// create the transparent circle image
$filename         = APP_WEB_PATH."img/user/".$_GET['img'].".jpg";
$imagefilenamepng = APP_WEB_PATH."img/user/".$_GET['img']."_c.png";

$image_s    = imagecreatefromstring(file_get_contents($filename));
$width      = imagesx($image_s);
$height     = imagesy($image_s);
$newwidth   = 300;
$newheight  = 300;

$image = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($image, true);
imagecopyresampled($image, $image_s, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

//create masking
$mask = imagecreatetruecolor($newwidth, $newheight);

$transparent = imagecolorallocate($mask, 255, 0, 0);
imagecolortransparent($mask,$transparent);
imagefilledellipse($mask, $newwidth/2, $newheight/2, $newwidth, $newheight, $transparent);

$red = imagecolorallocate($mask, 0, 0, 0);
imagecopymerge($image, $mask, 0, 0, 0, 0, $newwidth, $newheight, 100);
imagecolortransparent($image,$red);
imagefill($image, 0, 0, $red);

imagepng($image,$imagefilenamepng);
imagedestroy($image);
imagedestroy($mask);
</code>```

The image looks good and transparent and even when opened with a photo editor

but when used inside an image using php GDI i get a black border instead of transparent

what am I missing here..  (if I use paint.net image editor and re-save the image, then it works fine..)  the below image works fine after saving in the photo editor

I use the code to call it as

```<code>self::$im = imagecreatefromjpeg($imgname1);
$im2 = imagecreatefrompng($imgname2);
$sx = imagesx($im2)*$scale;
$sy = imagesy($im2)*$scale;
$stamp = imagescale($im2, $sx);
imagecopy(self::$im, $stamp, $xcord, $ycord, 0, 0, $sx, $sy);
</code>```

here self::$im is the larger image, and $im2 is the one that is cropped

Body:
Borrowed this code to circle crop an image output.

// create the transparent circle image
$filename         = APP_WEB_PATH."img/user/".$_GET['img'].".jpg";
$imagefilenamepng = APP_WEB_PATH."img/user/".$_GET['img']."_c.png";

$image_s    = imagecreatefromstring(file_get_contents($filename));
$width      = imagesx($image_s);
$height     = imagesy($image_s);
$newwidth   = 300;
$newheight  = 300;

$image = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($image, true);
imagecopyresampled($image, $image_s, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

//create masking
$mask = imagecreatetruecolor($newwidth, $newheight);

$transparent = imagecolorallocate($mask, 255, 0, 0);
imagecolortransparent($mask,$transparent);
imagefilledellipse($mask, $newwidth/2, $newheight/2, $newwidth, $newheight, $transparent);

$red = imagecolorallocate($mask, 0, 0, 0);
imagecopymerge($image, $mask, 0, 0, 0, 0, $newwidth, $newheight, 100);
imagecolortransparent($image,$red);
imagefill($image, 0, 0, $red);

imagepng($image,$imagefilenamepng);
imagedestroy($image);
imagedestroy($mask);

The image looks good and transparent and even when opened with a photo editor

but when used inside an image using php GDI i get a black border instead of transparent

what am I missing here..  (if I use paint.net image editor and re-save the image, then it works fine..)  the below image works fine after saving in the photo editor

I use the code to call it as

self::$im = imagecreatefromjpeg($imgname1);
$im2 = imagecreatefrompng($imgname2);
$sx = imagesx($im2)*$scale;
$sy = imagesy($im2)*$scale;
$stamp = imagescale($im2, $sx);
imagecopy(self::$im, $stamp, $xcord, $ycord, 0, 0, $sx, $sy);

here self::$im is the larger image, and $im2 is the one that is cropped


问:
ESP IDF: Task never leaves vTaskDelay()
I am building a system that creates a WLAN AP over which the end user can Connect/disconnect the ESP to another AP ( For example a router) by posting a JSON String to a URL. In APSTA mode. When this is done a bool "_STA_START" is set to true. And the login parameters are saved in _STA_WIFI_SSID and _STA_WIFI_PASS.

I encounter a problem when writing the Task that manages the esp as Station. When the vTaskDelay() is called the code in the vTask_Manage_STA_Connection() just stops running. If I delete the statement. The code runs very fast until it casues a stack overflow and resets the esp.

start_Manage_STA_Connection() is called in main.c after I initialise the esp as Access Point.

Right now I see on the monitor that the loop in the vTask_Manage_STA_Connection runs a single time.

Below you can find my Tasks.c and Task.h

Task.h

```<code>#ifndef INCLUDE
#define INCLUDE
#include "config.h"
#endif

#ifndef INCLUDE_WLAN_STA
#define INCLUDE_WLAN_STA
#include "WLAN_STA.h"
#endif

 // Dimensions the buffer that the task being created will use as its stack.
 // NOTE:  This is the number of words the stack will hold, not the number of
 // bytes.  For example, if each stack item is 32-bits, and this is set to 100,
 // then 400 bytes (100 * 32-bits) will be allocated.
#define STACK_SIZE 2048

/// @brief Starts a Task to Manage the STA Connection
/// @param pvParameters
void vTask_Manage_STA_Connection( void * pvParameters );

/// @brief Calls vTask_Manage_STA_Connection in main.c
/// @param
void start_Manage_STA_Connection( void );
</code>```

Tasks.c

```<code>#include "Tasks.h"

static const char *TAG_Manage_STA = "Manage STA Connection";

// Task to be created.
void vTask_Manage_STA_Connection(void *pvParameters)
{
    for (;;)
    {
        // Task code goes here.

        if (_STA_START == true)
        {
            ESP_LOGI(TAG_Manage_STA, "Connecting to Station...");

            wifi_init_sta(
                _STA_WIFI_SSID,
                _STA_WIFI_PASS);

            _STA_START = false;
        }

        ESP_LOGI(TAG_Manage_STA, "Managing STA Connection...");

        vTaskDelay(100/portTICK_PERIOD_MS);
    }
}

// Function that creates a task.
void start_Manage_STA_Connection(void)
{
    static uint8_t ucParameterToPass;
    TaskHandle_t xHandle = NULL;

    // Create the task pinned to core 0, storing the handle.  Note that the passed parameter ucParameterToPass
    // must exist for the lifetime of the task, so in this case is declared static.  If it was just an
    // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time
    // the new task attempts to access it.
    xTaskCreatePinnedToCore(vTask_Manage_STA_Connection,
                            "Manage_STA_Connection",
                            STACK_SIZE,
                            &ucParameterToPass,
                            (configMAX_PRIORITIES-1),
                            &xHandle, 0);

    configASSERT(xHandle);

    // Use the handle to delete the task.
    if (xHandle != NULL)
    {
        vTaskDelete(xHandle);
    }
}
</code>```

The Monitor Output:

```<code>I (0) cpu_start: App cpu up.
I (388) cpu_start: Pro cpu start user code
I (388) cpu_start: cpu freq: 160000000
I (388) cpu_start: Application information:
I (392) cpu_start: Project name:     wifi_softAP
I (398) cpu_start: App version:      1
I (402) cpu_start: Compile time:     Dec  5 2022 11:50:36
I (408) cpu_start: ELF file SHA256:  3597702b82953470...
I (414) cpu_start: ESP-IDF:          v4.4.2
I (419) heap_init: Initializing. RAM available for dynamic allocation:
I (426) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (432) heap_init: At 3FFB7508 len 00028AF8 (162 KiB): DRAM
I (438) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (445) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (451) heap_init: At 400944E0 len 0000BB20 (46 KiB): IRAM
I (459) spi_flash: detected chip: gd
I (462) spi_flash: flash io: dio
I (467) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (559) MAIN: ESP_WIFI_MODE_AP/STA
I (569) WLAN AP: Wifi Loop Started
I (579) wifi:wifi driver task: 3ffc0378, prio:23, stack:6656, core=0
I (579) system_api: Base MAC address is not set
I (579) system_api: read default base MAC address from EFUSE
I (609) wifi:wifi firmware version: eeaa27d
I (609) wifi:wifi certification version: v7.0
I (609) wifi:config NVS flash: enabled
I (609) wifi:config nano formating: disabled
I (609) wifi:Init data frame dynamic rx buffer num: 32
I (619) wifi:Init management frame dynamic rx buffer num: 32
I (619) wifi:Init management short buffer num: 32
I (629) wifi:Init dynamic tx buffer num: 32
I (629) wifi:Init static rx buffer size: 1600
I (629) wifi:Init static rx buffer num: 10
I (639) wifi:Init dynamic rx buffer num: 32
I (639) wifi_init: rx ba win: 6
I (649) wifi_init: tcpip mbox: 32
I (649) wifi_init: udp mbox: 6
I (649) wifi_init: tcp mbox: 6
I (659) wifi_init: tcp tx win: 5744
I (659) wifi_init: tcp rx win: 5744
I (669) wifi_init: tcp mss: 1440
I (669) wifi_init: WiFi IRAM OP enabled
I (669) wifi_init: WiFi RX IRAM OP enabled
I (689) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (789) wifi:mode : sta (30:ae:a4:80:4e:88) + softAP (30:ae:a4:80:4e:89)
I (789) wifi:enable tsf
I (789) wifi:Total power save buffer number: 16
I (789) wifi:Init max length of beacon: 752/752
I (789) wifi:Init max length of beacon: 752/752
I (799) WLAN AP: Error: Unknown AP Exception
I (799) WLAN AP: wifi_init_softap finished. SSID:myssid password:mypassword channel:4
I (799) WLAN AP: Access point started!
I (819) Manage STA Connection: Managing STA Connection...
I (91529) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<0,0>, prof:1
I (91529) wifi:station: 1c:bf:ce:ca:79:de join, AID=1, bgn, 40U
I (91549) WLAN AP: station 1c:bf:ce:ca:79:de join, AID=1
I (91559) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.5.2
I (91559) AP Webserver: Starting webserver
I (91559) AP Webserver: Starting server on port: '80'
I (91569) AP Webserver: Registering URI handlers
W (95189) wifi:<ba-add>idx:2 (ifx:1, 1c:bf:ce:ca:79:de), tid:0, ssn:190, winSize:64
</code>```

Title: ESP IDF: Task never leaves vTaskDelay()

Body:
I am building a system that creates a WLAN AP over which the end user can Connect/disconnect the ESP to another AP ( For example a router) by posting a JSON String to a URL. In APSTA mode. When this is done a bool "_STA_START" is set to true. And the login parameters are saved in _STA_WIFI_SSID and _STA_WIFI_PASS.

I encounter a problem when writing the Task that manages the esp as Station. When the vTaskDelay() is called the code in the vTask_Manage_STA_Connection() just stops running. If I delete the statement. The code runs very fast until it casues a stack overflow and resets the esp.

start_Manage_STA_Connection() is called in main.c after I initialise the esp as Access Point.

Right now I see on the monitor that the loop in the vTask_Manage_STA_Connection runs a single time.

Below you can find my Tasks.c and Task.h

Task.h

#ifndef INCLUDE
#define INCLUDE
#include "config.h"
#endif

#ifndef INCLUDE_WLAN_STA
#define INCLUDE_WLAN_STA
#include "WLAN_STA.h"
#endif

 // Dimensions the buffer that the task being created will use as its stack.
 // NOTE:  This is the number of words the stack will hold, not the number of
 // bytes.  For example, if each stack item is 32-bits, and this is set to 100,
 // then 400 bytes (100 * 32-bits) will be allocated.
#define STACK_SIZE 2048

/// @brief Starts a Task to Manage the STA Connection
/// @param pvParameters
void vTask_Manage_STA_Connection( void * pvParameters );

/// @brief Calls vTask_Manage_STA_Connection in main.c
/// @param
void start_Manage_STA_Connection( void );

Tasks.c

#include "Tasks.h"

static const char *TAG_Manage_STA = "Manage STA Connection";

// Task to be created.
void vTask_Manage_STA_Connection(void *pvParameters)
{
    for (;;)
    {
        // Task code goes here.

        if (_STA_START == true)
        {
            ESP_LOGI(TAG_Manage_STA, "Connecting to Station...");

            wifi_init_sta(
                _STA_WIFI_SSID,
                _STA_WIFI_PASS);

            _STA_START = false;
        }

        ESP_LOGI(TAG_Manage_STA, "Managing STA Connection...");

        vTaskDelay(100/portTICK_PERIOD_MS);
    }
}

// Function that creates a task.
void start_Manage_STA_Connection(void)
{
    static uint8_t ucParameterToPass;
    TaskHandle_t xHandle = NULL;

    // Create the task pinned to core 0, storing the handle.  Note that the passed parameter ucParameterToPass
    // must exist for the lifetime of the task, so in this case is declared static.  If it was just an
    // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time
    // the new task attempts to access it.
    xTaskCreatePinnedToCore(vTask_Manage_STA_Connection,
                            "Manage_STA_Connection",
                            STACK_SIZE,
                            &ucParameterToPass,
                            (configMAX_PRIORITIES-1),
                            &xHandle, 0);

    configASSERT(xHandle);

    // Use the handle to delete the task.
    if (xHandle != NULL)
    {
        vTaskDelete(xHandle);
    }
}

The Monitor Output:

I (0) cpu_start: App cpu up.
I (388) cpu_start: Pro cpu start user code
I (388) cpu_start: cpu freq: 160000000
I (388) cpu_start: Application information:
I (392) cpu_start: Project name:     wifi_softAP
I (398) cpu_start: App version:      1
I (402) cpu_start: Compile time:     Dec  5 2022 11:50:36
I (408) cpu_start: ELF file SHA256:  3597702b82953470...
I (414) cpu_start: ESP-IDF:          v4.4.2
I (419) heap_init: Initializing. RAM available for dynamic allocation:
I (426) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (432) heap_init: At 3FFB7508 len 00028AF8 (162 KiB): DRAM
I (438) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (445) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (451) heap_init: At 400944E0 len 0000BB20 (46 KiB): IRAM
I (459) spi_flash: detected chip: gd
I (462) spi_flash: flash io: dio
I (467) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (559) MAIN: ESP_WIFI_MODE_AP/STA
I (569) WLAN AP: Wifi Loop Started
I (579) wifi:wifi driver task: 3ffc0378, prio:23, stack:6656, core=0
I (579) system_api: Base MAC address is not set
I (579) system_api: read default base MAC address from EFUSE
I (609) wifi:wifi firmware version: eeaa27d
I (609) wifi:wifi certification version: v7.0
I (609) wifi:config NVS flash: enabled
I (609) wifi:config nano formating: disabled
I (609) wifi:Init data frame dynamic rx buffer num: 32
I (619) wifi:Init management frame dynamic rx buffer num: 32
I (619) wifi:Init management short buffer num: 32
I (629) wifi:Init dynamic tx buffer num: 32
I (629) wifi:Init static rx buffer size: 1600
I (629) wifi:Init static rx buffer num: 10
I (639) wifi:Init dynamic rx buffer num: 32
I (639) wifi_init: rx ba win: 6
I (649) wifi_init: tcpip mbox: 32
I (649) wifi_init: udp mbox: 6
I (649) wifi_init: tcp mbox: 6
I (659) wifi_init: tcp tx win: 5744
I (659) wifi_init: tcp rx win: 5744
I (669) wifi_init: tcp mss: 1440
I (669) wifi_init: WiFi IRAM OP enabled
I (669) wifi_init: WiFi RX IRAM OP enabled
I (689) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (789) wifi:mode : sta (30:ae:a4:80:4e:88) + softAP (30:ae:a4:80:4e:89)
I (789) wifi:enable tsf
I (789) wifi:Total power save buffer number: 16
I (789) wifi:Init max length of beacon: 752/752
I (789) wifi:Init max length of beacon: 752/752
I (799) WLAN AP: Error: Unknown AP Exception
I (799) WLAN AP: wifi_init_softap finished. SSID:myssid password:mypassword channel:4
I (799) WLAN AP: Access point started!
I (819) Manage STA Connection: Managing STA Connection...
I (91529) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<0,0>, prof:1
I (91529) wifi:station: 1c:bf:ce:ca:79:de join, AID=1, bgn, 40U
I (91549) WLAN AP: station 1c:bf:ce:ca:79:de join, AID=1
I (91559) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.5.2
I (91559) AP Webserver: Starting webserver
I (91559) AP Webserver: Starting server on port: '80'
I (91569) AP Webserver: Registering URI handlers
W (95189) wifi:<ba-add>idx:2 (ifx:1, 1c:bf:ce:ca:79:de), tid:0, ssn:190, winSize:64


问:
Flutter connecting with the STOMP client as many time as I reload
I'm using Flutter stomp_dart_client.
Everything works fine but the problem arises whenever I either hot reload or hot restart my program where if I press hot reload, the program will connect with my stomp client twice, if I hot reload/restart again, the program will connect with stomp client thrice and it just keeps adding up as many time as I reload.

My code:

```<code>StreamController streamController = StreamController();
var _listMessage = <String>[];
String? name;

void getName(String getName) {
  name = getName;
}

String subDestination = "/topic/return-to";

void onConnect(StompFrame frame) {

  print(frame.headers);
  stompClient.subscribe(
    destination: subDestination,
    callback: (frame) {
      Map<String, dynamic>? result = json.decode(frame.body!);
      print(result);
      print("Hi loser");
      _listMessage.add(result?["name"] + " : " + result?["content"]);
      streamController.sink.add(_listMessage);
    },
  );

  stompClient.send(
      destination: "/app/userData", body: json.encode({"name": name}));
}

final stompClient = StompClient(
  config: StompConfig(
      heartbeatOutgoing: Duration(microseconds: 1000),
      url: "ws://localhost:9192/server",
      onConnect: onConnect,
      beforeConnect: () async {
        print('waiting to connect...');
        await Future.delayed(Duration(milliseconds: 200));
        print('connecting...');
      },
      onWebSocketError: (dynamic error) =>
          print("hot mess") //print(error.toString()),
  ),
);

List getMessages() {
  return _listMessage;
}

class ChatApp extends StatefulWidget {
  String name;
  ChatApp({Key? key, required this.name}) : super(key: key);
  // const ChatApp({Key? key}) : super(key: key);

  @override
  State<ChatApp> createState() => _ChatAppState();
}

class _ChatAppState extends State<ChatApp> {

  TextEditingController msgController = TextEditingController();
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    getName(widget.name);
    stompClient.activate();
    streamController.add(getMessages());
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Expanded(
              child: StreamBuilder(
                  stream: streamController.stream,
                  builder: (context, snapshot){
                    if(snapshot.hasData){
                      var listMessage = snapshot.data as List<String>;
                      return ListView.builder(
                          itemCount: listMessage.length,
                          itemBuilder: (context, index){
                            List splitList = (listMessage[index].split(":"));

                            if(splitList[0].trim() == widget.name){
                              return Align(
                                alignment: Alignment.centerRight,
                                child: Text(
                                    listMessage[index],
                                  style: TextStyle(
                                    color: Colors.blue,
                                  ),
                                ),
                              );
                            }else {
                              return Text(listMessage[index]);
                            }
                          }
                      );
                    }
                    return CircularProgressIndicator();

                  }),flex: 5,
            ),
            Expanded(
              flex: 5,
              child: Row(
                children: [
                  SizedBox(
                    width: 200,
                    child: TextField(
                      controller: msgController,
                      decoration: InputDecoration(
                        hintText: "Chill",
                      ),
                    ),
                  ),
                  IconButton(onPressed: (){
                    stompClient.send(destination: "/app/message",
                        body: json.encode({"content" : msgController.text,
                        "name" : widget.name})
                    );
                  },
                      icon:  Icon(Icons.send))
                ],
              ),
            )

          ],
        ),
      ),

    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    stompClient.deactivate();

  }
}
</code>```

I tried connecting with my STOMP Client, it connects but when hot reloading, it end up connecting as many times as I hot restart/reload.

Body:
I'm using Flutter stomp_dart_client.
Everything works fine but the problem arises whenever I either hot reload or hot restart my program where if I press hot reload, the program will connect with my stomp client twice, if I hot reload/restart again, the program will connect with stomp client thrice and it just keeps adding up as many time as I reload.

My code:

StreamController streamController = StreamController();
var _listMessage = <String>[];
String? name;

void getName(String getName) {
  name = getName;
}

String subDestination = "/topic/return-to";

void onConnect(StompFrame frame) {

  print(frame.headers);
  stompClient.subscribe(
    destination: subDestination,
    callback: (frame) {
      Map<String, dynamic>? result = json.decode(frame.body!);
      print(result);
      print("Hi loser");
      _listMessage.add(result?["name"] + " : " + result?["content"]);
      streamController.sink.add(_listMessage);
    },
  );

  stompClient.send(
      destination: "/app/userData", body: json.encode({"name": name}));
}

final stompClient = StompClient(
  config: StompConfig(
      heartbeatOutgoing: Duration(microseconds: 1000),
      url: "ws://localhost:9192/server",
      onConnect: onConnect,
      beforeConnect: () async {
        print('waiting to connect...');
        await Future.delayed(Duration(milliseconds: 200));
        print('connecting...');
      },
      onWebSocketError: (dynamic error) =>
          print("hot mess") //print(error.toString()),
  ),
);

List getMessages() {
  return _listMessage;
}

class ChatApp extends StatefulWidget {
  String name;
  ChatApp({Key? key, required this.name}) : super(key: key);
  // const ChatApp({Key? key}) : super(key: key);

  @override
  State<ChatApp> createState() => _ChatAppState();
}

class _ChatAppState extends State<ChatApp> {

  TextEditingController msgController = TextEditingController();
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    getName(widget.name);
    stompClient.activate();
    streamController.add(getMessages());
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Expanded(
              child: StreamBuilder(
                  stream: streamController.stream,
                  builder: (context, snapshot){
                    if(snapshot.hasData){
                      var listMessage = snapshot.data as List<String>;
                      return ListView.builder(
                          itemCount: listMessage.length,
                          itemBuilder: (context, index){
                            List splitList = (listMessage[index].split(":"));

                            if(splitList[0].trim() == widget.name){
                              return Align(
                                alignment: Alignment.centerRight,
                                child: Text(
                                    listMessage[index],
                                  style: TextStyle(
                                    color: Colors.blue,
                                  ),
                                ),
                              );
                            }else {
                              return Text(listMessage[index]);
                            }
                          }
                      );
                    }
                    return CircularProgressIndicator();

                  }),flex: 5,
            ),
            Expanded(
              flex: 5,
              child: Row(
                children: [
                  SizedBox(
                    width: 200,
                    child: TextField(
                      controller: msgController,
                      decoration: InputDecoration(
                        hintText: "Chill",
                      ),
                    ),
                  ),
                  IconButton(onPressed: (){
                    stompClient.send(destination: "/app/message",
                        body: json.encode({"content" : msgController.text,
                        "name" : widget.name})
                    );
                  },
                      icon:  Icon(Icons.send))
                ],
              ),
            )

          ],
        ),
      ),

    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    stompClient.deactivate();

  }
}

I tried connecting with my STOMP Client, it connects but when hot reloading, it end up connecting as many times as I hot restart/reload.


问:
AVAssetWriterInput appendSampleBuffer: memory leak in iOS 16
I am generating videos from a set of still images. I generate pixels buffers from a CVPixelBufferPoolRef for each image, add them to a queue and when the videoAssetWriterInput.readyForMoreMediaData becomes true I add them using "[videoAssetWriterInput appendSampleBuffer:sampleBufferRef]", after which, upon success, I release the sample buffer with "CFRelease(sampleBufferRef)".

Before iOS 16, I also release the underlying pixel buffer using "CVPixelBufferRelease(CMSampleBufferGetImageBuffer(sampleBufferRef));" which may have been a bug but worked just fine. How if I keep the "CVPixelBufferRelease(CMSampleBufferGetImageBuffer(sampleBufferRef));" statement, then the generated video have scrambled frames. But if I remove it as I probably should, the underlying pixel buffer is never returned to the pool and deallocated, leading to a huge memory leak. Wayne has encountered this problem?

I have tried everying, including delaying explicit deallocation of the pixel buffer but I cannot see any reason why this should be done (or even how? when all the sample buffers have been used??)


Title: How to create structure of table for best query answers and performance in Cassandra?

Body:
I have the following situations: I need to redesign a Cassandra keyspace by restructuring multiple tables.

The existing structure is the following

token@cqlsh> describe series;

CREATE TABLE series (
    type text,
    name text,
    as_of timestamp,
    data text,
    hash text,
    PRIMARY KEY ((type, name, as_of))
)

Instead of having the following structure:

 type | name              | as_of                           | data                                                                                | hash
------+-------------------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------
   OP | LU_STC            | 2022-09-30 00:00:00.000000+0000 | {"type": "OP", "name": "LU_STC", "as_of": "2022-09-30", "data": [{"year": 2022, "month": 9, "day": 30, "hour": 0, "quarter": 3, "week": 39, "wk_year": 2022, "is_peak": 0, "value": 4.689399994443761}, {"year": 2022, "month": 9, "day": 30, "hour": 1, "quarter": 3, "week": 39, "wk_year": 2022, "is_peak": 0, "value": 12.761399943614606}], "hash": "cf4e383a370416ebbdec8a2f2ca4e28982cd9f871a9f540e4f4f6c8807a7015a"} | cf4e383a370416ebbdec8a2f2ca4e28982cd9f871a9f540e4f4f6c8807a7015a

where the data field contains more than 50k entries:

{
   "type":"OP",
   "name":"LU_STC",
   "as_of":"2022-09-30",
   "data":[
      {
         "year":2022,
         "month":9,
         "day":30,
         "hour":0,
         "quarter":3,
         "week":39,
         "wk_year":2022,
         "is_peak":0,
         "value":4.689399994443761
      },
      ...
      50k entries
      ...
      {
         "year":2022,
         "month":9,
         "day":30,
         "hour":1,
         "quarter":3,
         "week":39,
         "wk_year":2022,
         "is_peak":0,
         "value":12.761399943614606
      }
   ],
   "hash":"cf4e383a370416ebbdec8a2f2ca4e28982cd9f871a9f540e4f4f6c8807a7015a"
}

a table (series_test) where each data field is written like a row, having the following structure:

token@cqlsh> select * series_test where name = 'DE_STC' and as_of = '2022-09-30' and date <= '2022-10-01 00:00:00.000000+0000' ALLOW FILTERING;

 name   | as_of                           | date                            | commodity | type | is_peak | quarter | value   | week | wk_year
--------+---------------------------------+---------------------------------+-----------+------+---------+---------+---------+------+---------
 DE_STC | 2022-09-30 00:00:00.000000+0000 | 2022-09-30 00:00:00.000000+0000 |     power |   OP |   False |       3 | -1.0377 |   39 |    2022
 DE_STC | 2022-09-30 00:00:00.000000+0000 | 2022-10-01 00:00:00.000000+0000 |     power |   OP |   False |       4 | 31.0728 |   39 |    2022

The question is how I can build the partition key to be unique and to be able to query for sets of rows based on the date column (timestamp) for getting records only for a given period?

Is the following structure correct ?

token@cqlsh> describe series_test;

CREATE TABLE series_test (
    name text,
    as_of timestamp,
    date timestamp,
    commodity text,
    type text,
    is_peak boolean,
    quarter int,
    value float,
    week int,
    wk_year int,
    PRIMARY KEY ((name, as_of, date), commodity, type)
)


问:
Return coordinates of pixels
I have to implement a function that converts a row number and column number of a pixel on the screen to the memory address for the corresponding pixel. Keep in mind the dimensions of the screen (32 pixels wide, 16 pixels high). The pixel at row 0 and column 0 is at the top left of the address in register $gp. Each pixel is 32 bits.

I have no idea on how to return the address of the said pixel. Here is the code that I wrote:

```<code>.globl main

.data

amountOfRows:    .word 16  # The mount of rows of pixels
amountOfColumns: .word 32  # The mount of columns of pixels

promptRows: .asciiz "Please enter the row number:\n"
promptCols: .asciiz "Please enter the column number:\n"

msgShowMemoryAddress: .asciiz "The memory address for the pixel is:\n"

.text

main:

    li $v0, 4       # print string
    la $a0, promptRows  # message to ask the user for the row number
    syscall

    li $v0, 5  # read integer
    syscall    # ask the user for a row number

    # add code here ...
    move $t0, $v0 # $t0 is y

    li $v0 , 4 #print string
    la $a0, promptCols #message to ask the user for the column number
    syscall

    li $v0, 5 #read int
    syscall #ask the user for a column number

    move $t1, $v0 #$t1 is x
    j index
index:
    sll $t3, $t0, 5 # multiply $t0 by 32 and set it to $t3
    add $t4,$t3,$t1 # $t4 = $t3 + x
    j offset

offset:
    sll $t5,$t4,2 # multiply $t4 by 4 and set it to $t5
    j final
final:
    add $gp,$t5,$gp #set gp to $t5 + $gp to get the address of the given pixel coordinates

    # return the adress of gp??? (wrong idk how)
    li $v0, 4
    la $a0,msgShowMemoryAddress
    syscall
    la $a0, $gp
    syscall

    j exit

exit:

    li $v0, 10  # syscall to end the program
    syscall

</code>```

Title: Return coordinates of pixels

Body:
I have to implement a function that converts a row number and column number of a pixel on the screen to the memory address for the corresponding pixel. Keep in mind the dimensions of the screen (32 pixels wide, 16 pixels high). The pixel at row 0 and column 0 is at the top left of the address in register $gp. Each pixel is 32 bits.

I have no idea on how to return the address of the said pixel. Here is the code that I wrote:

.globl main

.data

amountOfRows:    .word 16  # The mount of rows of pixels
amountOfColumns: .word 32  # The mount of columns of pixels

promptRows: .asciiz "Please enter the row number:\n"
promptCols: .asciiz "Please enter the column number:\n"

msgShowMemoryAddress: .asciiz "The memory address for the pixel is:\n"

.text

main:

    li $v0, 4       # print string
    la $a0, promptRows  # message to ask the user for the row number
    syscall

    li $v0, 5  # read integer
    syscall    # ask the user for a row number

    # add code here ...
    move $t0, $v0 # $t0 is y

    li $v0 , 4 #print string
    la $a0, promptCols #message to ask the user for the column number
    syscall

    li $v0, 5 #read int
    syscall #ask the user for a column number

    move $t1, $v0 #$t1 is x
    j index
index:
    sll $t3, $t0, 5 # multiply $t0 by 32 and set it to $t3
    add $t4,$t3,$t1 # $t4 = $t3 + x
    j offset

offset:
    sll $t5,$t4,2 # multiply $t4 by 4 and set it to $t5
    j final
final:
    add $gp,$t5,$gp #set gp to $t5 + $gp to get the address of the given pixel coordinates

    # return the adress of gp??? (wrong idk how)
    li $v0, 4
    la $a0,msgShowMemoryAddress
    syscall
    la $a0, $gp
    syscall

    j exit

exit:

    li $v0, 10  # syscall to end the program
    syscall


问:
Visual Studio Project within the solution not loading (load failed) and appearing with errors
I have cloned code from our company ADO area (someone else's code files) and when loading it in visual studio 2022 I cannot load one of the projects in the solution (unloaded). I get the following two errors:

Error 1: The Web Application Project is configured to use IIS.  Could not find the server on the local machine. Make sure the local IIS server has been configured to support secure communications.

Error 2: A project with that name is already opened in the solution.

My colleague who originally wrote the code can clone the code and doesn't get the same issue.

I am also getting a lot of dbl files and debug files automatically populating in the changes and every time I make a change to the code it generates more changes for these kinds of files which is quite hard to then see in git changes what changes are mine and what have been autogenerated.

Can anyone help?! I am new to the Development world, and this is really stumping me!

I have tried going into the user file and setting use IISExpress to false. Was expecting that to resolve the error 1 message but it hasn't.

I have tried putting a gitignore file into my project but it isn't ignoring the files in the changes being auto generated in git changes.


问:
Is it possible to deselect a variable in the InfluxDB dashboard UI?
I have a variable in my InfluxDB dashboard to filter for a specific scenario_id.  However, I want to be able to deselect the variable or set it to * in order to show all scenarios. This should be similar to how one can deselect a filter in Datadog (as shown below).

InfluxDB variable:

When I click on the X button, the drop-down to select another scenario_id opens and forces me to select a scenario ID. If I close it without selecting a value, the old value stays selected.

Variable deselected in Datadog: