问:
Uncaught SyntaxError: Unexpected token Android Studio API 23
We have a WebView app that works on some devices and on others it won't, these are the same devices, same OS (Android 6), same apps installed...

My guess is that something is not updated... The default browser is the same...

It also throws "Uncaught syntax error" on many javascript files as if it's not able to run javascript, this happens with webview, cordova apps, NET MAUI webview, NET MAUI with Blazor bindings.

As I said it works on almost all devices but there are a few where it doesn't.

```<code>I/chromium: [INFO:CONSOLE(20)] "Uncaught SyntaxError: Unexpected token )", source: http://example.com/js/bootstrap.min.js (20)
I/chromium: [INFO:CONSOLE(365)] "Uncaught SyntaxError: Identifier 't' has already been declared", source: http://example.com/js/bootbox.all.min.js (365)
I/chromium: [INFO:CONSOLE(116)] "Uncaught SyntaxError: Unexpected token [", source: http://xampp.geinal.com:33432/js/funcs.js (116)
I/chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token )", source: http://example.com/_framework/blazor.server.js (1)
</code>```

The model is Chainway c6000 (Android 6 NOT 10, the model with 10 also works fine)

Don't take the logs as an absolute reference but the idea that JS won't work.

Edit: MainActivity.java code

```<code>package com.example.testview;

import static com.google.android.material.internal.ContextUtils.getActivity;

import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;

import com.google.android.material.snackbar.Snackbar;

import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.example.testview.databinding.ActivityMainBinding;

import android.view.Menu;
import android.view.MenuItem;

import android.webkit.CookieManager;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MainActivity extends AppCompatActivity {

    WebView webView;
    private static final String TAG = MainActivity.class.getSimpleName();
    private String mCM;
    private ValueCallback mUM;
    private ValueCallback<Uri[]> mUMA;
    private final static int FCR=1;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent){

         int _result = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
        // int _result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

        if (_result == PackageManager.PERMISSION_GRANTED){
            Log.d("-----------------CODE X","Hay permisos");
        } else {
            Log.d("-----------------CODE X","ERROR permisos");
        }

        super.onActivityResult(requestCode, resultCode, intent);
        if(Build.VERSION.SDK_INT >= 21){
            Uri[] results = null;
            //Check if response is positive
            if(resultCode== Activity.RESULT_OK){
              if(requestCode == FCR){
                    if(null == mUMA){
                        Log.d("-----------------CODE 0","ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR");
                         return;
                    }
                    if(intent == null || intent.getData() == null){
                        //Capture Photo if no image available
                        if(mCM != null){

                            Log.d("-----------------CODE 1",new Uri[]{Uri.parse(mCM)}.toString());
                            Log.d("----------------CODE R3", String.valueOf(results));

                            results = new Uri[]{Uri.parse(mCM)};
                        }
                    }else{
                        String dataString = intent.getDataString();
                        if(dataString != null){
                            Log.d("-----------------CODE 2",new Uri[]{Uri.parse(dataString)}.toString());
                            Log.d("-----------------CODE D",dataString);
                            Log.d("----------------CODE R2", String.valueOf(results));

                            results = new Uri[]{Uri.parse(dataString)};

                        }
                    }
                }
            }

            Log.d("----------------CODE R1", String.valueOf(results));

            mUMA.onReceiveValue(results);
            mUMA = null;
        }else{
            if(requestCode == FCR){
                if(null == mUM) return;
                Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
                mUM.onReceiveValue(result);
                mUM = null;
            }
        }
    }

    @SuppressLint({"SetJavaScriptEnabled", "WrongViewCast"})
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

      // if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
          //      ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
             //   ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 3);
          //  }

        Log.d("-----------------CODE C","ONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATE");

        setContentView(R.layout.activity_main);

        if(Build.VERSION.SDK_INT >=23 && (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)) {
            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, 1);
        }

        // Andorid 10 filechooser not showing camera option
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
                == PackageManager.PERMISSION_DENIED) {
            ActivityCompat.requestPermissions(MainActivity.this, new String[] {Manifest.permission.CAMERA}, 1);
        }

        ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE);

        webView = (WebView) findViewById(R.id.MyWeb);
        //    assert webView != null;
        //  WebSettings webSettings = webView.getSettings();
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setAllowFileAccess(true);

        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setDatabaseEnabled(true);

        webView.getSettings().setAllowContentAccess(true);
        webView.getSettings().setAllowFileAccess(true);

        webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
        CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);

        if(Build.VERSION.SDK_INT >= 21){
            webView.getSettings().setMixedContentMode(0);
            webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }else if(Build.VERSION.SDK_INT >= 19){
            webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }else {
            webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        webView.setWebViewClient(new Callback());

         webView.loadUrl("http://192.168.56.154");

        webView.setWebChromeClient(new WebChromeClient(){
            private ValueCallback<Uri[]> uploadMessage;

            //For Android 5.0+
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams){
                Log.d("Message tag -2 File cho","onShowFileChooser done");

                if(mUMA != null){
                    mUMA.onReceiveValue(null);
                }

                mUMA = filePathCallback;
                Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                if(takePictureIntent.resolveActivity(MainActivity.this.getPackageManager()) != null){
                    File photoFile = null;
                    try{
                        photoFile = createImageFile();
                        takePictureIntent.putExtra("PhotoPath", mCM);
                    }catch(IOException ex){
                        Log.e(TAG, "Image file creation failed", ex);
                    }
                    if(photoFile != null){
                        mCM = "file:" + photoFile.getAbsolutePath();
                        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                    }else{
                        takePictureIntent = null;
                    }
                }

                Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
                contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
                contentSelectionIntent.setType("*/*");
                Intent[] intentArray;

                if(takePictureIntent != null){
                    intentArray = new Intent[]{takePictureIntent};
                }else{
                    intentArray = new Intent[0];
                }

                Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
                //    Intent chooserIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
                chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
                chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
                startActivityForResult(chooserIntent, FCR);
                return true;

            }
        });
    }

    public class Callback extends WebViewClient{

        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            handler.proceed();
        }

        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){
            Toast.makeText(getApplicationContext(), "Failed loading app!", Toast.LENGTH_SHORT).show();
        }
    }

    // Create an image file
    private File createImageFile() throws IOException{

        @SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        String imageFileName = "img_"+timeStamp+"_";
        File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        return File.createTempFile(imageFileName,".jpg",storageDir);
    }

    @Override
    public boolean onKeyDown(int keyCode, @NonNull KeyEvent event){
        if(event.getAction() == KeyEvent.ACTION_DOWN){
            switch(keyCode){
                case KeyEvent.KEYCODE_BACK:
                    if(webView.canGoBack()){
                        webView.goBack();
                    }else{
                        finish();
                    }
                    return true;
            }
        }
        return super.onKeyDown(keyCode, event);
    }
/*
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed(); // Ignore SSL certificate errors
    }
*/

    @Override

    public void onConfigurationChanged(Configuration newConfig){
        super.onConfigurationChanged(newConfig);
    }
}

</code>```

Edit 2:
I did some testing and found that the "UserAgent:Browser = CHROME_MOBILE" is the same on both, but there is a difference in "UserAgent:BrowserVersion = 75.0", that's the one working, and the one that doesn't is "UserAgent:BrowserVersion = 44.0".

Body:
We have a WebView app that works on some devices and on others it won't, these are the same devices, same OS (Android 6), same apps installed...

My guess is that something is not updated... The default browser is the same...

It also throws "Uncaught syntax error" on many javascript files as if it's not able to run javascript, this happens with webview, cordova apps, NET MAUI webview, NET MAUI with Blazor bindings.

As I said it works on almost all devices but there are a few where it doesn't.

I/chromium: [INFO:CONSOLE(20)] "Uncaught SyntaxError: Unexpected token )", source: http://example.com/js/bootstrap.min.js (20)
I/chromium: [INFO:CONSOLE(365)] "Uncaught SyntaxError: Identifier 't' has already been declared", source: http://example.com/js/bootbox.all.min.js (365)
I/chromium: [INFO:CONSOLE(116)] "Uncaught SyntaxError: Unexpected token [", source: http://xampp.geinal.com:33432/js/funcs.js (116)
I/chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token )", source: http://example.com/_framework/blazor.server.js (1)

The model is Chainway c6000 (Android 6 NOT 10, the model with 10 also works fine)

Don't take the logs as an absolute reference but the idea that JS won't work.

Edit: MainActivity.java code

package com.example.testview;

import static com.google.android.material.internal.ContextUtils.getActivity;

import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;

import com.google.android.material.snackbar.Snackbar;

import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.example.testview.databinding.ActivityMainBinding;

import android.view.Menu;
import android.view.MenuItem;

import android.webkit.CookieManager;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MainActivity extends AppCompatActivity {

    WebView webView;
    private static final String TAG = MainActivity.class.getSimpleName();
    private String mCM;
    private ValueCallback mUM;
    private ValueCallback<Uri[]> mUMA;
    private final static int FCR=1;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent){

         int _result = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
        // int _result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

        if (_result == PackageManager.PERMISSION_GRANTED){
            Log.d("-----------------CODE X","Hay permisos");
        } else {
            Log.d("-----------------CODE X","ERROR permisos");
        }

        super.onActivityResult(requestCode, resultCode, intent);
        if(Build.VERSION.SDK_INT >= 21){
            Uri[] results = null;
            //Check if response is positive
            if(resultCode== Activity.RESULT_OK){
              if(requestCode == FCR){
                    if(null == mUMA){
                        Log.d("-----------------CODE 0","ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR");
                         return;
                    }
                    if(intent == null || intent.getData() == null){
                        //Capture Photo if no image available
                        if(mCM != null){

                            Log.d("-----------------CODE 1",new Uri[]{Uri.parse(mCM)}.toString());
                            Log.d("----------------CODE R3", String.valueOf(results));

                            results = new Uri[]{Uri.parse(mCM)};
                        }
                    }else{
                        String dataString = intent.getDataString();
                        if(dataString != null){
                            Log.d("-----------------CODE 2",new Uri[]{Uri.parse(dataString)}.toString());
                            Log.d("-----------------CODE D",dataString);
                            Log.d("----------------CODE R2", String.valueOf(results));

                            results = new Uri[]{Uri.parse(dataString)};

                        }
                    }
                }
            }

            Log.d("----------------CODE R1", String.valueOf(results));

            mUMA.onReceiveValue(results);
            mUMA = null;
        }else{
            if(requestCode == FCR){
                if(null == mUM) return;
                Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
                mUM.onReceiveValue(result);
                mUM = null;
            }
        }
    }

    @SuppressLint({"SetJavaScriptEnabled", "WrongViewCast"})
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

      // if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
          //      ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
             //   ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 3);
          //  }

        Log.d("-----------------CODE C","ONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATEONCREATE");

        setContentView(R.layout.activity_main);

        if(Build.VERSION.SDK_INT >=23 && (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)) {
            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, 1);
        }

        // Andorid 10 filechooser not showing camera option
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
                == PackageManager.PERMISSION_DENIED) {
            ActivityCompat.requestPermissions(MainActivity.this, new String[] {Manifest.permission.CAMERA}, 1);
        }

        ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE);

        webView = (WebView) findViewById(R.id.MyWeb);
        //    assert webView != null;
        //  WebSettings webSettings = webView.getSettings();
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setAllowFileAccess(true);

        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setDatabaseEnabled(true);

        webView.getSettings().setAllowContentAccess(true);
        webView.getSettings().setAllowFileAccess(true);

        webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
        CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);

        if(Build.VERSION.SDK_INT >= 21){
            webView.getSettings().setMixedContentMode(0);
            webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }else if(Build.VERSION.SDK_INT >= 19){
            webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }else {
            webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        webView.setWebViewClient(new Callback());

         webView.loadUrl("http://192.168.56.154");

        webView.setWebChromeClient(new WebChromeClient(){
            private ValueCallback<Uri[]> uploadMessage;

            //For Android 5.0+
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams){
                Log.d("Message tag -2 File cho","onShowFileChooser done");

                if(mUMA != null){
                    mUMA.onReceiveValue(null);
                }

                mUMA = filePathCallback;
                Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                if(takePictureIntent.resolveActivity(MainActivity.this.getPackageManager()) != null){
                    File photoFile = null;
                    try{
                        photoFile = createImageFile();
                        takePictureIntent.putExtra("PhotoPath", mCM);
                    }catch(IOException ex){
                        Log.e(TAG, "Image file creation failed", ex);
                    }
                    if(photoFile != null){
                        mCM = "file:" + photoFile.getAbsolutePath();
                        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                    }else{
                        takePictureIntent = null;
                    }
                }

                Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
                contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
                contentSelectionIntent.setType("*/*");
                Intent[] intentArray;

                if(takePictureIntent != null){
                    intentArray = new Intent[]{takePictureIntent};
                }else{
                    intentArray = new Intent[0];
                }

                Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
                //    Intent chooserIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
                chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
                chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
                startActivityForResult(chooserIntent, FCR);
                return true;

            }
        });
    }

    public class Callback extends WebViewClient{

        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            handler.proceed();
        }

        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){
            Toast.makeText(getApplicationContext(), "Failed loading app!", Toast.LENGTH_SHORT).show();
        }
    }

    // Create an image file
    private File createImageFile() throws IOException{

        @SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        String imageFileName = "img_"+timeStamp+"_";
        File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        return File.createTempFile(imageFileName,".jpg",storageDir);
    }

    @Override
    public boolean onKeyDown(int keyCode, @NonNull KeyEvent event){
        if(event.getAction() == KeyEvent.ACTION_DOWN){
            switch(keyCode){
                case KeyEvent.KEYCODE_BACK:
                    if(webView.canGoBack()){
                        webView.goBack();
                    }else{
                        finish();
                    }
                    return true;
            }
        }
        return super.onKeyDown(keyCode, event);
    }
/*
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed(); // Ignore SSL certificate errors
    }
*/

    @Override

    public void onConfigurationChanged(Configuration newConfig){
        super.onConfigurationChanged(newConfig);
    }
}

Edit 2:
I did some testing and found that the "UserAgent:Browser = CHROME_MOBILE" is the same on both, but there is a difference in "UserAgent:BrowserVersion = 75.0", that's the one working, and the one that doesn't is "UserAgent:BrowserVersion = 44.0".


来源: stackexchange

问:
How do I create a custom single post template by using custom plugin in WordPress?
This is possible create single post template by using custom plugin.

I want to create a single post template through my custom plugin.

ContentLicense: CC BY-SA 4.0


问:
ASP.NET Web API AllowAnonymous should not create new session
We have asp.net API (NOT core).

For every request (including anonymous endpoints) we creates a new session which sends it to redis.
So, we should not need to have a session for anonymous requests.

We have the following code in global.asax.cs

```<code>protected void Application_PostAuthorizeRequest()
    {
        HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
    }
</code>```

Can I check in the Application_PostAuthorizeRequest method - does the action have the [AllowAnonymous] attribute?

If I move the code from Application_PostAuthorizeRequest to, say, ActionFilterAttribute, then when I call HttpContext.Current.SetSessionStateBehavior I get an error:

```<code>HttpContext.SetSessionStateBehavior' can only be invoked before 'HttpApplication.AcquireRequestState' event is raised.
</code>```

Body:
We have asp.net API (NOT core).

For every request (including anonymous endpoints) we creates a new session which sends it to redis.
So, we should not need to have a session for anonymous requests.

We have the following code in global.asax.cs

protected void Application_PostAuthorizeRequest()
    {
        HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
    }

Can I check in the Application_PostAuthorizeRequest method - does the action have the [AllowAnonymous] attribute?

If I move the code from Application_PostAuthorizeRequest to, say, ActionFilterAttribute, then when I call HttpContext.Current.SetSessionStateBehavior I get an error:

HttpContext.SetSessionStateBehavior' can only be invoked before 'HttpApplication.AcquireRequestState' event is raised.


问:
Eureka Server : Instance is registered with eureka but not receiving any response from that instance
Instances are registered with eureka server but if we try to call any instance we are unable to get response from those instance.

Doubt: in eureka dashboard

```<code> Renews Threshold: 6
  Renews (last min) : 24
</code>```

is this correct , Please help me to understand above one ?

in eureka serve application.yml:

```<code>eureka:
  server:
    renewal-percent-threshold: 0.49
</code>```

WE USED ABOVE CONFIGURATIONS IN EUREKA SERVER .

Body:
Instances are registered with eureka server but if we try to call any instance we are unable to get response from those instance.

Doubt: in eureka dashboard

 Renews Threshold: 6
  Renews (last min) : 24

is this correct , Please help me to understand above one ?

in eureka serve application.yml:

eureka:
  server:
    renewal-percent-threshold: 0.49

WE USED ABOVE CONFIGURATIONS IN EUREKA SERVER .


问:
High Disk Write failure in Couchbase
Couchbase: 6.5

Cluster Size:

Node A: 16 GB, 4 Core

Node B: 16 GB, 4 Core

Total Buckets: 20

Bucket Type: Couchabse

For some buckets seeing thousands of Disk Write Failure [ep_data_write_failed] on Node B.

Issue Started when Node B utilised 100% of the disk space. We increased the disk space to resolve the issue, but the ep_data_write_failed is still more than 80K.

On Node B 1 min Load average is around 9

memcached.log  is showing the following errors:

```<code>2022-12-28T08:37:33.480485+00:00 WARNING (bucket_name) Slow runtime for 'Updating stat snapshot on disk' on thread writer_worker_2: 369 ms
2022-12-28T08:37:33.544540+00:00 WARNING (bucket_name) Slow runtime for 'Updating stat snapshot on disk' on thread writer_worker_3: 350 ms
2022-12-28T08:37:33.560675+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 418 ms
2022-12-28T08:37:33.816981+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 976 ms
2022-12-28T08:37:34.593583+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 776 ms
2022-12-28T08:37:35.586048+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 990 ms
2022-12-28T08:37:36.266331+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 679 ms
2022-12-28T08:37:37.000314+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 733 ms
2022-12-28T08:37:37.707179+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 706 ms
2022-12-28T08:37:38.552471+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 844 ms
2022-12-28T08:37:39.408739+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 852 ms
2022-12-28T08:37:40.257125+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 846 ms
2022-12-28T08:37:41.067766+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 810 ms
</code>```

Did anyone faced the same issue? Need help in understanding the log messages.

Title: High Disk Write failure in Couchbase

Body:
Couchbase: 6.5

Cluster Size:

Node A: 16 GB, 4 Core

Node B: 16 GB, 4 Core

Total Buckets: 20

Bucket Type: Couchabse

For some buckets seeing thousands of Disk Write Failure [ep_data_write_failed] on Node B.

Issue Started when Node B utilised 100% of the disk space. We increased the disk space to resolve the issue, but the ep_data_write_failed is still more than 80K.

On Node B 1 min Load average is around 9

memcached.log  is showing the following errors:

2022-12-28T08:37:33.480485+00:00 WARNING (bucket_name) Slow runtime for 'Updating stat snapshot on disk' on thread writer_worker_2: 369 ms
2022-12-28T08:37:33.544540+00:00 WARNING (bucket_name) Slow runtime for 'Updating stat snapshot on disk' on thread writer_worker_3: 350 ms
2022-12-28T08:37:33.560675+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 418 ms
2022-12-28T08:37:33.816981+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 976 ms
2022-12-28T08:37:34.593583+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 776 ms
2022-12-28T08:37:35.586048+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_1: 990 ms
2022-12-28T08:37:36.266331+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 679 ms
2022-12-28T08:37:37.000314+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 733 ms
2022-12-28T08:37:37.707179+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 706 ms
2022-12-28T08:37:38.552471+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 844 ms
2022-12-28T08:37:39.408739+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 852 ms
2022-12-28T08:37:40.257125+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 846 ms
2022-12-28T08:37:41.067766+00:00 WARNING (bucket_name) Slow runtime for 'Item pager on vb:1024' on thread nonIO_worker_0: 810 ms

Did anyone faced the same issue? Need help in understanding the log messages.


问:
How to get file from CacheMemory with flutter?
actually, I have a file stored in the application cache memory. When I try to fetch this file from the cache I always got null as path

this is the code:

```<code>Future getData() async {

  String fileName = 'file.txt';
  Directory tempDir = await getTemporaryDirectory();
  print(tempDir);
  String path = '${tempDir.path}/$fileName';
  print('PPP $path');

var file= await DefaultCacheManager().getFileFromCache(path);

print(file?.file.path);

</code>```

I'm sure that the path that I give it to getFileFromCache() is correct. Any help please ?

Body:
actually, I have a file stored in the application cache memory. When I try to fetch this file from the cache I always got null as path

this is the code:

Future getData() async {

  String fileName = 'file.txt';
  Directory tempDir = await getTemporaryDirectory();
  print(tempDir);
  String path = '${tempDir.path}/$fileName';
  print('PPP $path');

var file= await DefaultCacheManager().getFileFromCache(path);

print(file?.file.path);

I'm sure that the path that I give it to getFileFromCache() is correct. Any help please ?


问:
Failing to fetch .msg file attachment from ews exchange server ews-javascript-api
I have been using ews-javascript-api for fetching the emails and attachments. The below code fails to fetch the .msg file attachments.

Approach 1: Works for non .msg file attachments but fails for .msg file type:
await file.Load()

Approach 2: Fails to fetch the .msg file type attachment (Refer below code).

```<code>const {  PropertySet,  ItemSchema} = require('ews-javascript-api')

      const itemId = new ItemId(file.id)
      const ATTACHMENT_PROP_SET = new PropertySet([ItemSchema.MimeContent])
      const msgEmailItem = await EmailMessage.Bind(EWS, itemId, ATTACHMENT_PROP_SET)
      const base64Content = msgEmailItem.MimeContent.content
</code>```

Body:
I have been using ews-javascript-api for fetching the emails and attachments. The below code fails to fetch the .msg file attachments.

Approach 1: Works for non .msg file attachments but fails for .msg file type:
await file.Load()

Approach 2: Fails to fetch the .msg file type attachment (Refer below code).

const {  PropertySet,  ItemSchema} = require('ews-javascript-api')

      const itemId = new ItemId(file.id)
      const ATTACHMENT_PROP_SET = new PropertySet([ItemSchema.MimeContent])
      const msgEmailItem = await EmailMessage.Bind(EWS, itemId, ATTACHMENT_PROP_SET)
      const base64Content = msgEmailItem.MimeContent.content


问:
Adding an action to the "Save" button in the Django admin
I have a new window (Django admin - adding a new model) opening using javascript

I would like certain actions to be performed when clicking the "Save" button in the window that opens

Now my function looks like this:

```<code>function winOpen() {
    tab = window.open('/admin/drevo/znanie/add/', 'tab', 'Width=550,Height=400')
    newZnanie()
    function newZnanie() {
    const data = {};
    let url = "{% url 'show_new_znanie' %}"

    fetch(url, {
       method: 'POST',
       headers: {
           'Content-Type': 'application/json',
           'X-CSRFToken': csrftoken
       },
        body: JSON.stringify(data),
    })
    .then(response => response.json())
    .then(data => {
        znanie_choice.innerHTML = `<option value="${data[0]}" selescted>${data[1]}</option>`
        getZnanieId(data[0])
    })
    .catch((error) => {
    console.log('Error:', error);
    });
    }
}
</code>```

I would like the newZnanie function to be executed after clicking the "Save" (in the django administration window) button inside the new window

Body:
I have a new window (Django admin - adding a new model) opening using javascript

I would like certain actions to be performed when clicking the "Save" button in the window that opens

Now my function looks like this:

function winOpen() {
    tab = window.open('/admin/drevo/znanie/add/', 'tab', 'Width=550,Height=400')
    newZnanie()
    function newZnanie() {
    const data = {};
    let url = "{% url 'show_new_znanie' %}"

    fetch(url, {
       method: 'POST',
       headers: {
           'Content-Type': 'application/json',
           'X-CSRFToken': csrftoken
       },
        body: JSON.stringify(data),
    })
    .then(response => response.json())
    .then(data => {
        znanie_choice.innerHTML = `<option value="${data[0]}" selescted>${data[1]}</option>`
        getZnanieId(data[0])
    })
    .catch((error) => {
    console.log('Error:', error);
    });
    }
}

I would like the newZnanie function to be executed after clicking the "Save" (in the django administration window) button inside the new window


问:
Cannot Login With Auth Firebase on Nestjs
Here I am a new nestjs user. This time I created a login form using auth from Firebase. But when I try to run the postmant login it keeps failing, even though the email and password that was created on Firebase are correct but an error appears. Is there an error in writing my function on the backend. Please help. Here's the source code function

```<code>async validateUser({ authLoginDto }: { authLoginDto: AuthLoginDto; }): Promise<User> {
    const { email, password } = authLoginDto;

    const user = await this.usersService.findByEmail(email);
    if (!(await user?.validatePassword(password))) {
      throw new UnauthorizedException({
        status: 401,
        message: 'Invalid credentials',
      });
  }
    return user;
  }
}
</code>```

Here's what the terminal looks like
enter image description here

The following is the view of the postman

enter image description here

I have tried various ways but still failed

Body:
Here I am a new nestjs user. This time I created a login form using auth from Firebase. But when I try to run the postmant login it keeps failing, even though the email and password that was created on Firebase are correct but an error appears. Is there an error in writing my function on the backend. Please help. Here's the source code function

async validateUser({ authLoginDto }: { authLoginDto: AuthLoginDto; }): Promise<User> {
    const { email, password } = authLoginDto;

    const user = await this.usersService.findByEmail(email);
    if (!(await user?.validatePassword(password))) {
      throw new UnauthorizedException({
        status: 401,
        message: 'Invalid credentials',
      });
  }
    return user;
  }
}

Here's what the terminal looks like
enter image description here

The following is the view of the postman

enter image description here

I have tried various ways but still failed


问:
How can I speed up the import speed when using NebulaGraph Exchange to import data into NebulaGraph database?
I'm testing the Nebula Graph database against different data sets, currently using the Twitter data set. I want to import larger data sets for performance testing, but the import with NebulaGraph importer was not so fast. So I plan to use the Spark tool NebulaGraph Exchange.

Question is, how I can speed up the import process when importing CSV data into Nebula Graph with Exchange?

Part of my configuration is as follows. Some of the parameters have been replaced with fake information to ensure data security, but the Exchange parameters remain unchanged.

```<code>{
  # Spark configuration
  spark: {
    app: {
      name: NebulaGraph Exchange 3.3.0
    }
    driver: {
      cores: 1
      maxResultSize: 1G
    }
    executor: {
        memory:1G
    }

    cores: {
      max: 16
    }
  }

  # NebulaGraph configuration
  nebula: {
    address:{
      # Specify the IP addresses and ports for Graph and Meta services.
      # If there are multiple addresses, the format is "ip1:port","ip2:port","ip3:port".
      # Addresses are separated by commas.
      graph:["127.0.0.1:9669"]
      meta:["127.0.0.1:9559"]
    }

    # The account entered must have write permission for the NebulaGraph space.
    user: ********
    pswd: *******

    # Fill in the name of the graph space you want to write data to in the NebulaGraph.
    space: basketballplayer
    connection: {
      timeout: 3000
      retry: 3
    }
    execution: {
      retry: 3
    }
    error: {
      max: 32
      output: /tmp/errors
    }
    rate: {
      limit: 1024
      timeout: 1000
    }
  }

  # Processing vertexes
  tags: [
    # Set the information about the Tag player.
    {
      # Specify the Tag name defined in NebulaGraph.
      name: player
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://10.0.*.*:9000/data/vertex_player.csv"

      # If the CSV file does not have a header, use [_c0, _c1, _c2, ..., _cn] to represent its header and indicate the columns as the source of the property values.
      # If the CSV file has headers, use the actual column names.
      fields: [_c1, _c2]

      # Specify the column names in the player table in fields, and their corresponding values are specified as properties in the NebulaGraph.
      # The sequence of fields and nebula.fields must correspond to each other.
      nebula.fields: [age, name]

      # Specify a column of data in the table as the source of vertex VID in the NebulaGraph.
      # The value of vertex must be the same as the column names in the above fields or csv.fields.
      # Currently, NebulaGraph 3.3.0 supports only strings or integers of VID.
      vertex: {
        field:_c0
        # policy:hash
      }

      # The delimiter specified. The default value is comma.
      separator: ","

      # If the CSV file has a header, set the header to true.
      # If the CSV file does not have a header, set the header to false. The default value is false.
      header: false

      # The number of data written to NebulaGraph in a single batch.
      batch: 256

      # The number of Spark partitions.
      partition: 32
    }

    # Set the information about the Tag Team.
    {
      # Specify the Tag name defined in NebulaGraph.
      name: team
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://192.168.*.*:9000/data/vertex_team.csv"

      # If the CSV file does not have a header, use [_c0, _c1, _c2, ..., _cn] to represent its header and indicate the columns as the source of the property values.
      # If the CSV file has headers, use the actual column names.
      fields: [_c1]

      # Specify the column names in the player table in fields, and their corresponding values are specified as properties in the NebulaGraph.
      # The sequence of fields and nebula.fields must correspond to each other.
      nebula.fields: [name]

      # Specify a column of data in the table as the source of VIDs in the NebulaGraph.
      # The value of vertex must be the same as the column names in the above fields or csv.fields.
      # Currently, NebulaGraph 3.3.0 supports only strings or integers of VID.
      vertex: {
        field:_c0
        # policy:hash
      }

      # The delimiter specified. The default value is comma.
      separator: ","

      # If the CSV file has a header, set the header to true.
      # If the CSV file does not have a header, set the header to false. The default value is false.
      header: false

      # The number of data written to NebulaGraph in a single batch.
      batch: 256

      # The number of Spark partitions.
      partition: 32
    }

    # If more vertexes need to be added, refer to the previous configuration to add them.
  ]
  # Processing edges
  edges: [
    # Set the information about the Edge Type follow.
    {
      # Specify the Edge Type name defined in NebulaGraph.
      name: follow
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://10.0.*.*:9000/data/edge_follow.csv"

      fields: [_c2]

      nebula.fields: [degree]
      source: {
        field: _c0
      }
      target: {
        field: _c1
      }
      separator: ","
      header: false
      batch: 256
      partition: 32
    }

    {
      name: serve
      type: {
        source: csv

        sink: client
      }

      path: "hdfs://192.168.*.*:9000/data/edge_serve.csv"

      fields: [_c2,_c3]

      nebula.fields: [start_year, end_year]
      source: {
        field: _c0
      }
      target: {
        field: _c1
      }
      separator: ","
      header: false
      batch: 256
      partition: 32
    }

  ]
}
</code>```

Body:
I'm testing the Nebula Graph database against different data sets, currently using the Twitter data set. I want to import larger data sets for performance testing, but the import with NebulaGraph importer was not so fast. So I plan to use the Spark tool NebulaGraph Exchange.

Question is, how I can speed up the import process when importing CSV data into Nebula Graph with Exchange?

Part of my configuration is as follows. Some of the parameters have been replaced with fake information to ensure data security, but the Exchange parameters remain unchanged.

{
  # Spark configuration
  spark: {
    app: {
      name: NebulaGraph Exchange 3.3.0
    }
    driver: {
      cores: 1
      maxResultSize: 1G
    }
    executor: {
        memory:1G
    }

    cores: {
      max: 16
    }
  }

  # NebulaGraph configuration
  nebula: {
    address:{
      # Specify the IP addresses and ports for Graph and Meta services.
      # If there are multiple addresses, the format is "ip1:port","ip2:port","ip3:port".
      # Addresses are separated by commas.
      graph:["127.0.0.1:9669"]
      meta:["127.0.0.1:9559"]
    }

    # The account entered must have write permission for the NebulaGraph space.
    user: ********
    pswd: *******

    # Fill in the name of the graph space you want to write data to in the NebulaGraph.
    space: basketballplayer
    connection: {
      timeout: 3000
      retry: 3
    }
    execution: {
      retry: 3
    }
    error: {
      max: 32
      output: /tmp/errors
    }
    rate: {
      limit: 1024
      timeout: 1000
    }
  }

  # Processing vertexes
  tags: [
    # Set the information about the Tag player.
    {
      # Specify the Tag name defined in NebulaGraph.
      name: player
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://10.0.*.*:9000/data/vertex_player.csv"

      # If the CSV file does not have a header, use [_c0, _c1, _c2, ..., _cn] to represent its header and indicate the columns as the source of the property values.
      # If the CSV file has headers, use the actual column names.
      fields: [_c1, _c2]

      # Specify the column names in the player table in fields, and their corresponding values are specified as properties in the NebulaGraph.
      # The sequence of fields and nebula.fields must correspond to each other.
      nebula.fields: [age, name]

      # Specify a column of data in the table as the source of vertex VID in the NebulaGraph.
      # The value of vertex must be the same as the column names in the above fields or csv.fields.
      # Currently, NebulaGraph 3.3.0 supports only strings or integers of VID.
      vertex: {
        field:_c0
        # policy:hash
      }

      # The delimiter specified. The default value is comma.
      separator: ","

      # If the CSV file has a header, set the header to true.
      # If the CSV file does not have a header, set the header to false. The default value is false.
      header: false

      # The number of data written to NebulaGraph in a single batch.
      batch: 256

      # The number of Spark partitions.
      partition: 32
    }

    # Set the information about the Tag Team.
    {
      # Specify the Tag name defined in NebulaGraph.
      name: team
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://192.168.*.*:9000/data/vertex_team.csv"

      # If the CSV file does not have a header, use [_c0, _c1, _c2, ..., _cn] to represent its header and indicate the columns as the source of the property values.
      # If the CSV file has headers, use the actual column names.
      fields: [_c1]

      # Specify the column names in the player table in fields, and their corresponding values are specified as properties in the NebulaGraph.
      # The sequence of fields and nebula.fields must correspond to each other.
      nebula.fields: [name]

      # Specify a column of data in the table as the source of VIDs in the NebulaGraph.
      # The value of vertex must be the same as the column names in the above fields or csv.fields.
      # Currently, NebulaGraph 3.3.0 supports only strings or integers of VID.
      vertex: {
        field:_c0
        # policy:hash
      }

      # The delimiter specified. The default value is comma.
      separator: ","

      # If the CSV file has a header, set the header to true.
      # If the CSV file does not have a header, set the header to false. The default value is false.
      header: false

      # The number of data written to NebulaGraph in a single batch.
      batch: 256

      # The number of Spark partitions.
      partition: 32
    }

    # If more vertexes need to be added, refer to the previous configuration to add them.
  ]
  # Processing edges
  edges: [
    # Set the information about the Edge Type follow.
    {
      # Specify the Edge Type name defined in NebulaGraph.
      name: follow
      type: {
        # Specify the data source file format to CSV.
        source: csv

        # Specify how to import the data into NebulaGraph: Client or SST.
        sink: client
      }

      # Specify the path to the CSV file.
      # If the file is stored in HDFS, use double quotation marks to enclose the file path, starting with hdfs://. For example: "hdfs://ip:port/xx/xx".
      # If the file is stored locally, use double quotation marks to enclose the file path, starting with file://. For example: "file:///tmp/xx.csv".
      path: "hdfs://10.0.*.*:9000/data/edge_follow.csv"

      fields: [_c2]

      nebula.fields: [degree]
      source: {
        field: _c0
      }
      target: {
        field: _c1
      }
      separator: ","
      header: false
      batch: 256
      partition: 32
    }

    {
      name: serve
      type: {
        source: csv

        sink: client
      }

      path: "hdfs://192.168.*.*:9000/data/edge_serve.csv"

      fields: [_c2,_c3]

      nebula.fields: [start_year, end_year]
      source: {
        field: _c0
      }
      target: {
        field: _c1
      }
      separator: ","
      header: false
      batch: 256
      partition: 32
    }

  ]
}


问:
EF core - same statement has different results in query and after fetching data
Title may be misleading, here's what happens:

var resp = await DbContext.Events
    .AsNoTracking()
    .Where(t => t.Id == eventId)
    .Select(t => new EventGeneralInfoDTO
    {
        Id = t.Id,
        IsRedirectionAvailable = t.Status == (int)EventStatus.Open &&
        (t.StartDate.HasValue && ((DateTimeOffset)t.StartDate).ToUnixTimeSeconds() < DateTimeOffset.UtcNow.ToUnixTimeSeconds())
            && (t.EndDate.HasValue && ((DateTimeOffset)t.EndDate).ToUnixTimeSeconds() > DateTimeOffset.UtcNow.ToUnixTimeSeconds())
        && !t.HasNewVersion
    }).FirstOrDefaultAsync();
```
<p>here, IsRedirectionAvailable is false (should be true however). But if I do something like this:</p>
<pre class="lang-cs prettyprint-override"><code>var test = DbContext.Events.First(a => a.Id == eventId);
resp.IsRedirectionAvailable = test.Status == (int)EventStatus.Open &&
            (test.StartDate.HasValue && ((DateTimeOffset)test.StartDate).ToUnixTimeSeconds() < DateTimeOffset.UtcNow.ToUnixTimeSeconds())
                && (test.EndDate.HasValue && ((DateTimeOffset)test.EndDate).ToUnixTimeSeconds() > DateTimeOffset.UtcNow.ToUnixTimeSeconds())
            && !test.HasNewVersion;
</code>```

it is true. I think some of the expressions can't be translated to sql, but I though that when it happens, query throws an exception. Was it changed in 7.0? If no, why am I getting different results?

Edit 1. Generated SQL:

```<code>  Executed DbCommand (1,902ms) [Parameters=[@__eventId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
  SELECT TOP(1) [t].[Id], [t].[EventId], [t].[RfxId], [t].[Name], [t].[OrganizationName], [t].[OrganizationId], CASE
      WHEN [t].[EnvelopeOpeingDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[EnvelopeOpeingDate] AS datetimeoffset), CASE
      WHEN [t].[EndDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[EndDate] AS datetimeoffset), CASE
      WHEN [t].[StartDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[StartDate] AS datetimeoffset), CASE
      WHEN [t].[TemporaryComplinceDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[TemporaryComplinceDate] AS datetimeoffset), [t].[BudgetCategoryCode], [t].[Address], (
      SELECT TOP(1) [l].[CPVCode]
      FROM [LotInfo] AS [l]
      WHERE [t].[Id] = [l].[PublicEventId]), CAST([t].[EventType] AS int), CASE
      WHEN [t].[Status] = 1 THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CASE
      WHEN [t].[StartDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST(SYSUTCDATETIME() AS datetimeoffset), CASE
      WHEN [t].[EndDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CASE
      WHEN [t].[HasNewVersion] = CAST(0 AS bit) THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END
  FROM [Events] AS [t]
  WHERE [t].[Id] = @__eventId_0
</code>```

(I omitted unrelated fields from code, that's why query is bigger)
Apparently, it ignores fields that are not columns (I believe it wasn't like that before, maybe I'm wrong), in this case there is no IsRedirectionAvailable column. Is this new thing or I just never encountered it?

Edit 2. Yes, it was because of DateTimeOffset conversion. However, I expected to get an exception (since EF Core 3.0 if your query can't be translated to SQL query, it throwed an exception). I didn't get it, so I was thinking that the query is fine. Looks like this behavior was changed in later versions, and you no longer get an exception. Thanks for helping.

Body:
Title may be misleading, here's what happens:

var resp = await DbContext.Events
    .AsNoTracking()
    .Where(t => t.Id == eventId)
    .Select(t => new EventGeneralInfoDTO
    {
        Id = t.Id,
        IsRedirectionAvailable = t.Status == (int)EventStatus.Open &&
        (t.StartDate.HasValue && ((DateTimeOffset)t.StartDate).ToUnixTimeSeconds() < DateTimeOffset.UtcNow.ToUnixTimeSeconds())
            && (t.EndDate.HasValue && ((DateTimeOffset)t.EndDate).ToUnixTimeSeconds() > DateTimeOffset.UtcNow.ToUnixTimeSeconds())
        && !t.HasNewVersion
    }).FirstOrDefaultAsync();

here, IsRedirectionAvailable is false (should be true however). But if I do something like this:

var test = DbContext.Events.First(a => a.Id == eventId);
resp.IsRedirectionAvailable = test.Status == (int)EventStatus.Open &&
            (test.StartDate.HasValue && ((DateTimeOffset)test.StartDate).ToUnixTimeSeconds() < DateTimeOffset.UtcNow.ToUnixTimeSeconds())
                && (test.EndDate.HasValue && ((DateTimeOffset)test.EndDate).ToUnixTimeSeconds() > DateTimeOffset.UtcNow.ToUnixTimeSeconds())
            && !test.HasNewVersion;

it is true. I think some of the expressions can't be translated to sql, but I though that when it happens, query throws an exception. Was it changed in 7.0? If no, why am I getting different results?

Edit 1. Generated SQL:

  Executed DbCommand (1,902ms) [Parameters=[@__eventId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
  SELECT TOP(1) [t].[Id], [t].[EventId], [t].[RfxId], [t].[Name], [t].[OrganizationName], [t].[OrganizationId], CASE
      WHEN [t].[EnvelopeOpeingDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[EnvelopeOpeingDate] AS datetimeoffset), CASE
      WHEN [t].[EndDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[EndDate] AS datetimeoffset), CASE
      WHEN [t].[StartDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[StartDate] AS datetimeoffset), CASE
      WHEN [t].[TemporaryComplinceDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST([t].[TemporaryComplinceDate] AS datetimeoffset), [t].[BudgetCategoryCode], [t].[Address], (
      SELECT TOP(1) [l].[CPVCode]
      FROM [LotInfo] AS [l]
      WHERE [t].[Id] = [l].[PublicEventId]), CAST([t].[EventType] AS int), CASE
      WHEN [t].[Status] = 1 THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CASE
      WHEN [t].[StartDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CAST(SYSUTCDATETIME() AS datetimeoffset), CASE
      WHEN [t].[EndDate] IS NOT NULL THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END, CASE
      WHEN [t].[HasNewVersion] = CAST(0 AS bit) THEN CAST(1 AS bit)
      ELSE CAST(0 AS bit)
  END
  FROM [Events] AS [t]
  WHERE [t].[Id] = @__eventId_0

(I omitted unrelated fields from code, that's why query is bigger)
Apparently, it ignores fields that are not columns (I believe it wasn't like that before, maybe I'm wrong), in this case there is no IsRedirectionAvailable column. Is this new thing or I just never encountered it?

Edit 2. Yes, it was because of DateTimeOffset conversion. However, I expected to get an exception (since EF Core 3.0 if your query can't be translated to SQL query, it throwed an exception). I didn't get it, so I was thinking that the query is fine. Looks like this behavior was changed in later versions, and you no longer get an exception. Thanks for helping.


问:
How to pass an optional image through my django, by accepting from views.py
I want to accept an optional image from the user and pass it via my form, but it keeps popping up with multivaluedictkeyerror (i have added the enctype = "multipart/form-data")
ps. im new to django

this is my views.py

```<code>def notes(request):
    if request.method == "POST":
        form =NotesForm(request.POST, request.FILES or None)
        if form.is_valid():
            notes  = Notes(user=request.user, title = request.POST['title'],description=request.POST['description'], pictures= request.FILES['pictures'])        #pictures= request.FILES['pictures']
            notes.save()
        messages.success(request,f"Notes added for {request.user.username} successfully!")
    else:
        form=NotesForm()
    notes=Notes.objects.filter(user=request.user)       #when logged in user wants to access all created notes, stores in notes variable
    context= {'notes':notes , 'form':form}
    return render(request,'dashboard/notes.html',context)

</code>```

this is my models.py

```<code>from django.db import models
from django.contrib.auth.models import User

class Notes(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    pictures=models.ImageField(null=True,blank=True, upload_to="images/")
    description= models.TextField()

</code>```

template,

```<code><p class="description m-5 p-5">
                {{notes.description}}
                <br><center>
                {% if notes.pictures %}
                    <img class="fit-picture" style="border: 1px solid #555; max-width:80%; max-height:80%;" src = "{{ notes.pictures.url }}">
                {% endif %}
            </p>
</code>```

I accepted the passed value through request.Files[''], but it is a compulsory field, and i wanted an optional

Body:
I want to accept an optional image from the user and pass it via my form, but it keeps popping up with multivaluedictkeyerror (i have added the enctype = "multipart/form-data")
ps. im new to django

this is my views.py

def notes(request):
    if request.method == "POST":
        form =NotesForm(request.POST, request.FILES or None)
        if form.is_valid():
            notes  = Notes(user=request.user, title = request.POST['title'],description=request.POST['description'], pictures= request.FILES['pictures'])        #pictures= request.FILES['pictures']
            notes.save()
        messages.success(request,f"Notes added for {request.user.username} successfully!")
    else:
        form=NotesForm()
    notes=Notes.objects.filter(user=request.user)       #when logged in user wants to access all created notes, stores in notes variable
    context= {'notes':notes , 'form':form}
    return render(request,'dashboard/notes.html',context)

this is my models.py

from django.db import models
from django.contrib.auth.models import User

class Notes(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    pictures=models.ImageField(null=True,blank=True, upload_to="images/")
    description= models.TextField()

template,

                {{notes.description}}

                {% if notes.pictures %}

                {% endif %}

I accepted the passed value through request.Files[''], but it is a compulsory field, and i wanted an optional


问:
Boosting product sales: confusion supervised vs unsupervised
I am struggling with a simple commercial objective: let's say we want to boost a sale of a toy in a given country, through an action (sending email to customers). I want to select the customers for sending, and for a personalized email on the toy.

Approach 1: clustering of clients (unsupervised), to understand what are the profiles of our clients. This will give me groups of clients sharing the same characteristics.

Approach 2: for each client, I predict the probability of buying a toy (supervised, using the purchase bahaviour of my existing clients) and based on that I select clients to send the communication to.

Can both approaches work?

What worries me in the clustering is that the groups will be created based on the minimization of the distance between all variables, while I want to have homogeneous groups in terms of the purchase behaviour of the toy.
I expect to see for example that being a parent is an important feature. In the clustering, it will be "one feature between others", while in approach 2 "buying a toy" will be the target variable, so probably "being a parent" will be triggered important.
So maybe I could choose some variables for the clustering, with help of a decision tree for example. This means combining both supervised and unsupervised.

Is my reasoning correct or did I miss something in the theory? Many thanks for your help!


问:
.Net Core Project on Linux Server
I have completed my .Net Core project. As you can see in the picture below, I have published for linux. Now how do I send these publish files to the server? I decided to give it a try on xammp. I put the Publish files in the htdocs folder in xampp. Now I ran the apache server. But my project is not working and the folder directory is coming. How do I run my project on the server?

Title: .Net Core Project on Linux Server


问:
Pomelo.EntityFrameworkCore.MySql connection string problem
I'm trying to create MySQL server container, save it's data to volume and then connect to it from another container with ASP.NET Core application. I stucked on part with connection to MySQL server.

My connection string:

```<code>"ConnectionStrings": {
    "ProductDbConnection": "server=0.0.0.0:13306;port=3306;User=root;Password=qwerty;Database=products;"
  }
</code>```

Adding DbContext to service container in ASP.NET Core application:
`

```<code>var serverVersion = new MySqlServerVersion("8.0.31");
builder.Services.AddDbContext<ProductDbContext>(
    options => options.UseMySql(builder.Configuration.GetConnectionString("ProductDbConnection"), serverVersion,
    options => options.EnableRetryOnFailure(3, TimeSpan.FromSeconds(2), null)));
</code>```

My docker file:

```<code>FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY dist /app
WORKDIR /app
EXPOSE 80/tcp
ENTRYPOINT ["dotnet", "ExampleApp.dll"]
</code>```

When I ran my ASP.NET Core application container i got errors messages like this:

```<code>fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
2022-12-28 11:34:21       An error occurred using the connection to database '' on server '0.0.0.0:13306'.
2022-12-28 11:34:21 info: Microsoft.EntityFrameworkCore.Infrastructure[10404]
</code>```

looks like it lost my database name from connection string. I tried to change server address to address like in network bridge, but result is the same. Help me please. Feels like i missed a little detail somewhere.

Body:
I'm trying to create MySQL server container, save it's data to volume and then connect to it from another container with ASP.NET Core application. I stucked on part with connection to MySQL server.

My connection string:

"ConnectionStrings": {
    "ProductDbConnection": "server=0.0.0.0:13306;port=3306;User=root;Password=qwerty;Database=products;"
  }

Adding DbContext to service container in ASP.NET Core application:
`

var serverVersion = new MySqlServerVersion("8.0.31");
builder.Services.AddDbContext<ProductDbContext>(
    options => options.UseMySql(builder.Configuration.GetConnectionString("ProductDbConnection"), serverVersion,
    options => options.EnableRetryOnFailure(3, TimeSpan.FromSeconds(2), null)));

My docker file:

FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY dist /app
WORKDIR /app
EXPOSE 80/tcp
ENTRYPOINT ["dotnet", "ExampleApp.dll"]

When I ran my ASP.NET Core application container i got errors messages like this:

fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
2022-12-28 11:34:21       An error occurred using the connection to database '' on server '0.0.0.0:13306'.
2022-12-28 11:34:21 info: Microsoft.EntityFrameworkCore.Infrastructure[10404]

looks like it lost my database name from connection string. I tried to change server address to address like in network bridge, but result is the same. Help me please. Feels like i missed a little detail somewhere.


问:
MongoDB - Unrecognized option: sharding.configDB
I'm trying to connect the config with the command:

mongod --config etc/mongod.conf

But it error:

Unrecognized option: sharding.configDB

My mongod.conf:

```<code># mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
#storage:
#  dbPath: /var/lib/mongodb
#  journal:
#    enabled: true
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1,93.115.21.61

# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

security:
  keyFile: /home/ubuntu/mongo-security/keyfile.txt

#operationProfiling:

#replication:

sharding:
  configDB: "config/2.56.213.3:27017"

## Enterprise-Only Options:

#auditLog:

#snmp:

</code>```

MongoDB server version: 3.6.3

Help please!

Body:
I'm trying to connect the config with the command:

mongod --config etc/mongod.conf

But it error:

Unrecognized option: sharding.configDB

My mongod.conf:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
#storage:
#  dbPath: /var/lib/mongodb
#  journal:
#    enabled: true
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1,93.115.21.61

# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

security:
  keyFile: /home/ubuntu/mongo-security/keyfile.txt

#operationProfiling:

#replication:

sharding:
  configDB: "config/2.56.213.3:27017"

## Enterprise-Only Options:

#auditLog:

#snmp:

MongoDB server version: 3.6.3

Help please!


问:
NPE with wildfly 14.0.0. openssl
`My team is using WildFly 14.0.0. we recently upgraded to Ubuntu 20.04. Wildfly server is unable to start after the upgraddation and throws below error.

```<code>2022-12-27 12:08:23,265 ERROR [org.xnio.listener] (default I/O-11) XNIO001007: A channel event listener threw an exception: java.lang.NullPointerException
        at org.wildfly.openssl.CipherSuiteConverter.toJava(CipherSuiteConverter.java:284)
        at org.wildfly.openssl.OpenSSLEngine.toJavaCipherSuite(OpenSSLEngine.java:1094)
        at org.wildfly.openssl.OpenSSLEngine.getEnabledCipherSuites(OpenSSLEngine.java:729)
        at org.wildfly.openssl.OpenSSLContextSPI.getCiphers(OpenSSLContextSPI.java:339)
        at org.wildfly.openssl.OpenSSLEngine.getEnabledCipherSuites(OpenSSLEngine.java:720)
        at io.undertow.server.protocol.http.AlpnOpenListener.engineSupportsHTTP2(AlpnOpenListener.java:317)
        at io.undertow.server.protocol.http.AlpnOpenListener$1.apply(AlpnOpenListener.java:232)
        at io.undertow.server.protocol.http.AlpnOpenListener$1.apply(AlpnOpenListener.java:228)
        at io.undertow.server.protocol.http.AlpnOpenListener$SSLConduitUpdater.apply(AlpnOpenListener.java:423)
        at io.undertow.server.protocol.http.AlpnOpenListener$SSLConduitUpdater.apply(AlpnOpenListener.java:412)
        at io.undertow.protocols.alpn.DefaultAlpnEngineManager.registerEngine(DefaultAlpnEngineManager.java:31)
        at io.undertow.protocols.alpn.ALPNManager.registerEngineCallback(ALPNManager.java:80)
        at io.undertow.server.protocol.http.AlpnOpenListener.handleEvent(AlpnOpenListener.java:228)
        at io.undertow.server.protocol.http.AlpnOpenListener.handleEvent(AlpnOpenListener.java:64)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:131)
        at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
</code>```

I looked up a link https://issues.redhat.com/browse/JBEAP-16425  where it is fixed in EAP 7.2.3.
Can anyone help mapping the equivalent version of Wildfly? which will have this fix

OR suggest any other possible fix

Thank you in advance.`

Title: NPE with wildfly 14.0.0. openssl

Body:
`My team is using WildFly 14.0.0. we recently upgraded to Ubuntu 20.04. Wildfly server is unable to start after the upgraddation and throws below error.

2022-12-27 12:08:23,265 ERROR [org.xnio.listener] (default I/O-11) XNIO001007: A channel event listener threw an exception: java.lang.NullPointerException
        at org.wildfly.openssl.CipherSuiteConverter.toJava(CipherSuiteConverter.java:284)
        at org.wildfly.openssl.OpenSSLEngine.toJavaCipherSuite(OpenSSLEngine.java:1094)
        at org.wildfly.openssl.OpenSSLEngine.getEnabledCipherSuites(OpenSSLEngine.java:729)
        at org.wildfly.openssl.OpenSSLContextSPI.getCiphers(OpenSSLContextSPI.java:339)
        at org.wildfly.openssl.OpenSSLEngine.getEnabledCipherSuites(OpenSSLEngine.java:720)
        at io.undertow.server.protocol.http.AlpnOpenListener.engineSupportsHTTP2(AlpnOpenListener.java:317)
        at io.undertow.server.protocol.http.AlpnOpenListener$1.apply(AlpnOpenListener.java:232)
        at io.undertow.server.protocol.http.AlpnOpenListener$1.apply(AlpnOpenListener.java:228)
        at io.undertow.server.protocol.http.AlpnOpenListener$SSLConduitUpdater.apply(AlpnOpenListener.java:423)
        at io.undertow.server.protocol.http.AlpnOpenListener$SSLConduitUpdater.apply(AlpnOpenListener.java:412)
        at io.undertow.protocols.alpn.DefaultAlpnEngineManager.registerEngine(DefaultAlpnEngineManager.java:31)
        at io.undertow.protocols.alpn.ALPNManager.registerEngineCallback(ALPNManager.java:80)
        at io.undertow.server.protocol.http.AlpnOpenListener.handleEvent(AlpnOpenListener.java:228)
        at io.undertow.server.protocol.http.AlpnOpenListener.handleEvent(AlpnOpenListener.java:64)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:131)
        at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)

I looked up a link https://issues.redhat.com/browse/JBEAP-16425  where it is fixed in EAP 7.2.3.
Can anyone help mapping the equivalent version of Wildfly? which will have this fix

OR suggest any other possible fix

Thank you in advance.`


问:
Laravel push notification does not work as except
I am building a real time notification system for  my reminders. And use laravel pusher do create event also created a cron job run everyMinute. As frontent i use vue js component. I save notification to a tasble on debugger, and after event created also save record on db. Now my problem is i fetch notificaton every time i reload pageXOffset, and event does not add record on this.messages=[].

Vue module

```<code>export default {
    template: `
        <div>
            <ul class="navbar-p prevent-close">
                <li v-for="message in messages" :key="message.id" class="dropdown-item d-block ">
                    <span>
                        <i class='bx bxs-low-vision'></i>
                    </span>
                    <p>{{ message.title }}</p>
                    <sup class="text-secondary">{{ message.description }}</sup>
                    <br />
                    <sup class="text-info">DT: {{ message.remindTime }}</sup>
                    <hr class="p-0 m-0" />
                </li>
            </ul>
        </div>
    `,

    data() {
        return {
            messages: [],
        }
    },

    mounted() {
        axios.get('/notifications').then(response => {
            // console.log(response.data.notifiy);
            this.messages = response.data.notifiy;
            $(".fa-bell").addClass('fa-notification-custom-badge');
        })

        // // Enable pusher logging - don't include this in production
        Pusher.logToConsole = true;

        var pusher = new Pusher('14eb3b08697886e4d41a', {
            cluster: 'eu'
        });

        var channel = pusher.subscribe('reminder-notification-chanel');
        var notification = [];
        channel.bind('reminder-notification-event', function(data) {
            // alert(JSON.stringify(data.message))
            // console.log(data.message)
            var dataOb = data.message;

            notification.push(dataOb);
            $(".fa-bell").addClass('fa-notification-custom-badge');

        });

        this.messages.push(notification);
    },

}
</code>```

CronJob laravel

```<code> public function handle(ReminderEventServices $reminderServices)
    {
        // return 0;
        // $getLastReminders = $reminderServices->ReminderEvent();
        $getLastReminders = Reminder::where('remindTime', '<',
            Carbon::now()->addHours(3)/*->addMinutes(2)*/->toDateTimeString()
        )
        ->where('remindTime', '>=',
            Carbon::now()->toDateTimeString()
        )->get();

        if ($getLastReminders) {
            foreach($getLastReminders as $reminder) {
                if (!Notification::where('title', $reminder->title)->exists()) {
                    $notification = Notification::create([
                        'title'         => $reminder->title,
                        'description'   => $reminder->description,
                        'remindTime'    => $reminder->remindTime
                    ]);
                }

                event(new ReminderEvent($reminder));
            }
        }
    }
</code>```

Body:
I am building a real time notification system for  my reminders. And use laravel pusher do create event also created a cron job run everyMinute. As frontent i use vue js component. I save notification to a tasble on debugger, and after event created also save record on db. Now my problem is i fetch notificaton every time i reload pageXOffset, and event does not add record on this.messages=[].

Vue module

export default {
    template: `

{{ message.title }}

                    {{ message.description }}

                    DT: {{ message.remindTime }}

    `,

    data() {
        return {
            messages: [],
        }
    },

    mounted() {
        axios.get('/notifications').then(response => {
            // console.log(response.data.notifiy);
            this.messages = response.data.notifiy;
            $(".fa-bell").addClass('fa-notification-custom-badge');
        })

        // // Enable pusher logging - don't include this in production
        Pusher.logToConsole = true;

        var pusher = new Pusher('14eb3b08697886e4d41a', {
            cluster: 'eu'
        });

        var channel = pusher.subscribe('reminder-notification-chanel');
        var notification = [];
        channel.bind('reminder-notification-event', function(data) {
            // alert(JSON.stringify(data.message))
            // console.log(data.message)
            var dataOb = data.message;

            notification.push(dataOb);
            $(".fa-bell").addClass('fa-notification-custom-badge');

        });

        this.messages.push(notification);
    },

}

CronJob laravel

 public function handle(ReminderEventServices $reminderServices)
    {
        // return 0;
        // $getLastReminders = $reminderServices->ReminderEvent();
        $getLastReminders = Reminder::where('remindTime', '<',
            Carbon::now()->addHours(3)/*->addMinutes(2)*/->toDateTimeString()
        )
        ->where('remindTime', '>=',
            Carbon::now()->toDateTimeString()
        )->get();

        if ($getLastReminders) {
            foreach($getLastReminders as $reminder) {
                if (!Notification::where('title', $reminder->title)->exists()) {
                    $notification = Notification::create([
                        'title'         => $reminder->title,
                        'description'   => $reminder->description,
                        'remindTime'    => $reminder->remindTime
                    ]);
                }

                event(new ReminderEvent($reminder));
            }
        }
    }


问:
Selenium Integration Testing WebApplicationFactory<Program>
I got exception when tried Selenium Integration test.

```<code>OpenQA.Selenium.WebDriverException
unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: headless MicrosoftEdge=108.0.1462.54)
   at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.set_Url(String value)
   at OpenQA.Selenium.Navigator.GoToUrl(String url)
   at Brushtail.AspNetCore.Blazor.Pages.IndexTests.HomePageTest() in D:\Projects\Brushtail-Extensions\Brushtail.Extensions\Brushtail.AspNetCore\Brushtail.AspNetCore.Blazor\Pages\Index.Tests.cs:line 17
</code>```

But HttpClient returns the status code 200

```<code>var result = await Client.GetAsync("/");

result.IsSuccessStatusCode.ShouldBe(true);
</code>```

Major I am using Blazor .NET 7, so I can't use old Startup. I am testing on real db server. Because In Memory database doesn't supports the NetTopologySuite.

```<code>new WebApplicationFactory<Program>()
</code>```

Body:
I got exception when tried Selenium Integration test.

OpenQA.Selenium.WebDriverException
unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: headless MicrosoftEdge=108.0.1462.54)
   at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.set_Url(String value)
   at OpenQA.Selenium.Navigator.GoToUrl(String url)
   at Brushtail.AspNetCore.Blazor.Pages.IndexTests.HomePageTest() in D:\Projects\Brushtail-Extensions\Brushtail.Extensions\Brushtail.AspNetCore\Brushtail.AspNetCore.Blazor\Pages\Index.Tests.cs:line 17

But HttpClient returns the status code 200

var result = await Client.GetAsync("/");

result.IsSuccessStatusCode.ShouldBe(true);

Major I am using Blazor .NET 7, so I can't use old Startup. I am testing on real db server. Because In Memory database doesn't supports the NetTopologySuite.

new WebApplicationFactory<Program>()


问:
Why does my qt creater output a bunch of weird messages in the application output window after starting the application, even though a blank project?
Plotform: Windows 10
Qt Version: 5.14.2
Problem: When I click the run button to lunch the progrem,the there will output many message in application output window,even if this is a new blank qt project.

Problem
Qt Version

```<code>[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[Hook] detach 31616, D:\Srchub\Qt\build-tets-Desktop_Qt_5_14_2_MinGW_64_bit-Release\release\tets.exe
</code>```

I want to know how to close the output of theses strange message.

Body:
Plotform: Windows 10
Qt Version: 5.14.2
Problem: When I click the run button to lunch the progrem,the there will output many message in application output window,even if this is a new blank qt project.

Problem
Qt Version

[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[PREVIEW] recv window msg, name:(Qt5QWindowIcon) hwd:(24118e) isvisiable(1) istopwnd(1) isTool(0) isPreview(0) pid:(31616)
[Hook] detach 31616, D:\Srchub\Qt\build-tets-Desktop_Qt_5_14_2_MinGW_64_bit-Release\release\tets.exe

I want to know how to close the output of theses strange message.


问:
React useContext setState only updates first time
I'm currently building an app which allows a user to collect stamps by scanning a QR code. I have a Firebase Firestore snapshotlistener attached which listens for new stamps being added to that user. And rather than to fetch the new total amount of stamps for that user, I wanted to use the payload of the snapshot and add it to the list of stamps which is saved in a Context.

Unfortunately, this only works the first time when the app has been started. The procedure looks like this:

QR code gets scanned

New snapshot is received with newly added stamps (1 or more)

I'm logging the current state of total stamps to console, which looks OK.

The new stamps get added to the state context.

Logging the context state changes show the stamps were added correctly.

But the second time or any after that it looks like this:

QR code gets scanned

New snapshot is received with newly added stamps (1 or more)

I'm logging the current state of total stamps to console, but this still looks the same as before the first attempt.

The new stamps get added to the old state context.

Logging the context state changes show the stamps were added but the first was removed, so basically the first stamp has been overwritten.

You'd think this is simple, "just check you're dependency arrays". But this looks all okay to me.

Here's how my setup looks:

Context:

const AuthContextProvider = ({ children }: Props) => {
  const [user, setUser] = useState<FirebaseAuthTypes.User>();
  const [userData, setUserData] = useState<FirestoreUser>();
  const [stamps, setStamps] = useState<GetMyStampsResponse>();
  const [isLoading, setLoading] = useState(true);

  // Unimportant for issue
  const onAuthStateChanged = useCallback(
    async (response: FirebaseAuthTypes.User | null) => {
       ...
    },
    [...]
  );

  useEffect(() => {
    const unsubscribe = auth().onUserChanged(onAuthStateChanged);
    return unsubscribe;
  }, [onAuthStateChanged]);

  return (
    <AuthContext.Provider
      value={{
        isLoading,
        stamps,
        setStamps,
        user,
        userData,
        reloadUser,
      }}>
      {children}
    </AuthContext.Provider>
  );
};
```
<p><code>useAuth</code> hook to be used in my components</p>
<pre class="lang-js prettyprint-override"><code>import storage from '@react-native-firebase/storage';
import cloneDeep from 'lodash/cloneDeep';
import { useCallback, useContext } from 'react';

const useAuth = () => {
  const { stamps, setStamps, reloadUser, userData, user, isLoading } =
    useContext(AuthContext);

  /**
   * Add stamps that were received through a listener. This way we don't have to rely on reloadUser, which is more expensive.
   */
  const addStampsFromListener = useCallback(
    async (newStamps: FirestoreStamp[]) => {
      let newStampsState = cloneDeep(stamps);
      const newStampHasKnownStampcard = newStampsState?.cards.find(
        c => c.ref.path === newStamps[0].stampcardRef.path,
      );

      console.log('current stamps state', newStampsState?.stamps.length);

      if (newStampHasKnownStampcard) {
        newStampsState = {
          ...newStampsState!,
          stamps: newStampsState!.stamps.concat(newStamps),
        };
      } else {
        const [stampcard, business] = await Promise.all([
          stampcardApi.getStampcardByRef(newStamps[0].stampcardRef),
          businessApi.getBusiness(newStamps[0].businessId),
        ]);
        const imageUrl = await storage()
          .ref(stampcard!.stampImage)
          .getDownloadURL();

        const stampcardWithRef: StampCardDataWithRef = {
          ...stampcard!,
          imageUrl,
          businessId: newStamps[0].businessId,
          ref: newStamps[0].stampcardRef,
        };
        newStampsState = {
          ...newStampsState,
          businesses: (newStampsState?.businesses ?? []).concat(business!),
          cards: (newStampsState?.cards ?? []).concat(stampcardWithRef),
          stamps: (newStampsState?.stamps ?? []).concat(newStamps),
        };
      }
      setStamps(newStampsState);

      return newStampsState;
    },

    [setStamps, stamps],
  );

  ...

  return {
    addStampsFromListener,
    updateStampsFromListener,
    isLoading,
    data: userData,
    logout,
    reloadUser,
    stamps,
    user,
  };

};
</code>```

And finally, the use of this context hook in my screen:

const HomeConsumerScreen = () => {
  const {
    stamps: stampcards,
    reloadUser,
    addStampsFromListener,
    updateStampsFromListener,
  } = useAuth();

const subscribeToStamps = useCallback(() => {
    if (refIsSubscribedToStamps.current) return; // Prevent initialization when already running

    const unsubscribe = stampApi.subscribeToStamps(
      /**
       * Callback for receiving new stamps
       */
      querySnapshot => {
        error && setError(undefined);
        if (!refIsSubscribedToStamps.current) {
          // First snapshot contains current state of all stamps belonging to a user
          return;
        }

        const data = querySnapshot.map(doc =>
          doc.doc.data(),
        ) as FirestoreStamp[];

        addStampsFromListener(data).then(nextState =>
          showDone('newStamp', data, nextState),
        );
      },
      /**
       * Initializer
       */
      () => {
        refIsSubscribedToStamps.current = true;
      },
      /**
       * Error callback
       */
      e => {
        setError(e.message);
        console.error('onSnapShot', e);
      },
    );

    return unsubscribe;
  }, [addStampsFromListener, error, showDone, updateStampsFromListener]);

  useEffect(() => {
    // Listen for changes to single stampcard
    const unsubscribe = subscribeToStamps();

    return () => {
      unsubscribe && unsubscribe();
      refIsSubscribedToStamps.current = false;
    };
    // Adding 'subscribeToStamps' to dependency hook will cause
    // the listener to unmount&remount on every callback.
    // It will fix the issue that I'm trying to solve here.... :(
  }, []);

};
```

So it seems to revolve around adding subscribeToStamps to the useEffect dependency array, but that causes the listener to unmount&mount again which is just more costly.

Any advice?

Body:
I'm currently building an app which allows a user to collect stamps by scanning a QR code. I have a Firebase Firestore snapshotlistener attached which listens for new stamps being added to that user. And rather than to fetch the new total amount of stamps for that user, I wanted to use the payload of the snapshot and add it to the list of stamps which is saved in a Context.

Unfortunately, this only works the first time when the app has been started. The procedure looks like this:

QR code gets scanned

New snapshot is received with newly added stamps (1 or more)

I'm logging the current state of total stamps to console, which looks OK.

The new stamps get added to the state context.

Logging the context state changes show the stamps were added correctly.

But the second time or any after that it looks like this:

QR code gets scanned

New snapshot is received with newly added stamps (1 or more)

I'm logging the current state of total stamps to console, but this still looks the same as before the first attempt.

The new stamps get added to the old state context.

Logging the context state changes show the stamps were added but the first was removed, so basically the first stamp has been overwritten.

You'd think this is simple, "just check you're dependency arrays". But this looks all okay to me.

Here's how my setup looks:

Context:

const AuthContextProvider = ({ children }: Props) => {
  const [user, setUser] = useState<FirebaseAuthTypes.User>();
  const [userData, setUserData] = useState<FirestoreUser>();
  const [stamps, setStamps] = useState<GetMyStampsResponse>();
  const [isLoading, setLoading] = useState(true);

  // Unimportant for issue
  const onAuthStateChanged = useCallback(
    async (response: FirebaseAuthTypes.User | null) => {
       ...
    },
    [...]
  );

  useEffect(() => {
    const unsubscribe = auth().onUserChanged(onAuthStateChanged);
    return unsubscribe;
  }, [onAuthStateChanged]);

  return (
    <AuthContext.Provider
      value={{
        isLoading,
        stamps,
        setStamps,
        user,
        userData,
        reloadUser,
      }}>
      {children}
    </AuthContext.Provider>
  );
};

useAuth hook to be used in my components

import storage from '@react-native-firebase/storage';
import cloneDeep from 'lodash/cloneDeep';
import { useCallback, useContext } from 'react';

const useAuth = () => {
  const { stamps, setStamps, reloadUser, userData, user, isLoading } =
    useContext(AuthContext);

  /**
   * Add stamps that were received through a listener. This way we don't have to rely on reloadUser, which is more expensive.
   */
  const addStampsFromListener = useCallback(
    async (newStamps: FirestoreStamp[]) => {
      let newStampsState = cloneDeep(stamps);
      const newStampHasKnownStampcard = newStampsState?.cards.find(
        c => c.ref.path === newStamps[0].stampcardRef.path,
      );

      console.log('current stamps state', newStampsState?.stamps.length);

      if (newStampHasKnownStampcard) {
        newStampsState = {
          ...newStampsState!,
          stamps: newStampsState!.stamps.concat(newStamps),
        };
      } else {
        const [stampcard, business] = await Promise.all([
          stampcardApi.getStampcardByRef(newStamps[0].stampcardRef),
          businessApi.getBusiness(newStamps[0].businessId),
        ]);
        const imageUrl = await storage()
          .ref(stampcard!.stampImage)
          .getDownloadURL();

        const stampcardWithRef: StampCardDataWithRef = {
          ...stampcard!,
          imageUrl,
          businessId: newStamps[0].businessId,
          ref: newStamps[0].stampcardRef,
        };
        newStampsState = {
          ...newStampsState,
          businesses: (newStampsState?.businesses ?? []).concat(business!),
          cards: (newStampsState?.cards ?? []).concat(stampcardWithRef),
          stamps: (newStampsState?.stamps ?? []).concat(newStamps),
        };
      }
      setStamps(newStampsState);

      return newStampsState;
    },

    [setStamps, stamps],
  );

  ...

  return {
    addStampsFromListener,
    updateStampsFromListener,
    isLoading,
    data: userData,
    logout,
    reloadUser,
    stamps,
    user,
  };

};

And finally, the use of this context hook in my screen:

const HomeConsumerScreen = () => {
  const {
    stamps: stampcards,
    reloadUser,
    addStampsFromListener,
    updateStampsFromListener,
  } = useAuth();

const subscribeToStamps = useCallback(() => {
    if (refIsSubscribedToStamps.current) return; // Prevent initialization when already running

    const unsubscribe = stampApi.subscribeToStamps(
      /**
       * Callback for receiving new stamps
       */
      querySnapshot => {
        error && setError(undefined);
        if (!refIsSubscribedToStamps.current) {
          // First snapshot contains current state of all stamps belonging to a user
          return;
        }

        const data = querySnapshot.map(doc =>
          doc.doc.data(),
        ) as FirestoreStamp[];

        addStampsFromListener(data).then(nextState =>
          showDone('newStamp', data, nextState),
        );
      },
      /**
       * Initializer
       */
      () => {
        refIsSubscribedToStamps.current = true;
      },
      /**
       * Error callback
       */
      e => {
        setError(e.message);
        console.error('onSnapShot', e);
      },
    );

    return unsubscribe;
  }, [addStampsFromListener, error, showDone, updateStampsFromListener]);

  useEffect(() => {
    // Listen for changes to single stampcard
    const unsubscribe = subscribeToStamps();

    return () => {
      unsubscribe && unsubscribe();
      refIsSubscribedToStamps.current = false;
    };
    // Adding 'subscribeToStamps' to dependency hook will cause
    // the listener to unmount&remount on every callback.
    // It will fix the issue that I'm trying to solve here.... :(
  }, []);

};

So it seems to revolve around adding subscribeToStamps to the useEffect dependency array, but that causes the listener to unmount&mount again which is just more costly.

Any advice?