问:
TimescaleDB multinode cluster & replication factor
I have been working on timescaleDB multi-node concept, In my case I have an access node, and four data node. When I created the distributed hyper table I have set replication factor to four.

adding data node

```<code>SELECT add_data_node('dn1', host => '192.168.5.119', port => 5432, password => 'pass');
CREATE USER MAPPING FOR bennison SERVER dn1 OPTIONS (user 'pass', password 'pass');
</code>```

For example, first data node name is dn1, and the second data node name is dn3, third, and fourth one is d3, d4.

```<code>SELECT create_distributed_hypertable('sensor_data', 'time', 'sensor_id', replication_factor => 4);
</code>```

As I have set the replication factor to four, all data node chunk data will be stored in other data nodes. In my all data node I have installed the timescaledb-tune also.

After the all configuration, I just run the insert query it works fine.

```<code>INSERT INTO sensor_data VALUES  ('2020-12-09',1,32.2,0.45);
</code>```

If I down the data node 2 or three, I can run the read-only query (select query) on the access node that get the response back.

```<code> select * from sensor_data;
</code>```

Here the thing is, If I down the data node one (dn1), I could not run the any query especially read only query. Here the error looks like

```<code>test=# select * from sensor_data ;
ERROR:  [dn1]: FATAL:  terminating connection due to administrator command
SSL connection has been closed unexpectedly

test=#
</code>```

I want to know about, Why this error happens when the first data node is down, why this error is not happening other data node is down.

Is this possible run the query successfully, while the either one of the data node is in down. If not what will be the solution for this. If not any other way to implement the cluster in timescaleDB?

Body:
I have been working on timescaleDB multi-node concept, In my case I have an access node, and four data node. When I created the distributed hyper table I have set replication factor to four.

adding data node

SELECT add_data_node('dn1', host => '192.168.5.119', port => 5432, password => 'pass');
CREATE USER MAPPING FOR bennison SERVER dn1 OPTIONS (user 'pass', password 'pass');

For example, first data node name is dn1, and the second data node name is dn3, third, and fourth one is d3, d4.

SELECT create_distributed_hypertable('sensor_data', 'time', 'sensor_id', replication_factor => 4);

As I have set the replication factor to four, all data node chunk data will be stored in other data nodes. In my all data node I have installed the timescaledb-tune also.

After the all configuration, I just run the insert query it works fine.

INSERT INTO sensor_data VALUES  ('2020-12-09',1,32.2,0.45);

If I down the data node 2 or three, I can run the read-only query (select query) on the access node that get the response back.

 select * from sensor_data;

Here the thing is, If I down the data node one (dn1), I could not run the any query especially read only query. Here the error looks like

test=# select * from sensor_data ;
ERROR:  [dn1]: FATAL:  terminating connection due to administrator command
SSL connection has been closed unexpectedly

test=#

I want to know about, Why this error happens when the first data node is down, why this error is not happening other data node is down.

Is this possible run the query successfully, while the either one of the data node is in down. If not what will be the solution for this. If not any other way to implement the cluster in timescaleDB?


来源: stackexchange

问:
I am trying to make a winter months (dec to feb) variable in Rstudio, but I cannot figure out the syntax
I don't know how to join the 2 filter statements

I tried to use & and %>% but no success. 12 represents dec and 2 represents feb

ContentLicense: CC BY-SA 4.0


问:
Recognize an BitmapImage
From a starting image loaded from a path, I crop the image itself. I assign the images obtained from the Crop to the Image controls XAML by clicking on them with the mouse: aas if I were taking the pieces of a puzzle and wanting to reassemble the image.

I can't find a way to recognize individual images to be able to verify that the sorting is correct.

Title: Recognize an BitmapImage


问:
Git repository on network disk
Can't find a solution for my problem with Git.
I do use legacy guest system (Fedora Core 4) where my files are. I do share some folders via smb1 protocol and can successfully access them from Win11 host (same machine, using VMware).

My idea is to use FC4 to edit files (legacy system) use git from the win11. The reason for that is that FC4 support for SSL is outdated and I can't push commits to a remote repository.

I thought it will be straightforward, however when I try to do commit, I get

fatal: detected dubious ownership in repository at '//192.168.57.128/work/'
'//192.168.57.128/work/' is owned by:
'S-1-5-21-1030830248-2715341047-1655746900-2006'
but the current user is:
'S-1-5-21-624182484-2203949050-1231800916-1001'
To add an exception for this directory, call:

```<code>   git config --global --add safe.directory '%(prefix)///192.168.57.128/work/'
</code>```

and if I add the folder to safe I get the next error:

warning: in the working copy of 'transfer-test.txt', LF will be replaced by CRLF the next time Git touches it
Rename from '.git/objects/45/tmp_obj_G4Fewr' to '.git/objects/45/b921b0f124da3f73017c56757858cdd6f1fa4a' failed. Should I try again? (y/n)

The file on the guest system r-xr--r-- even though the network share on Samba is configured to have create mask = 0775.

Any ideas how to make it work?

Title: Git repository on network disk

Body:
Can't find a solution for my problem with Git.
I do use legacy guest system (Fedora Core 4) where my files are. I do share some folders via smb1 protocol and can successfully access them from Win11 host (same machine, using VMware).

My idea is to use FC4 to edit files (legacy system) use git from the win11. The reason for that is that FC4 support for SSL is outdated and I can't push commits to a remote repository.

I thought it will be straightforward, however when I try to do commit, I get

fatal: detected dubious ownership in repository at '//192.168.57.128/work/'
'//192.168.57.128/work/' is owned by:
'S-1-5-21-1030830248-2715341047-1655746900-2006'
but the current user is:
'S-1-5-21-624182484-2203949050-1231800916-1001'
To add an exception for this directory, call:

   git config --global --add safe.directory '%(prefix)///192.168.57.128/work/'

and if I add the folder to safe I get the next error:

warning: in the working copy of 'transfer-test.txt', LF will be replaced by CRLF the next time Git touches it
Rename from '.git/objects/45/tmp_obj_G4Fewr' to '.git/objects/45/b921b0f124da3f73017c56757858cdd6f1fa4a' failed. Should I try again? (y/n)

The file on the guest system r-xr--r-- even though the network share on Samba is configured to have create mask = 0775.

Any ideas how to make it work?


问:
How to generate JavaScript output from the latest Canvg version(4.0.1)?
We are using the Canvg plugin version(2.0.0) (https://github.com/canvg/canvg) in our Javascript project. We are trying to upgrade it to the latest version (4.0.1). We don't use any package manager like npm in our project. We are directly using the script reference in our HTML files.

The older Canvg plugin is in Javascript and the latest version is in Typescript.

As we are referencing the JavaScript file in our Html, we need a solution to make use of the latest Canvg version in the form of Javascript. Please share your comments on this.


问:
Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.5.370
I have a old project that was built in  2010 Vs ,now im trying to run it in visual studio 2013 and visual studio 2013,but its throwing error</p>
```<code> <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
</code>```

Body:
I have a old project that was built in  2010 Vs ,now im trying to run it in visual studio 2013 and visual studio 2013,but its throwing error

 <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>


问:
I am getting the error : The argument type 'QuerySnapshot <Map<String , dymanic>>?' can't be assigned to the parameter type 'QuerySnapshot<object>'
I am getting the error : The argument type 'QuerySnapshot <Map<String , dymanic>>?' can't be assigned to the parameter type 'QuerySnapshot'</p>
```<code>    body: StreamBuilder(
          stream: firestoreDb,
          builder: (context, snapshot) {
            if (!snapshot.hasData) return CircularProgressIndicator();
            return ListView.builder(
                itemCount: snapshot.data?.docs.length,
                itemBuilder: (context, index) {
                  return CustomeCard(snapshot: snapshot.data, index: index,);
                });
          }),
    );
  }

</code>```
```<code>
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

class CustomeCard extends StatelessWidget {
  final QuerySnapshot snapshot;
  final int index;

  const CustomeCard({
    Key? key,
    required this.snapshot,
    required this.index,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [Text(snapshot.docs[index]['title'])],
    );
  }
}
</code>```
```<code></code>```

Body:
I am getting the error : The argument type 'QuerySnapshot <Map<String , dymanic>>?' can't be assigned to the parameter type 'QuerySnapshot'

    body: StreamBuilder(
          stream: firestoreDb,
          builder: (context, snapshot) {
            if (!snapshot.hasData) return CircularProgressIndicator();
            return ListView.builder(
                itemCount: snapshot.data?.docs.length,
                itemBuilder: (context, index) {
                  return CustomeCard(snapshot: snapshot.data, index: index,);
                });
          }),
    );
  }

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

class CustomeCard extends StatelessWidget {
  final QuerySnapshot snapshot;
  final int index;

  const CustomeCard({
    Key? key,
    required this.snapshot,
    required this.index,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [Text(snapshot.docs[index]['title'])],
    );
  }
}


问:
Angular Mixed Content Error in browers inscure content
I used ssl certificate for front-end angular and not used for spring boot application (i.e., backend)

i tried to call api with http://localhost:/api/call (back-end api)  ---> working

i tried to call api with http://172.16.2.752:/api/call (back-end api)  ---> Not worked

This is the error - >

Mixed Content Error  The page at 'https://localhost:4200/**' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://back_end/api/call'. This request has been blocked; the content must be served over HTTPS.

Can anyone help me with this

Thanks in advance :)

Can anyone help me with this

Thanks in advance :)


问:
AXIsProcessTrustedWithOptions not prompting for permission. Need to disable sandbox?
I'm new to macos and I'm making a small console test program. I need it to prompt accessibility permissions but I cannot call the prompt window.

Here's code implementing checking accessibility privilegies:
`

```<code>    bool result;
    const void *keys[] = { kAXTrustedCheckOptionPrompt };
    const void *values[] = { kCFBooleanTrue };
    CFDictionaryRef options = CFDictionaryCreate(
        kCFAllocatorDefault,
        keys,
        values,
        sizeof(keys) / sizeof(*keys),
        &kCFCopyStringDictionaryKeyCallBacks,
        &kCFTypeDictionaryValueCallBacks
    );

    result = AXIsProcessTrustedWithOptions(options);
    CFRelease(options);
</code>```

The result value is always false.

I went to Privacy & Security -> Accessibility and added my binary file, but result is still false.
I've read that I need to disable sandbox for my app. If so, how can I do that? Or there is another way?

Body:
I'm new to macos and I'm making a small console test program. I need it to prompt accessibility permissions but I cannot call the prompt window.

Here's code implementing checking accessibility privilegies:
`

    bool result;
    const void *keys[] = { kAXTrustedCheckOptionPrompt };
    const void *values[] = { kCFBooleanTrue };
    CFDictionaryRef options = CFDictionaryCreate(
        kCFAllocatorDefault,
        keys,
        values,
        sizeof(keys) / sizeof(*keys),
        &kCFCopyStringDictionaryKeyCallBacks,
        &kCFTypeDictionaryValueCallBacks
    );

    result = AXIsProcessTrustedWithOptions(options);
    CFRelease(options);

The result value is always false.

I went to Privacy & Security -> Accessibility and added my binary file, but result is still false.
I've read that I need to disable sandbox for my app. If so, how can I do that? Or there is another way?


问:
Highlight the full line of code being executed using JS Interpreter
I am using JS Interpreter to parse the code and highlight the line of code being executed, I want something like the below (see the video), where each line is highlighted.

When using the JS Interpreter, I get the below (see the video), where parts of each line get executed, instead I would like one line to be executed at a time ( as shown in the above video).

Here is the code behind the highlighting part of JS interpreter, please take a look at the code in stepButton(), which actually creates the selection.

```<code><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS-Interpreter Async Demo</title>
  <link href="style.css" rel="stylesheet" type="text/css">
  <script src="../acorn.js"></script>
  <script src="../interpreter.js"></script>
  <script>
    var myInterpreter;
    function initAlert(interpreter, globalObject) {
      var wrapper = function alert(text) {
        return window.alert(arguments.length ? text : '');
      };
      interpreter.setProperty(globalObject, 'alert',
          interpreter.createNativeFunction(wrapper));
    }

    function parseButton() {
      var code = document.getElementById('code').value;
      myInterpreter = new Interpreter(code, initAlert);
      disable('');
    }

    function stepButton() {
      if (myInterpreter.stateStack.length) {
        var node =
            myInterpreter.stateStack[myInterpreter.stateStack.length - 1].node;
        var start = node.start;
        var end = node.end;
      } else {
        var start = 0;
        var end = 0;
      }
      createSelection(start, end);
      try {
        var ok = myInterpreter.step();
      } finally {
        if (!ok) {
          disable('disabled');
        }
      }
    }

    function runButton() {
      disable('disabled');
      if (myInterpreter.run()) {
        // Async function hit.  There's more code to run.
        // There will be a lot of restarts due to regular expressions in Acorn.
        setTimeout(runButton, 0);
      }
    }

    function disable(disabled) {
      document.getElementById('stepButton').disabled = disabled;
      document.getElementById('runButton').disabled = disabled;
    }

    function createSelection(start, end) {
      var field = document.getElementById('code');
      if (field.createTextRange) {
        var selRange = field.createTextRange();
        selRange.collapse(true);
        selRange.moveStart('character', start);
        selRange.moveEnd('character', end);
        selRange.select();
      } else if (field.setSelectionRange) {
        field.setSelectionRange(start, end);
      } else if (field.selectionStart) {
        field.selectionStart = start;
        field.selectionEnd = end;
      }
      field.focus();
    }
  </script>
</head>
<body>
  <h1>JS-Interpreter Self-interpreter Demo</h1>

  <p>The JS-Interpreter can run itself.  To run the demo you <strong>must</strong>
  first open <a href="../acorn_interpreter.js">acorn_interpreter.js</a>, copy the
  entire file, then paste it at the top of the text area below.</p>

  <p>Click <em>Parse</em>, then click <em>Run</em> once and wait a few seconds.
  Open your browser's console for errors.</p>

  <p><textarea id="code" spellcheck="false">
// DO THIS FIRST!
// PASTE CONTENTS OF acorn_interpreter.js HERE.

var code = [
  "var result = [];",
  "function fibonacci(n, output) {",
  "  var a = 1, b = 1, sum;",
  "  for (var i = 0; i < n; i++) {",
  "    output.push(a);",
  "    sum = a + b;",
  "    a = b;",
  "    b = sum;",
  "  }",
  "}",
  "fibonacci(16, result);",
  "alert(result.join(', '));"
].join('\n');

function initAlert(interpreter, globalObject) {
  var wrapper = function(text) {
    return alert(arguments.length ? text : '');
  };
  interpreter.setProperty(globalObject, 'alert',
      interpreter.createNativeFunction(wrapper));
}

myInterpreter = new Interpreter(code, initAlert);
myInterpreter.REGEXP_MODE = 1;
myInterpreter.run();
</textarea><br>
  <button onclick="parseButton()">Parse</button>
  <button onclick="stepButton()" id="stepButton" disabled="disabled">Step</button>
  <button onclick="runButton()" id="runButton" disabled="disabled">Run</button>
  </p>

  <p>Back to the <a href="../docs.html">JS-Interpreter documentation</a>.</p>
</body>
</html>
</code>```

Body:
I am using JS Interpreter to parse the code and highlight the line of code being executed, I want something like the below (see the video), where each line is highlighted.

When using the JS Interpreter, I get the below (see the video), where parts of each line get executed, instead I would like one line to be executed at a time ( as shown in the above video).

Here is the code behind the highlighting part of JS interpreter, please take a look at the code in stepButton(), which actually creates the selection.

<!DOCTYPE html>

  <meta charset="utf-8">
  <title>JS-Interpreter Async Demo</title>
  <link href="style.css" rel="stylesheet" type="text/css">

JS-Interpreter Self-interpreter Demo

The JS-Interpreter can run itself.  To run the demo you must
  first open acorn_interpreter.js, copy the
  entire file, then paste it at the top of the text area below.

Click Parse, then click Run once and wait a few seconds.
  Open your browser's console for errors.

<textarea id="code" spellcheck="false">
// DO THIS FIRST!
// PASTE CONTENTS OF acorn_interpreter.js HERE.

var code = [
  "var result = [];",
  "function fibonacci(n, output) {",
  "  var a = 1, b = 1, sum;",
  "  for (var i = 0; i < n; i++) {",
  "    output.push(a);",
  "    sum = a + b;",
  "    a = b;",
  "    b = sum;",
  "  }",
  "}",
  "fibonacci(16, result);",
  "alert(result.join(', '));"
].join('\n');

function initAlert(interpreter, globalObject) {
  var wrapper = function(text) {
    return alert(arguments.length ? text : '');
  };
  interpreter.setProperty(globalObject, 'alert',
      interpreter.createNativeFunction(wrapper));
}

myInterpreter = new Interpreter(code, initAlert);
myInterpreter.REGEXP_MODE = 1;
myInterpreter.run();
</textarea>

  <button onclick="parseButton()">Parse</button>
  <button onclick="stepButton()" id="stepButton" disabled="disabled">Step</button>
  <button onclick="runButton()" id="runButton" disabled="disabled">Run</button>

Back to the JS-Interpreter documentation.


问:
Expected a value of type 'String', but got one of type 'Null'
my problem is that i want to display the server data in a table, the data appears in the console but cannot be displayed but got one of type 'Null'

I show you the piece of code that allows me to display the data in the table

and this is what appears in the console


问:
Unable to start activity getDataNetworkTypeForSubscriber
Android Studio
When I open my users activity it open just fine but on the admin side I'll get the error, but when I use the emulator for APK from android studio and android studio emulator all works fine.

Idk what's causing this issue it's been 2 days since I've been debugging but to no avail.

`

```<code>AdminMain.java

public class AdminMain extends AppCompatActivity {

    private ImageButton itemResets;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_main);

        itemResets = (ImageButton) findViewById(R.id.itemResets);
        itemResets.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AdminMain.this, AdminResetItems.class));
            }
        });

        TabLayout tabLayout = findViewById(R.id.tab_layout);
        ViewPager viewPager = findViewById(R.id.view_pager);

        ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
        viewPagerAdapter.addFragment(new AdminAddItem(), "Add Item");
        viewPagerAdapter.addFragment(new AdminStoredItem(), "Stored Item");
        viewPagerAdapter.addFragment(new AdminAllOrders(), "All Orders");
        viewPagerAdapter.addFragment(new AdminStoreStatus(), "Store Status");
        viewPager.setAdapter(viewPagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
    }

    public static class ViewPagerAdapter extends FragmentPagerAdapter {
        private ArrayList<Fragment> fragments;
        private ArrayList<String> titles;

        public ViewPagerAdapter(@NonNull FragmentManager fm) {
            super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
            this.fragments = new ArrayList<>();
            this.titles = new ArrayList<>();
        }

        @NonNull
        @Override
        public Fragment getItem(int position) {
            return fragments.get(position);
        }

        @Override
        public int getCount() {
            return fragments.size();
        }
        public void addFragment(Fragment fragment, String title){
            fragments.add(fragment);
            titles.add(title);
        }

        @Nullable
        @Override
        public CharSequence getPageTitle(int position) {
            return titles.get(position);
        }
    }

}

</code>```

`

Error:
`

```<code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.feedback/com.google.android.feedback.FeedbackActivity}: java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3773)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3940)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2320)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8268)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
Caused by: java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:9300)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2932)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2896)
at com.google.android.feedback.FeedbackSession.getTelephonyInfo(FeedbackSession.java:307)
at com.google.android.feedback.FeedbackSession.\<init\>(FeedbackSession.java:152)
at com.google.android.feedback.FeedbackSession.\<init\>(FeedbackSession.java:141)
at com.google.android.feedback.FeedbackActivity.pushSession(FeedbackActivity.java:209)
at com.google.android.feedback.FeedbackActivity.createFeedbackSession(FeedbackActivity.java:178)
at com.google.android.feedback.FeedbackActivity.onCreate(FeedbackActivity.java:96)
at android.app.Activity.performCreate(Activity.java:8191)
at android.app.Activity.performCreate(Activity.java:8159)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3746)
12 more
</code>```

`

Body:
Android Studio
When I open my users activity it open just fine but on the admin side I'll get the error, but when I use the emulator for APK from android studio and android studio emulator all works fine.

Idk what's causing this issue it's been 2 days since I've been debugging but to no avail.

`

AdminMain.java

public class AdminMain extends AppCompatActivity {

    private ImageButton itemResets;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_main);

        itemResets = (ImageButton) findViewById(R.id.itemResets);
        itemResets.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(AdminMain.this, AdminResetItems.class));
            }
        });

        TabLayout tabLayout = findViewById(R.id.tab_layout);
        ViewPager viewPager = findViewById(R.id.view_pager);

        ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
        viewPagerAdapter.addFragment(new AdminAddItem(), "Add Item");
        viewPagerAdapter.addFragment(new AdminStoredItem(), "Stored Item");
        viewPagerAdapter.addFragment(new AdminAllOrders(), "All Orders");
        viewPagerAdapter.addFragment(new AdminStoreStatus(), "Store Status");
        viewPager.setAdapter(viewPagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
    }

    public static class ViewPagerAdapter extends FragmentPagerAdapter {
        private ArrayList<Fragment> fragments;
        private ArrayList<String> titles;

        public ViewPagerAdapter(@NonNull FragmentManager fm) {
            super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
            this.fragments = new ArrayList<>();
            this.titles = new ArrayList<>();
        }

        @NonNull
        @Override
        public Fragment getItem(int position) {
            return fragments.get(position);
        }

        @Override
        public int getCount() {
            return fragments.size();
        }
        public void addFragment(Fragment fragment, String title){
            fragments.add(fragment);
            titles.add(title);
        }

        @Nullable
        @Override
        public CharSequence getPageTitle(int position) {
            return titles.get(position);
        }
    }

}

`

Error:
`

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.feedback/com.google.android.feedback.FeedbackActivity}: java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3773)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3940)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2320)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8268)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
Caused by: java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:9300)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2932)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2896)
at com.google.android.feedback.FeedbackSession.getTelephonyInfo(FeedbackSession.java:307)
at com.google.android.feedback.FeedbackSession.\<init\>(FeedbackSession.java:152)
at com.google.android.feedback.FeedbackSession.\<init\>(FeedbackSession.java:141)
at com.google.android.feedback.FeedbackActivity.pushSession(FeedbackActivity.java:209)
at com.google.android.feedback.FeedbackActivity.createFeedbackSession(FeedbackActivity.java:178)
at com.google.android.feedback.FeedbackActivity.onCreate(FeedbackActivity.java:96)
at android.app.Activity.performCreate(Activity.java:8191)
at android.app.Activity.performCreate(Activity.java:8159)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3746)
12 more

`


问:
How Kaniko images be built and pushed to AWS ECR via Jenkins pipelines
I get an empty preload of credentials when trying to push the kaniko image to AWS ECR

loaded credentials that populate and push the kaniko image to AWS ECR


问:
Kotlin Android / android.view.InflateException: Couldn't resolve menu item onClick handler onClickGoActivity2 in class
I'm learning kotlin android development. It's been hours and I don't know what I'm doing wrong here. I tried to make two menu buttons to change activities by using OnClick and another method below.

```<code>class MainActivity : AppCompatActivity() {
    lateinit var bindingClass : ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bindingClass = ActivityMainBinding.inflate(layoutInflater)
        setContentView(bindingClass.root)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
    }
    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.main_menu, menu)
        return true
    }
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when(item.itemId) {
            R.id.infoButton -> {
                val intent = Intent(this, Activity2::class.java)
                startActivity(intent)
            }
            R.id.settingButton -> {
                val intent = Intent(this, Activity3::class.java)
                startActivity(intent)
            }
        }
        return super.onOptionsItemSelected(item);
    }
}
</code>```

Here's a part of my logcat.

```<code>2022-12-26 14:09:19.966 26257-26257/com.example.lafranqa E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.lafranqa, PID: 26257
    android.view.InflateException: Couldn't resolve menu item onClick handler onClickGoActivity2 in class com.example.lafranqa.MainActivity
     Caused by: java.lang.NoSuchMethodException: com.example.lafranqa.MainActivity.onClickGoActivity2 [interface android.view.MenuItem]

</code>```

In another post on stackoverflow with similar problem people advised not to use onClick method.

Body:
I'm learning kotlin android development. It's been hours and I don't know what I'm doing wrong here. I tried to make two menu buttons to change activities by using OnClick and another method below.

class MainActivity : AppCompatActivity() {
    lateinit var bindingClass : ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bindingClass = ActivityMainBinding.inflate(layoutInflater)
        setContentView(bindingClass.root)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
    }
    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.main_menu, menu)
        return true
    }
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when(item.itemId) {
            R.id.infoButton -> {
                val intent = Intent(this, Activity2::class.java)
                startActivity(intent)
            }
            R.id.settingButton -> {
                val intent = Intent(this, Activity3::class.java)
                startActivity(intent)
            }
        }
        return super.onOptionsItemSelected(item);
    }
}

Here's a part of my logcat.

2022-12-26 14:09:19.966 26257-26257/com.example.lafranqa E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.lafranqa, PID: 26257
    android.view.InflateException: Couldn't resolve menu item onClick handler onClickGoActivity2 in class com.example.lafranqa.MainActivity
     Caused by: java.lang.NoSuchMethodException: com.example.lafranqa.MainActivity.onClickGoActivity2 [interface android.view.MenuItem]

In another post on stackoverflow with similar problem people advised not to use onClick method.


问:
pandas get dummies without duplicating binary variables
I want to one hot encode my dataset but using pd.get_dummies() causes a lot of binary variables to get duplicated causing a lot memory overhead.

```<code>df_binary = pd.DataFrame({"x" : ['a', 'b', 'a']})
pd.get_dummies(df_binary)
</code>```

gives out

```<code>    x_a x_b
0   1   0
1   0   1
2   1   0
</code>```

x_b is just an inverse of x_a so it's unnecessary. Is there any other way for binary variables to remain single column after dummying, other than manually dropping them?

Body:
I want to one hot encode my dataset but using pd.get_dummies() causes a lot of binary variables to get duplicated causing a lot memory overhead.

df_binary = pd.DataFrame({"x" : ['a', 'b', 'a']})
pd.get_dummies(df_binary)

gives out

    x_a x_b
0   1   0
1   0   1
2   1   0

x_b is just an inverse of x_a so it's unnecessary. Is there any other way for binary variables to remain single column after dummying, other than manually dropping them?


问:
Flutter Stream Provider doesn't provider the stream of data when I update the variable
I use provider for state management. I when I update the keyword variable, but stream provider doesn't update the value or fetch the data or update UI. How can I do that?

I use backend search for product filtering. So how can search and filter product Using stream provider.

`

```<code>class FilterProvider extends ChangeNotifier {
  String? _keyword;

  getkeyword(String value) {
    _keyword = value;
    filterFetchService();
    print(_keyword);
  }

  Stream<GetFiltersProductModel> filterFetchService() async* {
    print(_keyword);
    QueryResult queryResult = await qlclient.query(
      QueryOptions(
        document: gql(QueryDocument.filters),
        variables: {
          "productPrams": {
            "search": _keyword??"",
            "visibility": true,
            "approved": true,
          }
        },
      ),
    );
    Map<String, dynamic> data = queryResult.data as Map<String, dynamic>;

    var body = GetFiltersProductModel.fromJson(data);
    if (kDebugMode) {
      print(data);
    }

    yield body;
  }
}
</code>```

`

I refetch the product and update the ui when keyword variable is updated.

Body:
I use provider for state management. I when I update the keyword variable, but stream provider doesn't update the value or fetch the data or update UI. How can I do that?

I use backend search for product filtering. So how can search and filter product Using stream provider.

`

class FilterProvider extends ChangeNotifier {
  String? _keyword;

  getkeyword(String value) {
    _keyword = value;
    filterFetchService();
    print(_keyword);
  }

  Stream<GetFiltersProductModel> filterFetchService() async* {
    print(_keyword);
    QueryResult queryResult = await qlclient.query(
      QueryOptions(
        document: gql(QueryDocument.filters),
        variables: {
          "productPrams": {
            "search": _keyword??"",
            "visibility": true,
            "approved": true,
          }
        },
      ),
    );
    Map<String, dynamic> data = queryResult.data as Map<String, dynamic>;

    var body = GetFiltersProductModel.fromJson(data);
    if (kDebugMode) {
      print(data);
    }

    yield body;
  }
}

`

I refetch the product and update the ui when keyword variable is updated.


问:
How to receive data in a vector<uint8_t> from a socket?
I am working on a project with the library LWIP on my ESP32. In this project, I have a TCP communication between my ESP32 and some hardware via a socket.

After connecting the socket and establishing the communication, I am trying to receive some byte data sent to the ESP32 through the socket. I am using std::vector<uint8_t> recvVec(1200) to store the data I receive from the socket. To do so, I am calling the recv method of lwip as such :

```<code>int messRcv = recv(sock, recvVec.data(), recvVec.size(), 0);
</code>```

If I don't somehow end the receiving process, the socket will never stop receiving data.

The data/packets I receive differ in sizes. The first is 332 bytes, the second 446, and after these most of the packets are 1024 bytes. If I leave the communication going for a while, I end up receiving packets of 4 bytes. Also, when I am printing these packets by printing each byte in my vector, as it's unsigned value since I can't print bytes, I get an output of numbers I don't expect.

The packet I expect back is an XML type packet with UTF-8 encoding. This packet begins with the character < whose decimal value is 60. So I expect a packet of bytes begining with the unsigned decimal value of 60. Instead, when I print the first packet I receive with size of 332 bytes, I get back the values 60 60 60 0 1 60 60 60 ... and so on. The packets that follow also repeat one decimal value over and over.

Is this an encryption problem, or a problem with the way I receive the data? Is there a way to know when to stop receiving packets?

Body:
I am working on a project with the library LWIP on my ESP32. In this project, I have a TCP communication between my ESP32 and some hardware via a socket.

After connecting the socket and establishing the communication, I am trying to receive some byte data sent to the ESP32 through the socket. I am using std::vector<uint8_t> recvVec(1200) to store the data I receive from the socket. To do so, I am calling the recv method of lwip as such :

int messRcv = recv(sock, recvVec.data(), recvVec.size(), 0);

If I don't somehow end the receiving process, the socket will never stop receiving data.

The data/packets I receive differ in sizes. The first is 332 bytes, the second 446, and after these most of the packets are 1024 bytes. If I leave the communication going for a while, I end up receiving packets of 4 bytes. Also, when I am printing these packets by printing each byte in my vector, as it's unsigned value since I can't print bytes, I get an output of numbers I don't expect.

The packet I expect back is an XML type packet with UTF-8 encoding. This packet begins with the character < whose decimal value is 60. So I expect a packet of bytes begining with the unsigned decimal value of 60. Instead, when I print the first packet I receive with size of 332 bytes, I get back the values 60 60 60 0 1 60 60 60 ... and so on. The packets that follow also repeat one decimal value over and over.

Is this an encryption problem, or a problem with the way I receive the data? Is there a way to know when to stop receiving packets?


问:
FragmentContainerView shows incorrect attribute values
When a FragmentContainerView parent activity is moved from one activity to another activity.  After returning the FragmentContainerView is not showing correct values like isVisible = false. Even if the fragment is being displayed on the screen.

private var knobViewsCloseListner:OnDismissDialogListener? =  object: OnDismissDialogListener{

```<code>    override fun handleDialogClose() {
      //calling the function for closing the fragment.
    }

}
</code>```

//above is the callback for closing the fragment with the normal

fragment?.let { simv_nav_container.visibility = View.GONE fragmentManager.beginTransaction().remove(it).commit() }

Body:
When a FragmentContainerView parent activity is moved from one activity to another activity.  After returning the FragmentContainerView is not showing correct values like isVisible = false. Even if the fragment is being displayed on the screen.

private var knobViewsCloseListner:OnDismissDialogListener? =  object: OnDismissDialogListener{

    override fun handleDialogClose() {
      //calling the function for closing the fragment.
    }

}

//above is the callback for closing the fragment with the normal

fragment?.let { simv_nav_container.visibility = View.GONE fragmentManager.beginTransaction().remove(it).commit() }


问:
how to find any user instagram uid and uidb36?
Now I am testing Instagram

How to find  any user Instagram uid or uidb36

I am try to reset my password via Email address,
Instagram server send me
two link one short link and another is very long link

ex:

short link

1...https://www.instagram.com/_n/emaillogin?uid=pwar8ac&token=IBo6y9&auto_send=0

long link

2...https://instagram.com/accounts/password/reset/confirm/?uidb36=pwar8ac&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:one_click_login_email&v=264.0.0.22.106&s=one_click_login_email

many times,I try to request reset my password  token as generate new token of every 24 hr(daily one time reset your password........(now ,I am try different account)

but I not focus token ,we  only focus uid...(user id) "uid=pwar8ac" or uidb36 "?uidb36=pwar8ac" , how to find any user uid

help.....

how to find any user uid ???
any API endpoint showing user uid=xxx or ?uidb36=xxx ???

how to find any user uid ???

any API endpoint showing user  uid or uidb36     ( ..\emaillogin??uid   or     ../password/reset/confirm/?uidb36=?uid ???  )

where to find that ................

please help me


问:
Display product custom field in WooCommerce Order admin Page (ACF)
With WooCommerce, I'm using the Advanced Custom Fields plugin to Add product design URL

I used this code to display "design_url"

But it display everywhere, Email and thank you page,

I want to display in order admin page only

```<code>add_action( 'woocommerce_order_item_meta_start', 'display_acf_on_order_admin_page', 10, 3 );
function display_acf_on_order_admin_page( $item_id, $item ) {
    $product_id = $item->get_product_id();
    $design_url   = get_field( 'design_url ', $product_id );

    if ( ! empty( $design_url  ) ) {
         $item->add_meta_data( __("design", "woocommerce"), $design_url );
    }

}
</code>```

Body:
With WooCommerce, I'm using the Advanced Custom Fields plugin to Add product design URL

I used this code to display "design_url"

But it display everywhere, Email and thank you page,

I want to display in order admin page only

add_action( 'woocommerce_order_item_meta_start', 'display_acf_on_order_admin_page', 10, 3 );
function display_acf_on_order_admin_page( $item_id, $item ) {
    $product_id = $item->get_product_id();
    $design_url   = get_field( 'design_url ', $product_id );

    if ( ! empty( $design_url  ) ) {
         $item->add_meta_data( __("design", "woocommerce"), $design_url );
    }

}


问:
TikTok API: copy of Ad Group
Tell me, does the TikTok API have the ability to copy the Ad Group? Or, how can this be implemented in code? (are there code examples?)

I did not find in the documentation the ability to create copies, as, for example, with Facebook. Such a function exists in the TikTok control panel, but I'm interested in the implementation in the code, for a custom admin panel. I tried to take the parameters from Ad Group that I wanted to copy and using these parameters I created new ones, but they are created empty, without Ads. Therefore, I copied Ads into the created copy. But every time I got an error that the type of the creative did not match the Ad Group settings, although I created with the same settings that I received from Ad Group.

Title: TikTok API: copy of Ad Group


问:
how to schedule a notification using firebase messaging
I am trying to push a schedule notification to a group of people using firebase messaging, but the only resources I found were for flutter_local_notifications with the scheduling feature. which, as far as I know, work only for the same device I work with and do not send the notification to other devices.

I tried to customize the local schedule notification to send notifications to other devices but I did not know where to add the tokens for other devices


问:
Regroup duplicate values into single key value array in Django Rest Framework?
I am using DRF to create an api:
My Models are:

```<code>from django.db import models

class Product(models.Model):
  productId = models.CharField(max_length=120, primary_key=True)
  productCategory = models.CharField(max_length=120)
  name = models.CharField(max_length=120)
  insertTime = models.DateField()

  def __str__(self):
    return self.productId

class LendingRate(models.Model):
  productId = models.ForeignKey(Product, related_name="lendingRates", on_delete=models.CASCADE)
  rate = models.CharField(max_length=120)
  tiersName = models.CharField(max_length=120)
  tiersMinimumValue = models.CharField(max_length=120)
  tiersMaximumValue = models.CharField(max_length=120)
  insertTime = models.DateField()

  def __str__(self):
    return self.rate
</code>```

My Serializers are:

```<code>from rest_framework import serializers
from .models import Product
from .models import LendingRate

class LendingRateSerializer(serializers.ModelSerializer):
  class Meta:
    model = LendingRate
    fields = ('rate', 'tiersName', 'tiersMinimumValue', 'tiersMaximumValue')

class ProductSerializer(serializers.ModelSerializer):
  lendingRates = LendingRateSerializer(many=True)
  class Meta:
    model = Product
    fields = ('productId','productCategory', 'name', 'lendingRates')
</code>```

This would provide me a response like this:

```<code>"data": {
        "productId": "62678a1c-daa8-491c-941e-63745620338f",
        "productCategory": "RESIDENTIAL_MORTGAGES",
        "name": "Fixed Rate Home Loan - 1 Year",
        "lendingRates": [
            {
                "rate": "0.0529",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.2934",
                "tiersMaximumValue": "0.3932"
            },
            {
                "rate": "0.0529",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0863",
                "tiersMaximumValue": "0.0974"
            },
            {
                "rate": "0.0619",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0437",
                "tiersMaximumValue": "0.0621"
            },
            {
                "rate": "0.0619",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0697",
                "tiersMaximumValue": "0.0775"
            },
            {
                "rate": "0.0348",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0224",
                "tiersMaximumValue": "0.0443"
            }
        ]
    }
</code>```

I am not able to group the rate with same value into an array.

As seen in the api response,I want to group the response with same rate into single array of objects.
For example like this:
desired api response

Here is my views.py

```<code>@api_view()
def productDetail(request, productId):
    try:
        product = Product.objects.get(productId=productId)
    except Product.DoesNotExist:
        return Response(status=status.HTTP_404_NOT_FOUND)

    productSerializer = ProductSerializer(product, context={'request': request}).data

    (don't know how to proceed from here)

    .........
    ....
    .
    .
    .
    return Response()
</code>```

I highly appreciate any help on this.
Thank you.

Body:
I am using DRF to create an api:
My Models are:

from django.db import models

class Product(models.Model):
  productId = models.CharField(max_length=120, primary_key=True)
  productCategory = models.CharField(max_length=120)
  name = models.CharField(max_length=120)
  insertTime = models.DateField()

  def __str__(self):
    return self.productId

class LendingRate(models.Model):
  productId = models.ForeignKey(Product, related_name="lendingRates", on_delete=models.CASCADE)
  rate = models.CharField(max_length=120)
  tiersName = models.CharField(max_length=120)
  tiersMinimumValue = models.CharField(max_length=120)
  tiersMaximumValue = models.CharField(max_length=120)
  insertTime = models.DateField()

  def __str__(self):
    return self.rate

My Serializers are:

from rest_framework import serializers
from .models import Product
from .models import LendingRate

class LendingRateSerializer(serializers.ModelSerializer):
  class Meta:
    model = LendingRate
    fields = ('rate', 'tiersName', 'tiersMinimumValue', 'tiersMaximumValue')

class ProductSerializer(serializers.ModelSerializer):
  lendingRates = LendingRateSerializer(many=True)
  class Meta:
    model = Product
    fields = ('productId','productCategory', 'name', 'lendingRates')

This would provide me a response like this:

"data": {
        "productId": "62678a1c-daa8-491c-941e-63745620338f",
        "productCategory": "RESIDENTIAL_MORTGAGES",
        "name": "Fixed Rate Home Loan - 1 Year",
        "lendingRates": [
            {
                "rate": "0.0529",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.2934",
                "tiersMaximumValue": "0.3932"
            },
            {
                "rate": "0.0529",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0863",
                "tiersMaximumValue": "0.0974"
            },
            {
                "rate": "0.0619",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0437",
                "tiersMaximumValue": "0.0621"
            },
            {
                "rate": "0.0619",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0697",
                "tiersMaximumValue": "0.0775"
            },
            {
                "rate": "0.0348",
                "tiersName": "LVR",
                "tiersMinimumValue": "0.0224",
                "tiersMaximumValue": "0.0443"
            }
        ]
    }

I am not able to group the rate with same value into an array.

As seen in the api response,I want to group the response with same rate into single array of objects.
For example like this:
desired api response

Here is my views.py

@api_view()
def productDetail(request, productId):
    try:
        product = Product.objects.get(productId=productId)
    except Product.DoesNotExist:
        return Response(status=status.HTTP_404_NOT_FOUND)

    productSerializer = ProductSerializer(product, context={'request': request}).data

    (don't know how to proceed from here)

    .........
    ....
    .
    .
    .
    return Response()

I highly appreciate any help on this.
Thank you.


问:
A Database Error Occurred Error Number: 1054 Unknown column 'Array' in 'field list'

A PHP Error was encountered Severity: Notice

Message: Array to string conversion

Filename: database/DB_driver.php

Line Number: 1484

Backtrace:

File: C:\xampp\htdocs\sikan_v2\application\models\Stock_m.php Line: 17
Function: insert

File: C:\xampp\htdocs\sikan_v2\application\controllers\Stock.php Line:
26 Function: add_stock_in

File: C:\xampp\htdocs\sikan_v2\index.php Line: 315 Function:
require_once

A Database Error Occurred Error Number: 1054

Unknown column 'Array' in 'field list'

INSERT INTO t_stock (item_id, type, detail, supplier_id,
qty, date, user_id) VALUES ('10', Array, 'aasa', '15', '1',
'2022-12-26', '1')

Filename: C:/xampp/htdocs/sikan_v2/system/database/DB_driver.php

Line Number: 692

My Models: models: Stock_m.php

```<code><?php defined('BASEPATH') OR exit('No direct script access allowed');

class Stock_m extends CI_Model {

    public function add_stock_in($post)
    {
        $params = [
            'item_id' => $post['item_id'],
            'type' => ['in'],
            'detail' => $post['detail'],
            'supplier_id' => $post['supplier'] == '' ? null :  $post['supplier'],
            'qty' => $post['qty'],
            'date' => $post['date'],
            'user_id' => $this->session->userdata('userid'),

        ];
        $this->db->insert('t_stock', $params);

    }

}
</code>```

My controllers: controllerts/Stock.php

```<code><?php defined('BASEPATH') OR exit('No direct script access allowed');

class Stock  extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        check_not_login();
        check_admin();
        $this->load->model(['item_m', 'supplier_m', 'stock_m']);
    }

    public function stock_in_data() {
        $this->template->load('template', 'transaction/stock_in/stock_in_data');
    }
    public function stock_in_add() {
        $item = $this->item_m->get()->result();
        $supplier = $this->supplier_m->get()->result();
        $data = ['item' => $item, 'supplier' => $supplier];
        $this->template->load('template', 'transaction/stock_in/stock_in_form', $data);
    }

    public function process() {
        if(isset($_POST['in_add'])) {
            $post = $this->input->post(null, TRUE);
            $this->stock_m->add_stock_in($post);
            $this->item_m->update_stock_in($post);

            if($this->db->affected_rows() > 0) {
                $this->session->set_flashdata('success', 'Data Stock-In berhasil disimpan');
            }
            redirect('stock/in');
        }
    }

}
</code>```

My view: transaction/stock_in/stock_in_form.php

```<code><section class="content-header">
      <h1>Stock In
        <small>Barang Masuk / Pembelian</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i></a></li>
        <li>Transaction</li>
        <li><a href="#"></a></li>
        <li class="active">Stock In</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">

    <div class="box">
        <div class="box-header">
            <h3 class="box-title">Add Stock In</h3>
            <div class="pull-right">
                <a href="<?=site_url('stock/in')?>" class="btn btn-warning btn-flat">
                   <i class="fa fa-undo"></i> Back
                </a>
            </div>
         </div>
         <div class="box-body">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <form action="<?=site_url('stock/process')?>" method="post">
                        <div class="form-group">
                            <label>Date *</label>
                            <input type="date" name="date" value="<?=date('Y-m-d')?>" class="form-control" required>
                        </div>
                        <div>
                            <label for="barcode">Barcode *</label>
                        </div>
                        <div class="form-group input-group">
                            <input type="hidden" name="item_id" id="item_id">
                            <input type="text" name="barcode" id="barcode" class="form-control" required autofocus>
                            <span class="input-group-btn">
                                <button type="button" class="btn btn-info btn-flat" data-toggle="modal" data-target="#modal-item">
                                    <i class="fa fa-search"></i>
                                </button>
                            </span>
                        </div>
                        <div class="form-group">
                            <label>Item Name *</label>
                            <input type="text" name="item_name" id="item_name" class="form-control" readonly>
                        </div>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-8">
                                    <label for="unit_name">Item Unit</label>
                                    <input type="text" name="unit_name" id="unit_name" value="-" class="form-control" readonly>
                                </div>
                                <div class="col-md-4">
                                    <label for="stock">Initial Stock</label>
                                    <input type="text" name="stock" id="stock" value="-" class="form-control" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>Detail *</label>
                            <input type="text" name="detail" class="form-control" placeholder="Tambahan / etc" required>
                        </div>
                        <div class="form-group">
                            <label>Supplier</label>
                            <select name="supplier" class="form-control">
                                <option value="">- Pilih -</option>
                                <?php foreach($supplier as $i =>$data) {
                                    echo '<option value="'.$data->supplier_id.'">'.$data->name.'</option>';
                                } ?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>Qty *</label>
                            <input type="number" name="qty" class="form-control" required>
                        </div>

                        <div class="form-group">
                            <button type="submit" name="in_add" class="btn btn-success btn-flat">
                               <i class="fa fa-paper-plane"></i> Save
                            </button>
                            <button type="Reset" class="btn btn-flat">Reset</button>
                        </div>
                    </form>
                </div>
            </div>
         </div>
    </div>

</section>

<div class="modal fade" id="modal-item">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data.dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title">Select Product Item</h4>
            </div>
            <div class="modal-body table-responsive">
                <table class="table table-bordered table-striped" id="table1">
                    <thead>
                        <tr>
                            <th>Barcode</th>
                            <th>Name</th>
                            <th>Unit</th>
                            <th>Price</th>
                            <th>Stock</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($item as $i => $data) { ?>
                        <tr>
                            <td><?=$data->barcode?></td>
                            <td><?=$data->name?></td>
                            <td><?=$data->unit_name?></td>
                            <td class="text-right"><?=indo_currency($data->price)?></td>
                            <td class="text-right"><?=$data->stock?></td>
                            <td class="text-right">
                                <button class="btn btn-xs btn-info" id="select"
                                    data-id="<?=$data->item_id?>"
                                    data-barcode="<?=$data->barcode?>"
                                    data-name="<?=$data->name?>"
                                    data-unit="<?=$data->unit_name?>"
                                    data-stock="<?=$data->stock?>">
                                    <i class="fa fa-check"></i> Select
                                </button>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script>
    $(document).ready(function() {
        $(document).on('click', '#select', function(){
            var item_id = $(this).data('id');
            var barcode = $(this).data('barcode');
            var name = $(this).data('name');
            var unit_name = $(this).data('unit');
            var stock = $(this).data('stock');
            $('#item_id').val(item_id);
            $('#barcode').val(barcode);
            $('#item_name').val(name);
            $('#unit_name').val(unit_name);
            $('#stock').val(stock);
            $('#model-item').modal('hide');
        })
    })

</script>

</code>```

please help me in solving this problem

Body:
A PHP Error was encountered Severity: Notice

Message: Array to string conversion

Filename: database/DB_driver.php

Line Number: 1484

Backtrace:

File: C:\xampp\htdocs\sikan_v2\application\models\Stock_m.php Line: 17
Function: insert

File: C:\xampp\htdocs\sikan_v2\application\controllers\Stock.php Line:
26 Function: add_stock_in

File: C:\xampp\htdocs\sikan_v2\index.php Line: 315 Function:
require_once

A Database Error Occurred Error Number: 1054

Unknown column 'Array' in 'field list'

INSERT INTO t_stock (item_id, type, detail, supplier_id,
qty, date, user_id) VALUES ('10', Array, 'aasa', '15', '1',
'2022-12-26', '1')

Filename: C:/xampp/htdocs/sikan_v2/system/database/DB_driver.php

Line Number: 692

My Models: models: Stock_m.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Stock_m extends CI_Model {

    public function add_stock_in($post)
    {
        $params = [
            'item_id' => $post['item_id'],
            'type' => ['in'],
            'detail' => $post['detail'],
            'supplier_id' => $post['supplier'] == '' ? null :  $post['supplier'],
            'qty' => $post['qty'],
            'date' => $post['date'],
            'user_id' => $this->session->userdata('userid'),

        ];
        $this->db->insert('t_stock', $params);

    }

}

My controllers: controllerts/Stock.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Stock  extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        check_not_login();
        check_admin();
        $this->load->model(['item_m', 'supplier_m', 'stock_m']);
    }

    public function stock_in_data() {
        $this->template->load('template', 'transaction/stock_in/stock_in_data');
    }
    public function stock_in_add() {
        $item = $this->item_m->get()->result();
        $supplier = $this->supplier_m->get()->result();
        $data = ['item' => $item, 'supplier' => $supplier];
        $this->template->load('template', 'transaction/stock_in/stock_in_form', $data);
    }

    public function process() {
        if(isset($_POST['in_add'])) {
            $post = $this->input->post(null, TRUE);
            $this->stock_m->add_stock_in($post);
            $this->item_m->update_stock_in($post);

            if($this->db->affected_rows() > 0) {
                $this->session->set_flashdata('success', 'Data Stock-In berhasil disimpan');
            }
            redirect('stock/in');
        }
    }

}

My view: transaction/stock_in/stock_in_form.php

Stock In
        Barang Masuk / Pembelian

Transaction

Stock In

Add Stock In

                <a href="<?=site_url('stock/in')?>" class="btn btn-warning btn-flat">
                    Back

                    <form action="<?=site_url('stock/process')?>" method="post">

                            Date *
                            <input type="date" name="date" value="<?=date('Y-m-d')?>" class="form-control" required>

                            Barcode *

                            <input type="hidden" name="item_id" id="item_id">
                            <input type="text" name="barcode" id="barcode" class="form-control" required autofocus>

                                <button type="button" class="btn btn-info btn-flat" data-toggle="modal" data-target="#modal-item">

                                </button>

                            Item Name *
                            <input type="text" name="item_name" id="item_name" class="form-control" readonly>

                                    Item Unit
                                    <input type="text" name="unit_name" id="unit_name" value="-" class="form-control" readonly>

                                    Initial Stock
                                    <input type="text" name="stock" id="stock" value="-" class="form-control" readonly>

                            Detail *
                            <input type="text" name="detail" class="form-control" placeholder="Tambahan / etc" required>

                            Supplier
                            <select name="supplier" class="form-control">
                                <option value="">- Pilih -</option>
                                <?php foreach($supplier as $i =>$data) {
                                    echo '<option value="'.$data->supplier_id.'">'.$data->name.'</option>';
                                } ?>
                            </select>

                            Qty *
                            <input type="number" name="qty" class="form-control" required>

                            <button type="submit" name="in_add" class="btn btn-success btn-flat">
                                Save
                            </button>
                            <button type="Reset" class="btn btn-flat">Reset</button>

                    </form>

                <button type="button" class="close" data.dismiss="modal" aria-label="Close">
                    ×
                </button>

Select Product Item

                            Barcode
                            Name
                            Unit
                            Price
                            Stock
                            Actions

                        <?php foreach($item as $i => $data) { ?>

                            <?=$data->barcode?>
                            <?=$data->name?>
                            <?=$data->unit_name?>
                            <?=indo_currency($data->price)?>
                            <?=$data->stock?>

                                <button class="btn btn-xs btn-info" id="select"
                                    data-id="<?=$data->item_id?>"
                                    data-barcode="<?=$data->barcode?>"
                                    data-name="<?=$data->name?>"
                                    data-unit="<?=$data->unit_name?>"
                                    data-stock="<?=$data->stock?>">
                                     Select
                                </button>

                        <?php } ?>

please help me in solving this problem


问:
Microsoft EWS API Error while reading message from outlook "The request failed. ParseError at [row,col]:[1,24606] Message: Premature end of file."
I'm trying to use the Micosoft EWS Api to read mails from out look but i'm facing below mentioned error

Microsoft EWS API Error while reading message from outlook "The request failed. ParseError at [row,col]:[1,24606] Message: Premature end of file."

Code

```<code>public static void pageThroughEntireInbox(ExchangeService service) throws Exception {
        final int pageSize = 10;
        ItemView view = new ItemView(pageSize);
        FindItemsResults<Item> findResults;

        do {
            findResults = service.findItems(WellKnownFolderName.Inbox, view);
            ArrayList<Item> items=findResults.getItems();
            service.loadPropertiesForItems(items, PropertySet.FirstClassProperties);
            for (Item item : items) {
                System.out.println(item.getSubject());
                System.out.println(item.getBody());
            }

            view.setOffset(view.getOffset() + pageSize);
        } while (findResults.isMoreAvailable());
    }
</code>```

Below is the Error:

```<code>microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. ParseError at [row,col]:[1,24606]
Message: Premature end of file.
    at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:985)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:1028)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:1104)
    at com.example.demo.MicrosoftMailAccess.pageThroughEntireInbox(MicrosoftMailAccess.java:46)
    at com.example.demo.MicrosoftMailAccess.main(MicrosoftMailAccess.java:62)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,24606]
Message: Premature end of file.
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
    at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.read(EwsXmlReader.java:201)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.read(EwsXmlReader.java:182)
    at microsoft.exchange.webservices.data.core.PropertyBag.loadFromXml(PropertyBag.java:500)
    at microsoft.exchange.webservices.data.core.service.ServiceObject.loadFromXml(ServiceObject.java:298)
    at microsoft.exchange.webservices.data.core.response.FindItemResponse.internalReadItemsFromXml(FindItemResponse.java:185)
    at microsoft.exchange.webservices.data.core.response.FindItemResponse.readElementsFromXml(FindItemResponse.java:114)
    at microsoft.exchange.webservices.data.core.response.ServiceResponse.loadFromXml(ServiceResponse.java:133)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:76)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:44)
    at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:433)
    at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:401)
    at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:63)
    ... 6 more
</code>```

Body:
I'm trying to use the Micosoft EWS Api to read mails from out look but i'm facing below mentioned error

Microsoft EWS API Error while reading message from outlook "The request failed. ParseError at [row,col]:[1,24606] Message: Premature end of file."

Code

public static void pageThroughEntireInbox(ExchangeService service) throws Exception {
        final int pageSize = 10;
        ItemView view = new ItemView(pageSize);
        FindItemsResults<Item> findResults;

        do {
            findResults = service.findItems(WellKnownFolderName.Inbox, view);
            ArrayList<Item> items=findResults.getItems();
            service.loadPropertiesForItems(items, PropertySet.FirstClassProperties);
            for (Item item : items) {
                System.out.println(item.getSubject());
                System.out.println(item.getBody());
            }

            view.setOffset(view.getOffset() + pageSize);
        } while (findResults.isMoreAvailable());
    }

Below is the Error:

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. ParseError at [row,col]:[1,24606]
Message: Premature end of file.
    at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:985)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:1028)
    at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:1104)
    at com.example.demo.MicrosoftMailAccess.pageThroughEntireInbox(MicrosoftMailAccess.java:46)
    at com.example.demo.MicrosoftMailAccess.main(MicrosoftMailAccess.java:62)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,24606]
Message: Premature end of file.
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
    at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.read(EwsXmlReader.java:201)
    at microsoft.exchange.webservices.data.core.EwsXmlReader.read(EwsXmlReader.java:182)
    at microsoft.exchange.webservices.data.core.PropertyBag.loadFromXml(PropertyBag.java:500)
    at microsoft.exchange.webservices.data.core.service.ServiceObject.loadFromXml(ServiceObject.java:298)
    at microsoft.exchange.webservices.data.core.response.FindItemResponse.internalReadItemsFromXml(FindItemResponse.java:185)
    at microsoft.exchange.webservices.data.core.response.FindItemResponse.readElementsFromXml(FindItemResponse.java:114)
    at microsoft.exchange.webservices.data.core.response.ServiceResponse.loadFromXml(ServiceResponse.java:133)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:76)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:44)
    at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:433)
    at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.readResponse(ServiceRequestBase.java:401)
    at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:63)
    ... 6 more


问:
Re-render Server Component every X seconds
I have a server component that reads from the database:

```<code>import { db } from "@utils/database";

export async function UsersLayout() {
  let users = await db.query(...);
  // ...

  return (
    <ul>
      {users.map(user =>
        <li key={user.id}>{user.name}</li>
      )}
    </ul>
  )
}
</code>```

How can I make this component re-render every 60 seconds? Since this is a server component I cannot use useEffect and setTimeout...

I'm playing around with Nextjs.13

Body:
I have a server component that reads from the database:

import { db } from "@utils/database";

export async function UsersLayout() {
  let users = await db.query(...);
  // ...

  return (

      {users.map(user =>

{user.name}

      )}

  )
}

How can I make this component re-render every 60 seconds? Since this is a server component I cannot use useEffect and setTimeout...

I'm playing around with Nextjs.13


问:
How to deploy react app to vercel post method is showing 405 error?
I deployed reactjs app to vercel

I tried to signup on to the app but I am getting 405 error

but on the localhost, it is working fine

I hosted my server on ec2 instance on AWS

I want my reactjs to connect to ec2 instance and create an account

but what I see on the network tab on my browser is the 405 method not allowed error

Signup form

```<code>const NewStaff = () => {
const [submitting, setSubmitting] = useState(false)
const { TextArea } = Input;
const [form] = Form.useForm();
const onFinish = async (values) => {
    setSubmitting(true)

    try {
        const response = await axios.post("xxxxxx", values);
        form.resetFields();
        setSubmitting(false)
        success(response.data.msg, "top-right", 5000);
    } catch (error) {
        setSubmitting(false)
        if (error.response.data.length > 0) {
            error.response.data.map((item) => {
                info(item.msg, "top-right", 5000);
            })
        } else {
            info(error.response.data.msg, "top-right", 5000);

        }
    }
};

return (
    <FormStyles>
        <div>
            <ToastContainer />
            <Card
                className='form-card'
                type="inner"
            >
                <h4>New Staff</h4>
                <Divider />
                <Form
                    form={form}
                    labelCol={{
                        span: 24,
                    }}
                    wrapperCol={{
                        span: 24,
                    }}
                    onFinish={onFinish}
                    layout="vertical"
                >
                    <Form.Item
                        label="Surname"
                        name="surname"
                        rules={[{ required: true, message: "Surname is required" }]}>
                        <Input placeholder="Surname" />
                    </Form.Item>
                    <Form.Item
                        label="First Name"
                        name="firstName"
                        rules={[{ required: true, message: "First Name is required" }]}>
                        <Input placeholder="First Name" />
                    </Form.Item>
                    <Form.Item>
                        <Button type="primary" htmlType="submit">
                            {submitting ? "Processing..." : "Submit"}
                        </Button>
                    </Form.Item>
                </Form>
            </Card>
        </div >
    </FormStyles>
)
</code>```

}

package.json

```<code>{
 "name": "MarbleArch",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@reduxjs/toolkit": "^1.9.0",
"@testing-library/jest-dom": "^5.16.1"
},
"scripts": {
  "start": "react-scripts  start",
  "build": "react-scripts  build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
 },
 "eslintConfig": {
   "extends": [
     "react-app",
     "react-app/jest"
   ]
 },
 "browserslist": {
   "production": [
     ">0.2%",
     "not dead",
     "not op_mini all"
   ],
 },
 "proxy": "http://x.x.x.x:6500/api/"
}
</code>```

Body:
I deployed reactjs app to vercel

I tried to signup on to the app but I am getting 405 error

but on the localhost, it is working fine

I hosted my server on ec2 instance on AWS

I want my reactjs to connect to ec2 instance and create an account

but what I see on the network tab on my browser is the 405 method not allowed error

Signup form

const NewStaff = () => {
const [submitting, setSubmitting] = useState(false)
const { TextArea } = Input;
const [form] = Form.useForm();
const onFinish = async (values) => {
    setSubmitting(true)

    try {
        const response = await axios.post("xxxxxx", values);
        form.resetFields();
        setSubmitting(false)
        success(response.data.msg, "top-right", 5000);
    } catch (error) {
        setSubmitting(false)
        if (error.response.data.length > 0) {
            error.response.data.map((item) => {
                info(item.msg, "top-right", 5000);
            })
        } else {
            info(error.response.data.msg, "top-right", 5000);

        }
    }
};

return (
    <FormStyles>

            <ToastContainer />
            <Card
                className='form-card'
                type="inner"
            >

New Staff

                <Divider />
                <Form
                    form={form}
                    labelCol={{
                        span: 24,
                    }}
                    wrapperCol={{
                        span: 24,
                    }}
                    onFinish={onFinish}
                    layout="vertical"
                >
                    <Form.Item
                        label="Surname"
                        name="surname"
                        rules={[{ required: true, message: "Surname is required" }]}>
                        <Input placeholder="Surname" />
                    </Form.Item>
                    <Form.Item
                        label="First Name"
                        name="firstName"
                        rules={[{ required: true, message: "First Name is required" }]}>
                        <Input placeholder="First Name" />
                    </Form.Item>
                    <Form.Item>
                        <Button type="primary" htmlType="submit">
                            {submitting ? "Processing..." : "Submit"}
                        </Button>
                    </Form.Item>
                </Form>
            </Card>

    </FormStyles>
)

}

package.json

{
 "name": "MarbleArch",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@reduxjs/toolkit": "^1.9.0",
"@testing-library/jest-dom": "^5.16.1"
},
"scripts": {
  "start": "react-scripts  start",
  "build": "react-scripts  build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
 },
 "eslintConfig": {
   "extends": [
     "react-app",
     "react-app/jest"
   ]
 },
 "browserslist": {
   "production": [
     ">0.2%",
     "not dead",
     "not op_mini all"
   ],
 },
 "proxy": "http://x.x.x.x:6500/api/"
}


问:
How to create grid fractional layout with elements spanning multiple rows with Bootstrap 5 grids?
I know how I would like my UI to look and I have managed to sketch it with pure css grid layout. Preview: https://jsfiddle.net/oa5t3m14/

https://imgur.com/a/dqaiyUG

Code below:

```<code><html>
<head>
    <style>
        html,
        body {
            height: 100%;
        }
        body {
            margin: 0;
        }
        div {
            border-style: solid;
            border-width: 1px;
            padding: 10px
        }
        textarea {
            border-style: none;
        }
    </style>
</head>
<div
    style="display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: 1fr 1fr 12fr 1fr; grid-gap: 10px; width: 100vw; height: 100vh; border-style: none; border-width: 0px; padding: 0px">
    <div style="grid-column: 1 / span 2; grid-row: 1">Link1 Link2 Link3</div>
    <div style="grid-column: 1; grid-row: 2">Text area title 1</div>
    <div style="grid-column: 1; grid-row: 3">
        <textarea style="resize: none; height: 100%; width: 100%;" class="p-3" placeholder="Text area 2"></textarea>
    </div>
    <div style="grid-column: 2; grid-row: 2">Text area title 2</div>
    <div style="grid-column: 2; grid-row: 3">
        <textarea style="resize: none; height: 100%; width: 100%;" class="p-3" placeholder="Text area 2"></textarea>
    </div>
    <div style="grid-column: 1 / span 2; grid-row: 4">Footer</div>
</div>
</html>
</code>```

But I would like to use use Bootstrap as much as possible. I have tried to recreate the same design with Bootstrap but with no success. I followed this advice: How can I get a Bootstrap column to span multiple rows?

I bet there is a quite obvious solution to this but I'm new to the web design and it got me stuck.

Body:
I know how I would like my UI to look and I have managed to sketch it with pure css grid layout. Preview: https://jsfiddle.net/oa5t3m14/

https://imgur.com/a/dqaiyUG

Code below:

Link1 Link2 Link3

Text area title 1

        <textarea style="resize: none; height: 100%; width: 100%;" class="p-3" placeholder="Text area 2"></textarea>

Text area title 2

        <textarea style="resize: none; height: 100%; width: 100%;" class="p-3" placeholder="Text area 2"></textarea>

Footer

But I would like to use use Bootstrap as much as possible. I have tried to recreate the same design with Bootstrap but with no success. I followed this advice: How can I get a Bootstrap column to span multiple rows?

I bet there is a quite obvious solution to this but I'm new to the web design and it got me stuck.


问:
How can I play chunked video using react-native-video?
We are developing application such as Tiktok where we are using Flatlist to list videos and using react-native-video library to display videos.

Now, whenever our video is big such as 50 MB or 100 MB, react-native-video is taking too much time to load video.

How can we apply range request to MP4 video within react-natice-video to get chunk of MP4 file rather than getting whole video.

In backend we are using AWS Cloudfront and it supports range request for MP4 videos.


问:
PHP ceil calculation differs in result from manually calculated result
I have this script:

```<code>function round_price_with_limits( $price = null, $multiplier = 9.3, $nearest = 10, $minus = 0.05, $map = 9.95, $msrp = 9999999999) {

    // Ensure a price was provided.
    if ( !empty( $price ) ) {

        // Calculate price with markup and round it.
        $rounded_price = ( ceil ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus;

        // If price is less than minimum, return minimum.
        if($rounded_price < $map){

            return $map;

        }
        // If price is greater than maximum, return maximum.
        elseif($rounded_price > $msrp){

            return $msrp;

        } else {

            // Return price otherwise.
            return $rounded_price;

        }

    }
}
</code>```

It works on almost all products, except for one with $price value = 1,76.
The end result when running the script becommes 9.95
When I calculate by hand, the result is 19.95
Can you spot why this is calculated differently via the php?

Body:
I have this script:

function round_price_with_limits( $price = null, $multiplier = 9.3, $nearest = 10, $minus = 0.05, $map = 9.95, $msrp = 9999999999) {

    // Ensure a price was provided.
    if ( !empty( $price ) ) {

        // Calculate price with markup and round it.
        $rounded_price = ( ceil ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus;

        // If price is less than minimum, return minimum.
        if($rounded_price < $map){

            return $map;

        }
        // If price is greater than maximum, return maximum.
        elseif($rounded_price > $msrp){

            return $msrp;

        } else {

            // Return price otherwise.
            return $rounded_price;

        }

    }
}

It works on almost all products, except for one with $price value = 1,76.
The end result when running the script becommes 9.95
When I calculate by hand, the result is 19.95
Can you spot why this is calculated differently via the php?


问:
Bluetooth Device not showing up
So, my xbox one controller does not show up in my windows 10 bluetooth pairing. It 100% is not a problem with the controller since it works in both other pcs and my android phone. Somewhere, somehow, its id is forgotten in my bluetooth settings. I have, used bluetooth tools to unpair everything, removed everything xbox related from my device manager, removed the controller from devices and printers, and obviously removed from bluetooth and other devices. Even after deleting the device from

```<code>Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Devices
</code>```

i still cannot for the life of me connect it to my pc. Any idea how I can delete all my connected ids or something? It used to work until yesterday, when i plugged it and then unplugged it using a usb cable.

Title: Bluetooth Device not showing up

Body:
So, my xbox one controller does not show up in my windows 10 bluetooth pairing. It 100% is not a problem with the controller since it works in both other pcs and my android phone. Somewhere, somehow, its id is forgotten in my bluetooth settings. I have, used bluetooth tools to unpair everything, removed everything xbox related from my device manager, removed the controller from devices and printers, and obviously removed from bluetooth and other devices. Even after deleting the device from

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Devices

i still cannot for the life of me connect it to my pc. Any idea how I can delete all my connected ids or something? It used to work until yesterday, when i plugged it and then unplugged it using a usb cable.


问:
Null session on first useQuery after reloading page
I'm developping an application with a Next, TRPC and NextAuth (and Prisma but I believe there no issue with that one).

I have a page which displays a collection of elements. It retrieves the collection via an authenticated TRPC useQuery :

function Collection() {
  const { data: session } = useSession();
  const collectionsQuery = trpc.collectionRouter.collection.useQuery();
  if (session) {
    return (

        <Layout>

Collections

          <Link href="/collections/add" className="btn btn-sm btn-success mb-2">Add Collection</Link>

            {
              collectionsQuery.data && collectionsQuery.data.length != 0 ?
              JSON.stringify(collectionsQuery.data)
              :

No collections To Display

            }

        </Layout>

    );
  } else {
    return (

Not logged

    )
  }
}
```
<p>It always fail when I reload the page, then when I navigate via my application menu to go to another page and come back to this page, all queries are successfull.</p>
<p>On server side (context,ts), the getSession returns null on reload page, then works on every further calls :</p>
<pre class="lang-js prettyprint-override"><code>export async function createContext(opts: trpcNext.CreateNextContextOptions) {
  const session = await getSession(opts);

  if (session == null) {
    console.log("null session");
  }
  return {
    session,
  };
};
</code>```

What could cause the session to be null on page reload ?

Edit : When the query does not work on page reload, I see that the auth cookie is correctly set client side but is null on server side.

Edit 2 : This seems related to this one Don't get cookies in trpc context
But the advice of including the following piece of code in createTRPCNext / config does not work and does not even seem to get called :

      headers: () => {
        if (ctx?.req) {
          // on ssr, forward client's headers to the server
          return {
            ...ctx.req.headers,
            'x-ssr': '1',
          };
        }
```

Body:
I'm developping an application with a Next, TRPC and NextAuth (and Prisma but I believe there no issue with that one).

I have a page which displays a collection of elements. It retrieves the collection via an authenticated TRPC useQuery :

function Collection() {
  const { data: session } = useSession();
  const collectionsQuery = trpc.collectionRouter.collection.useQuery();
  if (session) {
    return (

        <Layout>

Collections

          <Link href="/collections/add" className="btn btn-sm btn-success mb-2">Add Collection</Link>

            {
              collectionsQuery.data && collectionsQuery.data.length != 0 ?
              JSON.stringify(collectionsQuery.data)
              :

No collections To Display

            }

        </Layout>

    );
  } else {
    return (

Not logged

    )
  }
}

It always fail when I reload the page, then when I navigate via my application menu to go to another page and come back to this page, all queries are successfull.

On server side (context,ts), the getSession returns null on reload page, then works on every further calls :

export async function createContext(opts: trpcNext.CreateNextContextOptions) {
  const session = await getSession(opts);

  if (session == null) {
    console.log("null session");
  }
  return {
    session,
  };
};

What could cause the session to be null on page reload ?

Edit : When the query does not work on page reload, I see that the auth cookie is correctly set client side but is null on server side.

Edit 2 : This seems related to this one Don't get cookies in trpc context
But the advice of including the following piece of code in createTRPCNext / config does not work and does not even seem to get called :

      headers: () => {
        if (ctx?.req) {
          // on ssr, forward client's headers to the server
          return {
            ...ctx.req.headers,
            'x-ssr': '1',
          };
        }


问:
All cells not running after restart and run all inn jupyter
When I ran an infinite loop accidentally, restart and run all cells command did not execute all cells. Some cells did not show the output and also the cell numbering was altered. What should I do.

I tried running all cells again but some cells did not show any output.
Cells from in between the notebook were running and altered the numbering.


问:
Axis2 generated client convert <!CDATA to <![CDATA[
I generated an Axis2 client from a wsdl.
In the body of my request I need to send a value that should look like this:

```<code>String bodyRequest = "<inputXml>
  <![CDATA[{
    "pricing": {
      "item": "AZ0225220",
      "price": "2000",
    }
  }]]>
</inputXml>"
</code>```

my snippet code:

```<code>PricingServiceStub serviceStub = new PricingServiceStub();
RunDocument runDocument = RunDocument.Factory.newInstance();
Run runRequestContent = Run.Factory.newInstance(options);
runRequestContent.setInputXml(bodyRequest);
runDocument.setRun(runRequestContent);
serviceStub.run(runDocument);
</code>```

and when sending the request the <![CDATA[ tag is converted to <![CDATA[

Do you have any idea how to make sure that < is not converted to < when working with axis2?

Thank you in advance

Body:
I generated an Axis2 client from a wsdl.
In the body of my request I need to send a value that should look like this:

String bodyRequest = "<inputXml>
  <![CDATA[{
    "pricing": {
      "item": "AZ0225220",
      "price": "2000",
    }
  }]]>
</inputXml>"

my snippet code:

PricingServiceStub serviceStub = new PricingServiceStub();
RunDocument runDocument = RunDocument.Factory.newInstance();
Run runRequestContent = Run.Factory.newInstance(options);
runRequestContent.setInputXml(bodyRequest);
runDocument.setRun(runRequestContent);
serviceStub.run(runDocument);

and when sending the request the <![CDATA[ tag is converted to <![CDATA[

Do you have any idea how to make sure that < is not converted to < when working with axis2?

Thank you in advance