问:
PHP/MySQL: Storing Entry Names/Languages Separately Or Deliminated?
I have a MySQL table that will contain the name of books.  This table will contain the title in various languages including English, Spanish, French, German, Japanese, Romaji.  I'm trying to figure out the best way to store this information and have come up with two options.

Option A - Multiple Columns:
Quite simply, a column for each, such as..
id, title_en, title_sp, title_fr, title_de, title_ja, title_ro

Option B - One Column:
The other would be to store all names in ONE column, such as..
id, title
1, en:Example Book Title;sp:Ejemplo de título de libro
Option B would then be pulled with a SQL query and split with php using explode().

Not ALL these books will have titles in various languages.  In fact, most of them will have half or less of the supported languages.  That being said, if option A is used, a null/empty value will be in a lot of the entries.

Option A requires pulling info, half of which is empty/null.
Option B pulls one column vs many, and processes it via PHP.

Both options work great but I guess my bigger question is... at scale, would pulling a ton of empty/null entries cost unnecessary cycles compared to just pulling one column and splitting it in PHP?  Or would there really be no obvious difference?  The only real advantage I can see in Option A is if I wanted to search by exact title.

Edit: For context, there will be 10K+ entries and the various language titles are to show the alternate titles.  Normalizing the DB does seem to make sense as mentioned in comments, and should pull up fine when properly querying.  I got so used to always having a title/name in a table, I was overthinking what to do if there were multiple titles/names.


来源: stackexchange

问:
Stock Alerts Laravel-9/JavaScript
I want to create a function on key up click that should rise the message Selling Quantity is more than Quantity in Stock I tried the below code

I am getting the data using ajax request and there is a read-only column that shows the total product count in stock which works perfectly.
I am adding multiple invoices to dynamically adding row list the only problem I am facing is that I don't know how to check each product count when I add it to the list of the invoice should not be greater than the stock it only checks the first row did not check the other rows.

Here I am checking the stock quantity and selling quantity

```<code>  <script id="document-template" type="text/x-handlebars-template">
       <td> <input type="number" min="1" class="form-control selling_qty text-right" name="selling_qty[]" value=""> </td>

          <td> <input type="number" class="form-control unit_price text-right" name="unit_price[]" value="">  </td>
     </script>

<script type="text/javascript">
      $(document).on('keyup click','.unit_price,.selling_qty', function() {
      var current_stock_qty = $('#current_stock_qty').val();
      var seling_qty = $(this).closest('tr').find('.selling_qty').val();
       if(current_stock_qty < seling_qty) {
       $.notify("Selling Quantity is
      Grather then Quantity in Stock " , { globalPosition: 'top right',
      className: 'error' }); } }); }); // end here
  </script>
</code>```

current_stock_qty value is changed when I chose a different product the problem is that it checks the condition only with first-row current_stock_qty not with each of them when I add the items for example when I chose cement it gave me 3 which is the correct current_stock_qty when I chose another product like steel which current_stock_qty is 10 it gives me to correct quantity but the problem is that it checks the condition only with first-row current_stock_qty which was cement not with each of item ,when the selling_qty becomes greater than a first product which is cement it starts popping the message while I am adding the second product and want to run the condition as per the quantity of each product.

add_invoice Blade html code

```<code>                <div class="col-md-3">
                    <div class="md-3">
                        <label for="example-text-input" class="form-label">Product Name </label>
                        <select name="product_id" id="product_id" class="form-select select2"
                            aria-label="Default select example">
                            <option selected="">Open this select menu</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-1">
                    <div class="md-3">
                        <label for="example-text-input" class="form-label">Stock(Pic/Kg)</label>
                        <input class="form-control example-date-input" name="current_stock_qty" type="text"
                            id="current_stock_qty" readonly style="background-color:#ddd">

                    </div>
                </div>

<div class="card-body">
                <form method="post" action="{{ route('invoice.store') }}">
                    @csrf
                    <table class="table-sm table-bordered" width="100%" style="border-color: #ddd;">
                        <thead>
                            <tr>
                                <th width="7%">PSC/KG</th>
                            </tr>
                        </thead>

                        <tbody id="addRow" class="addRow">
                             // here the input will generated
                        </tbody>

                        <tbody>
                        </tbody>
                    </table><br>

</code>```

ContentLicense: CC BY-SA 4.0

Title: Stock Alerts Laravel-9/JavaScript

Body:
I want to create a function on key up click that should rise the message Selling Quantity is more than Quantity in Stock I tried the below code

I am getting the data using ajax request and there is a read-only column that shows the total product count in stock which works perfectly.
I am adding multiple invoices to dynamically adding row list the only problem I am facing is that I don't know how to check each product count when I add it to the list of the invoice should not be greater than the stock it only checks the first row did not check the other rows.

Here I am checking the stock quantity and selling quantity

current_stock_qty value is changed when I chose a different product the problem is that it checks the condition only with first-row current_stock_qty not with each of them when I add the items for example when I chose cement it gave me 3 which is the correct current_stock_qty when I chose another product like steel which current_stock_qty is 10 it gives me to correct quantity but the problem is that it checks the condition only with first-row current_stock_qty which was cement not with each of item ,when the selling_qty becomes greater than a first product which is cement it starts popping the message while I am adding the second product and want to run the condition as per the quantity of each product.

add_invoice Blade html code

                        Product Name
                        <select name="product_id" id="product_id" class="form-select select2"
                            aria-label="Default select example">
                            <option selected="">Open this select menu</option>
                        </select>

                        Stock(Pic/Kg)
                        <input class="form-control example-date-input" name="current_stock_qty" type="text"
                            id="current_stock_qty" readonly style="background-color:#ddd">

                <form method="post" action="{{ route('invoice.store') }}">
                    @csrf

                                PSC/KG

                             // here the input will generated


问:
Rundeck: some jobs stuck on running state via SSH
Some jobs stuck on running state from time to time , so we have to kill such executions. What's a problem can be? Is there a way to fix it?

Rundeck 3.3.0 and 4.0.1
Node executor: SSH
Node: Windows 2012R2, openssh 8.1p1 and 8.9p1

This problem is absent via WinRM. We chose ssh cause we can kill jobs with processes on windows node. WinRM can't do that.


问:
Problem with labels using library Charts with UIKit in XCode 12
Hell my friends.I'm developing an app which has to show several charts using UIKit and the library Charts. I've been requested to use both things.

I have two arrays with correct data Ciudades y Precios.
Ciudades is String type and Precios Double type. I'v been reading how to use Charts library for hours but it seems that I dont understand how to use it because the chart I get it's not the one I excpected to. I need a chart with the cities on x label but they are not showed as you can see in the picture.

This is my code

```<code>class BarChartViewController: UIViewController, ChartViewDelegate {

    @IBOutlet weak var barChartView: BarChartView!
    var nombres: [String]!
    var precios: [Double]!

    override func viewDidLoad() {
        super.viewDidLoad()
        barChartView.delegate = self
        nombres = eventos.devolverNombre()
        print(nombres)
        precios = eventos.devolverPrecios()
        setChart(dataPoints: nombres, values: precios)
    }
    func setChart(dataPoints: [String], values: [Double]) {
        barChartView.noDataText = "Es necesario añadir datos."
        var dataEntries: [BarChartDataEntry] = []
        for i in 0..<dataPoints.count {
            let  dataEntry = BarChartDataEntry(x: Double(i), y: values[i])
            if dataEntry != nil {
                dataEntries.append(dataEntry)}
        }
        let chartDataSet = BarChartDataSet(entries: dataEntries, label: "PRECIOS POR EVENTO")
        let chartData = BarChartData(dataSet: chartDataSet)
        chartDataSet.colors = [UIColor(red: 230/255, green: 126/255, blue: 34/255, alpha: 1)]
        chartDataSet.colors = ChartColorTemplates.colorful()
        barChartView.data = chartData
        barChartView.xAxis.valueFormatter = DefaultAxisValueFormatter(block: {(index, _) in
                return self.nombres[Int(index)] })
        let labelCount = nombres.count
        print(labelCount)
        barChartView.xAxis.setLabelCount(labelCount, force: true)
        barChartView.xAxis.labelRotationAngle = 90
        barChartView.xAxis.centerAxisLabelsEnabled = true
        barChartView.xAxis.labelPosition = .bottom
        barChartView.xAxis.labelFont = UIFont.systemFont(ofSize: 10)
        barChartView.animate(xAxisDuration: 1.0, yAxisDuration: 1.0, easingOption: .easeInBounce)
    }
}
</code>```

Body:
Hell my friends.I'm developing an app which has to show several charts using UIKit and the library Charts. I've been requested to use both things.

I have two arrays with correct data Ciudades y Precios.
Ciudades is String type and Precios Double type. I'v been reading how to use Charts library for hours but it seems that I dont understand how to use it because the chart I get it's not the one I excpected to. I need a chart with the cities on x label but they are not showed as you can see in the picture.

This is my code

class BarChartViewController: UIViewController, ChartViewDelegate {

    @IBOutlet weak var barChartView: BarChartView!
    var nombres: [String]!
    var precios: [Double]!

    override func viewDidLoad() {
        super.viewDidLoad()
        barChartView.delegate = self
        nombres = eventos.devolverNombre()
        print(nombres)
        precios = eventos.devolverPrecios()
        setChart(dataPoints: nombres, values: precios)
    }
    func setChart(dataPoints: [String], values: [Double]) {
        barChartView.noDataText = "Es necesario añadir datos."
        var dataEntries: [BarChartDataEntry] = []
        for i in 0..<dataPoints.count {
            let  dataEntry = BarChartDataEntry(x: Double(i), y: values[i])
            if dataEntry != nil {
                dataEntries.append(dataEntry)}
        }
        let chartDataSet = BarChartDataSet(entries: dataEntries, label: "PRECIOS POR EVENTO")
        let chartData = BarChartData(dataSet: chartDataSet)
        chartDataSet.colors = [UIColor(red: 230/255, green: 126/255, blue: 34/255, alpha: 1)]
        chartDataSet.colors = ChartColorTemplates.colorful()
        barChartView.data = chartData
        barChartView.xAxis.valueFormatter = DefaultAxisValueFormatter(block: {(index, _) in
                return self.nombres[Int(index)] })
        let labelCount = nombres.count
        print(labelCount)
        barChartView.xAxis.setLabelCount(labelCount, force: true)
        barChartView.xAxis.labelRotationAngle = 90
        barChartView.xAxis.centerAxisLabelsEnabled = true
        barChartView.xAxis.labelPosition = .bottom
        barChartView.xAxis.labelFont = UIFont.systemFont(ofSize: 10)
        barChartView.animate(xAxisDuration: 1.0, yAxisDuration: 1.0, easingOption: .easeInBounce)
    }
}


问:
How to get data from firestore using intent object
I am having some issues with the intent object. I already retrieved it with the new Activity but it doesn't work when passed to Firestore queries. The passed extra is for other users to get details of other users for a View. If I use the current user in auth and then pass it to a query it works but I need the details of other users for the View. It seems the intent string or items is not recognized when doing the query so I tried setting the TextView instead of getting the value of the text id and then doing the query, still doesn't work for me either way. Hope anyone can help with this. Thanks a lot.

```<code>                import androidx.appcompat.app.AppCompatActivity;
                import androidx.appcompat.widget.Toolbar;
                import androidx.recyclerview.widget.LinearLayoutManager;
                import androidx.recyclerview.widget.RecyclerView;

                import android.os.Bundle;
                import android.view.View;
                import android.widget.ImageView;
                import android.widget.TextView;
                import android.widget.Toast;

                import com.example.shopnshare.R;
                import com.example.shopnshare.activities.adapters.SliderAdapter;
                import com.example.shopnshare.activities.adapters.ViewAllAdapter;
                import com.example.shopnshare.activities.adapters.models.ImageModel;

                import com.google.android.gms.tasks.OnCompleteListener;
                import com.google.android.gms.tasks.OnSuccessListener;
                import com.google.android.gms.tasks.Task;
                import com.google.firebase.database.annotations.Nullable;
                import com.google.firebase.firestore.CollectionReference;
                import com.google.firebase.firestore.DocumentSnapshot;
                import com.google.firebase.firestore.EventListener;
                import com.google.firebase.firestore.FirebaseFirestore;
                import com.google.firebase.firestore.FirebaseFirestoreException;
                import com.google.firebase.firestore.QueryDocumentSnapshot;
                import com.google.firebase.firestore.QuerySnapshot;

                import org.checkerframework.checker.nullness.qual.NonNull;

                import java.util.ArrayList;
                import java.util.List;

                public class ShopPageActivity extends AppCompatActivity {

                    FirebaseFirestore firestore;
                    RecyclerView image_rec;

                    List<ImageModel> images;
                    Toolbar toolbar;
                    ImageView logo;

                    SliderAdapter sliderAdapter;

                    CollectionReference db;

                    //    ProgressBar pb;
                    TextView shop_page_id, uname, ucontact, ufacebook, uinstagram, udescription,uNewId;
                //    String finalId;

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

                        firestore = FirebaseFirestore.getInstance();

                        uname = findViewById(R.id.shop_page_name);
                        ucontact = findViewById(R.id.shop_page_contact);

                        uNewId = findViewById(R.id.shop_page_id);
                        udescription = findViewById(R.id.shop_page_description);
                        ufacebook = findViewById(R.id.shop_page_description);
                        uinstagram = findViewById(R.id.shop_page_description);

                        uNewId.setText(getIntent().getStringExtra("seller"));

                        toolbar = findViewById(R.id.shop_page_toolbar);

                        setSupportActionBar(toolbar);
                        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

                        image_rec = findViewById(R.id.shop_page_slider_rec);

                        image_rec.setLayoutManager(new LinearLayoutManager(ShopPageActivity.this, RecyclerView.HORIZONTAL, false));
                        images = new ArrayList<>();
                        sliderAdapter = new SliderAdapter(this, images);
                        image_rec.setAdapter(sliderAdapter);
                        sliderAdapter.notifyDataSetChanged();
                    }

                    public  void getUserImages() {
                //            String newIds = sellDetail;
                            String newIds = String.valueOf(uNewId.getText());

                            firestore.collection("Images").document(String.valueOf(newIds)).collection("Images")
                                    .get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
                                        @Override
                                        public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                                            for (QueryDocumentSnapshot document : queryDocumentSnapshots) {
                                                ImageModel image = document.toObject(ImageModel.class);
                                                Toast.makeText(ShopPageActivity.this, image.getUser_id(), Toast.LENGTH_SHORT).show();
                                                images.add(image);
                                                sliderAdapter.notifyDataSetChanged();
                //                                    pb.setVisibility(View.GONE);
                                                image_rec.setVisibility(View.VISIBLE);
                //                                    noProducts.setVisibility(View.GONE);
                                            }
                                        }
                                    });
                    }

                    @Override
                    protected void onStart() {
                        super.onStart();

                //            String sellDetail = getIntent().getStringExtra("seller");
                            firestore.collection("Users").document(String.valueOf(uNewId.getText())).addSnapshotListener(new EventListener<DocumentSnapshot>() {
                                @Override
                                public void onEvent(@Nullable DocumentSnapshot snapshot, @Nullable FirebaseFirestoreException error) {
                                Toast.makeText( ShopPageActivity.this,"ahaasddd"+uNewId.getText(),Toast.LENGTH_SHORT).show();
                                    if (error != null) {
                //                    Log.w(TAG, "Listen failed.", error);
                                        return;
                                    }

                                    if (snapshot != null && snapshot.exists()) {
                                        String seller_pic = snapshot.getString("user_images");
                                        String name = snapshot.getString("name");
                                        String id = snapshot.getString("id");
                                        String contact = snapshot.getString("contact");
                                        String facebook = snapshot.getString("facebook");
                                        String instagram = snapshot.getString("instagram");
                                        String description = snapshot.getString("description");
                //                    filePath = seller_pic;
                                        uname.setText(name);
                                        uNewId.setText(id);
                                        ucontact.setText(contact);
                                        ufacebook.setText(facebook);
                                        uinstagram.setText(instagram);
                                        udescription.setText(description);

                                    }
                                }

                            });

                        getUserImages();

                    }
                }
</code>```

All variables/dependencies below are declared already here.

Body:
I am having some issues with the intent object. I already retrieved it with the new Activity but it doesn't work when passed to Firestore queries. The passed extra is for other users to get details of other users for a View. If I use the current user in auth and then pass it to a query it works but I need the details of other users for the View. It seems the intent string or items is not recognized when doing the query so I tried setting the TextView instead of getting the value of the text id and then doing the query, still doesn't work for me either way. Hope anyone can help with this. Thanks a lot.

                import androidx.appcompat.app.AppCompatActivity;
                import androidx.appcompat.widget.Toolbar;
                import androidx.recyclerview.widget.LinearLayoutManager;
                import androidx.recyclerview.widget.RecyclerView;

                import android.os.Bundle;
                import android.view.View;
                import android.widget.ImageView;
                import android.widget.TextView;
                import android.widget.Toast;

                import com.example.shopnshare.R;
                import com.example.shopnshare.activities.adapters.SliderAdapter;
                import com.example.shopnshare.activities.adapters.ViewAllAdapter;
                import com.example.shopnshare.activities.adapters.models.ImageModel;

                import com.google.android.gms.tasks.OnCompleteListener;
                import com.google.android.gms.tasks.OnSuccessListener;
                import com.google.android.gms.tasks.Task;
                import com.google.firebase.database.annotations.Nullable;
                import com.google.firebase.firestore.CollectionReference;
                import com.google.firebase.firestore.DocumentSnapshot;
                import com.google.firebase.firestore.EventListener;
                import com.google.firebase.firestore.FirebaseFirestore;
                import com.google.firebase.firestore.FirebaseFirestoreException;
                import com.google.firebase.firestore.QueryDocumentSnapshot;
                import com.google.firebase.firestore.QuerySnapshot;

                import org.checkerframework.checker.nullness.qual.NonNull;

                import java.util.ArrayList;
                import java.util.List;

                public class ShopPageActivity extends AppCompatActivity {

                    FirebaseFirestore firestore;
                    RecyclerView image_rec;

                    List<ImageModel> images;
                    Toolbar toolbar;
                    ImageView logo;

                    SliderAdapter sliderAdapter;

                    CollectionReference db;

                    //    ProgressBar pb;
                    TextView shop_page_id, uname, ucontact, ufacebook, uinstagram, udescription,uNewId;
                //    String finalId;

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

                        firestore = FirebaseFirestore.getInstance();

                        uname = findViewById(R.id.shop_page_name);
                        ucontact = findViewById(R.id.shop_page_contact);

                        uNewId = findViewById(R.id.shop_page_id);
                        udescription = findViewById(R.id.shop_page_description);
                        ufacebook = findViewById(R.id.shop_page_description);
                        uinstagram = findViewById(R.id.shop_page_description);

                        uNewId.setText(getIntent().getStringExtra("seller"));

                        toolbar = findViewById(R.id.shop_page_toolbar);

                        setSupportActionBar(toolbar);
                        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

                        image_rec = findViewById(R.id.shop_page_slider_rec);

                        image_rec.setLayoutManager(new LinearLayoutManager(ShopPageActivity.this, RecyclerView.HORIZONTAL, false));
                        images = new ArrayList<>();
                        sliderAdapter = new SliderAdapter(this, images);
                        image_rec.setAdapter(sliderAdapter);
                        sliderAdapter.notifyDataSetChanged();
                    }

                    public  void getUserImages() {
                //            String newIds = sellDetail;
                            String newIds = String.valueOf(uNewId.getText());

                            firestore.collection("Images").document(String.valueOf(newIds)).collection("Images")
                                    .get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
                                        @Override
                                        public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                                            for (QueryDocumentSnapshot document : queryDocumentSnapshots) {
                                                ImageModel image = document.toObject(ImageModel.class);
                                                Toast.makeText(ShopPageActivity.this, image.getUser_id(), Toast.LENGTH_SHORT).show();
                                                images.add(image);
                                                sliderAdapter.notifyDataSetChanged();
                //                                    pb.setVisibility(View.GONE);
                                                image_rec.setVisibility(View.VISIBLE);
                //                                    noProducts.setVisibility(View.GONE);
                                            }
                                        }
                                    });
                    }

                    @Override
                    protected void onStart() {
                        super.onStart();

                //            String sellDetail = getIntent().getStringExtra("seller");
                            firestore.collection("Users").document(String.valueOf(uNewId.getText())).addSnapshotListener(new EventListener<DocumentSnapshot>() {
                                @Override
                                public void onEvent(@Nullable DocumentSnapshot snapshot, @Nullable FirebaseFirestoreException error) {
                                Toast.makeText( ShopPageActivity.this,"ahaasddd"+uNewId.getText(),Toast.LENGTH_SHORT).show();
                                    if (error != null) {
                //                    Log.w(TAG, "Listen failed.", error);
                                        return;
                                    }

                                    if (snapshot != null && snapshot.exists()) {
                                        String seller_pic = snapshot.getString("user_images");
                                        String name = snapshot.getString("name");
                                        String id = snapshot.getString("id");
                                        String contact = snapshot.getString("contact");
                                        String facebook = snapshot.getString("facebook");
                                        String instagram = snapshot.getString("instagram");
                                        String description = snapshot.getString("description");
                //                    filePath = seller_pic;
                                        uname.setText(name);
                                        uNewId.setText(id);
                                        ucontact.setText(contact);
                                        ufacebook.setText(facebook);
                                        uinstagram.setText(instagram);
                                        udescription.setText(description);

                                    }
                                }

                            });

                        getUserImages();

                    }
                }

All variables/dependencies below are declared already here.


问:
How to customize markdown with Astro components?

md vs mdx

md import pipeline renders to html, mdx import pipeline renders to .js/.ts/.jsx... which allows to customize html tags with Astro components.

goal

I would like to take advantage of the mdx power in .md files with Astro

what I tried

tried to configure mdx integration in Astro but it is excluding .md extension unfortunately to allow default md rehype pipeline

My workaround of renaming all .md files to .mdx is very intrusive (changes files meta data) I would like to find a different approach

forking mdx integration is hard to maintain

I started a vite plugin that changes .md ids to add an x as .mdx, then I had to write my own loader, then it got too complex

astro-remote only takes some default components and does allow to replace any custom component

examples

I would like to avoid

(-) embedding svg assets in config files to e.g. add link icons in headings elements (example https://github.com/withastro/docs/blob/52bf88ec74e3d01d212808d678320f190be64f76/astro.config.ts#L16)

and rather

(+) allow advanced enhancements written in html like e.g. .astro and NOT in rehype js format. (example just for reference in mdx not md https://github.com/MicroWebStacks/astro-big-doc/blob/9d4215e86c020bf72f28ce83d8e494df23e0ff7d/src/components/headings/H1.astro#L15)

Any ideas of the finest approach to achieve this, it feels like this last step is missing to unleash Astro's power over Markdow !!!

references

astro remote : https://github.com/natemoo-re/astro-remote

using old or deprecated options such as the previous <Markdown /> tag, might be an option to explore but should not result in separate feature branch where most of new features have to be manually maintained.

programmatic component creation https://github.com/withastro/astro/blob/main/packages/astro/test/units/render/jsx.test.js#L33-L35


问:
NextJs cors blocks all requests to API routes
I have made a nextjs app and i cant use it's API's properly, requests to API routes only success if i send requests to from http://localhost:3000/, i want to be able to access them from anywhere

I tried allowing all origins from next.js configs file but i didn't help

// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  async headers() {
    return [
      {
        // matching all API routes
        source: "/api/(.*)",
        headers: [
          { key: "Access-Control-Allow-Credentials", value: "true" },
          { key: "Access-Control-Allow-Origin", value: "*" },
          {
            key: "Access-Control-Allow-Methods",
            value: "GET,OPTIONS,PATCH,DELETE,POST,PUT",
          },
          {
            key: "Access-Control-Allow-Headers",
            value: "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
          },
        ],
      },
    ]
  },
}

module.exports = nextConfig
```

and this is the error i get
cors error

Body:
I have made a nextjs app and i cant use it's API's properly, requests to API routes only success if i send requests to from http://localhost:3000/, i want to be able to access them from anywhere

I tried allowing all origins from next.js configs file but i didn't help

// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  async headers() {
    return [
      {
        // matching all API routes
        source: "/api/(.*)",
        headers: [
          { key: "Access-Control-Allow-Credentials", value: "true" },
          { key: "Access-Control-Allow-Origin", value: "*" },
          {
            key: "Access-Control-Allow-Methods",
            value: "GET,OPTIONS,PATCH,DELETE,POST,PUT",
          },
          {
            key: "Access-Control-Allow-Headers",
            value: "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
          },
        ],
      },
    ]
  },
}

module.exports = nextConfig

and this is the error i get
cors error


问:
I'm unable to find my output on browser while deployed on Kubernetes
The Docker file :

```<code>FROM ubuntu
RUN apt update
RUN apt install python3-pip -y
RUN pip3 install Flask
COPY requirements.txt requirements.txt
ENV LISTEN_PORT=5999
EXPOSE 5999
RUN pip3 install -r requirements.txt
WORKDIR C:\Users\heman\PycharmProjects\dock_test\main.py
COPY . .
ENV FLASK_APP=main.py
CMD ["python3","-m", "flask", "run","--host=0.0.0.0", "--port=5999"]
</code>```

app.py

```<code>    from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "running"

if __name__ == "__main__":

    app.run(debug=True,port=5999)
</code>```

step - 1:
build -t dock_test .

step - 2:
docker run  -p 5999:5999 dock_test

it created the docker image on docker desktop and it is working perfectly fine

step - 3: To deploy through I've created Deployment.yaml, Service.yaml and Ingress.yaml files

```<code>    apiVersion: apps/v1
kind: Deployment
metadata:
  name: flask-app-second
spec:
  replicas: 5
  selector:
    matchLabels:
      app: flask-app-second
  template:
    metadata:
      labels:
        app: flask-app-second
    spec:
      containers:
        - name: flask-app-container-second
          image: kube
          imagePullPolicy: Never
          ports:
            - containerPort: 5999
              protocol: TCP
</code>```

later hit the command : kubectl apply -f Deployment.yaml

the output is like : deployment.apps/flask-app-second created

```<code>apiVersion: v1
kind: Service
metadata:
  name: flask-app-service-second
spec:
  type: ClusterIP
  ports:
    - port: 5999
  selector:
    app: flask-app-second
</code>```

and hit the command :  kubectl apply -f Service.yaml

the output is like : service/flask-app-service-second created

step - 4:

minikube dashboard (by hitting this command all the nodes and services are working by glowing green)

minikube service flask-app-service-second (it gives an url like :

http://127.0.0.1:62253

after I followed the link it is showing this site can't be reached [1]: https://i.stack.imgur.com/EHW6O.png

can anyone help me out, please

Body:
The Docker file :

FROM ubuntu
RUN apt update
RUN apt install python3-pip -y
RUN pip3 install Flask
COPY requirements.txt requirements.txt
ENV LISTEN_PORT=5999
EXPOSE 5999
RUN pip3 install -r requirements.txt
WORKDIR C:\Users\heman\PycharmProjects\dock_test\main.py
COPY . .
ENV FLASK_APP=main.py
CMD ["python3","-m", "flask", "run","--host=0.0.0.0", "--port=5999"]

app.py

    from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "running"

if __name__ == "__main__":

    app.run(debug=True,port=5999)

step - 1:
build -t dock_test .

step - 2:
docker run  -p 5999:5999 dock_test

it created the docker image on docker desktop and it is working perfectly fine

step - 3: To deploy through I've created Deployment.yaml, Service.yaml and Ingress.yaml files

    apiVersion: apps/v1
kind: Deployment
metadata:
  name: flask-app-second
spec:
  replicas: 5
  selector:
    matchLabels:
      app: flask-app-second
  template:
    metadata:
      labels:
        app: flask-app-second
    spec:
      containers:
        - name: flask-app-container-second
          image: kube
          imagePullPolicy: Never
          ports:
            - containerPort: 5999
              protocol: TCP

later hit the command : kubectl apply -f Deployment.yaml

the output is like : deployment.apps/flask-app-second created

apiVersion: v1
kind: Service
metadata:
  name: flask-app-service-second
spec:
  type: ClusterIP
  ports:
    - port: 5999
  selector:
    app: flask-app-second

and hit the command :  kubectl apply -f Service.yaml

the output is like : service/flask-app-service-second created

step - 4:

minikube dashboard (by hitting this command all the nodes and services are working by glowing green)

minikube service flask-app-service-second (it gives an url like :

http://127.0.0.1:62253

after I followed the link it is showing this site can't be reached [1]: https://i.stack.imgur.com/EHW6O.png

can anyone help me out, please


问:
How can I fix this javalangNoSuchMethodError?
I am trying to reverse a singleLinked list for k number of times. This is the code. My main class is reverseupto and whenever I am trying to run it's throwing this below error .

Error:

```<code>Exception in thread "main" java.lang.NoSuchMethodError: takeyouforward.Solution.rotate(Ltakeyouforward/Node;I)Ltakeyouforward/Node;
        at takeyouforward.reverseupto.main(reverseupto.java:40)
</code>```

Code:

```<code>package takeyouforward;
import java.util.*;

class Node{
    Node next;
    int data;
    Node(int a){
        data=a;
        next=null;
    }
}

class reverseupto{
    static  Scanner sc = new Scanner(System.in);

    public static  Node inputList(int size){
        Node head, tail;
        int val;

        val=sc.nextInt();
        head= tail = new Node(val);

        size--;
        while(size -->0){
            val = sc.nextInt();
            tail.next = new Node(val);
            tail = tail.next;
        }
        return head;
    }

     public static void main(String args[]){
        int n = sc.nextInt();

      Node head = inputList(n);
      int k = sc.nextInt();

      printList(head);
      Solution sol= new Solution();
      head= sol.rotate(head, k);
      printList(head);
    }

    public static void printList(Node n){
        while(n!=null){
            System.out.print(n.data+"->");
            n=n.next;
        }
        System.out.println();
     }
}

class Solution{

    public  Node rotate(Node head, int k){
        for(int i=0;i<k;i++){
            Node curr= head;
            Node temp=head;
            Node Next = curr.next;
            while(temp.next!=null) temp=temp.next;

            temp.next=curr;
            curr.next=null;
            head= Next;

        }

        return head;
    }
}

</code>```

`

I am trying to reverse a singlyLinkedList for K number of times . I am expecting the reverse linkedlist for k number of times but this is actually throwing me java.lang.NoSuchMethodError

Body:
I am trying to reverse a singleLinked list for k number of times. This is the code. My main class is reverseupto and whenever I am trying to run it's throwing this below error .

Error:

Exception in thread "main" java.lang.NoSuchMethodError: takeyouforward.Solution.rotate(Ltakeyouforward/Node;I)Ltakeyouforward/Node;
        at takeyouforward.reverseupto.main(reverseupto.java:40)

Code:

package takeyouforward;
import java.util.*;

class Node{
    Node next;
    int data;
    Node(int a){
        data=a;
        next=null;
    }
}

class reverseupto{
    static  Scanner sc = new Scanner(System.in);

    public static  Node inputList(int size){
        Node head, tail;
        int val;

        val=sc.nextInt();
        head= tail = new Node(val);

        size--;
        while(size -->0){
            val = sc.nextInt();
            tail.next = new Node(val);
            tail = tail.next;
        }
        return head;
    }

     public static void main(String args[]){
        int n = sc.nextInt();

      Node head = inputList(n);
      int k = sc.nextInt();

      printList(head);
      Solution sol= new Solution();
      head= sol.rotate(head, k);
      printList(head);
    }

    public static void printList(Node n){
        while(n!=null){
            System.out.print(n.data+"->");
            n=n.next;
        }
        System.out.println();
     }
}

class Solution{

    public  Node rotate(Node head, int k){
        for(int i=0;i<k;i++){
            Node curr= head;
            Node temp=head;
            Node Next = curr.next;
            while(temp.next!=null) temp=temp.next;

            temp.next=curr;
            curr.next=null;
            head= Next;

        }

        return head;
    }
}

`

I am trying to reverse a singlyLinkedList for K number of times . I am expecting the reverse linkedlist for k number of times but this is actually throwing me java.lang.NoSuchMethodError


问:
Easysnmp installation failed using pip in mac
I'm trying to pip install easysnmp. I've already installed net-snmp and gcc with its latest version. I'm getting the following error.

```<code>      error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: build/lib.macosx-13-arm64-cpython-310/easysnmp/interface.cpython-310-darwin.so (No such file or directory)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/hz/w1sgkjbx5mdbwwmkrghb2j3m0000gn/T/pip-install-r3syy2lu/easysnmp_7cd15fcc88384ce19ce8588bd0e6c2b3/setup.py", line 179, in <module>
          linked, target_lib, b.build_platlib, ext),
      NameError: name 'target_lib' is not defined. Did you mean: 'target_libs'?
</code>```

I'm using macos ventura on m1 if it matters.

Body:
I'm trying to pip install easysnmp. I've already installed net-snmp and gcc with its latest version. I'm getting the following error.

      error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: build/lib.macosx-13-arm64-cpython-310/easysnmp/interface.cpython-310-darwin.so (No such file or directory)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/hz/w1sgkjbx5mdbwwmkrghb2j3m0000gn/T/pip-install-r3syy2lu/easysnmp_7cd15fcc88384ce19ce8588bd0e6c2b3/setup.py", line 179, in <module>
          linked, target_lib, b.build_platlib, ext),
      NameError: name 'target_lib' is not defined. Did you mean: 'target_libs'?

I'm using macos ventura on m1 if it matters.


问:
Connecting to Wifi Printer with Xamarin Form
(Sorry for my English, I'm using a translator)
I made an application using Xamarin, in the settings of the phone "Printing Tools" there is my application and my printer, but when I want to print something using it, nothing happens.

Adding a Printer:

```<code>public override void OnStartPrinterDiscovery(IList<PrinterId> priorityList)
        {
            PrinterId id = printService.GeneratePriвnterId(Id);
            PrinterInfo.Builder builder =
                    new PrinterInfo.Builder(id, "TSC TTP-225", PrinterStatus.Idle);
            PrinterInfo info = builder.Build();
            List<PrinterInfo> infos = new List<PrinterInfo>
            {
                info
            };
            AddPrinters(infos);
        }
</code>```

When I click the "Print" button in the "Preview" window, this procedure is processed:

```<code>        protected override void OnPrintJobQueued(Android.PrintServices.PrintJob printJob)
        {
            printJob.Start();
            printJob.Complete();
        }
</code>```

Body:
(Sorry for my English, I'm using a translator)
I made an application using Xamarin, in the settings of the phone "Printing Tools" there is my application and my printer, but when I want to print something using it, nothing happens.

Adding a Printer:

public override void OnStartPrinterDiscovery(IList<PrinterId> priorityList)
        {
            PrinterId id = printService.GeneratePriвnterId(Id);
            PrinterInfo.Builder builder =
                    new PrinterInfo.Builder(id, "TSC TTP-225", PrinterStatus.Idle);
            PrinterInfo info = builder.Build();
            List<PrinterInfo> infos = new List<PrinterInfo>
            {
                info
            };
            AddPrinters(infos);
        }

When I click the "Print" button in the "Preview" window, this procedure is processed:

        protected override void OnPrintJobQueued(Android.PrintServices.PrintJob printJob)
        {
            printJob.Start();
            printJob.Complete();
        }


问:
How does BLoC listen to streaming data from Firestore in Flutter?
How does a BLoC listen to streaming data from Firestore and emit new state as the protocol keeps changing?</p>
```<code>Stream<List<UserModel>> getUserList() {
    return _fireStoreDataBase.collection('user')
        .snapshots()
        .map((snapShot) => snapShot.documents
        .map((document) => UserModel.fromJson(document.data))
        .toList());
  }
</code>```

Body:
How does a BLoC listen to streaming data from Firestore and emit new state as the protocol keeps changing?

Stream<List<UserModel>> getUserList() {
    return _fireStoreDataBase.collection('user')
        .snapshots()
        .map((snapShot) => snapShot.documents
        .map((document) => UserModel.fromJson(document.data))
        .toList());
  }


问:
How to add multiple identifierURIs from Powershell
I'm trying to add multiple identifierURIs from Powershell.

Normally I use this command to add single identifierURI:

```<code>Set-AzureADApplication -DisplayName "My App" -IdentifierURIs "api://$appId"
</code>```

What more to include in that command to add multiple identifierURIs from Powershell?

Body:
I'm trying to add multiple identifierURIs from Powershell.

Normally I use this command to add single identifierURI:

Set-AzureADApplication -DisplayName "My App" -IdentifierURIs "api://$appId"

What more to include in that command to add multiple identifierURIs from Powershell?


问:
How to send and receive JSON data from websockets client in python?
I am not Python developer but I am trying to get streaming data from broker. For that I am using Python's websockets library.
I want to send the data in JSON format as below

```<code>data = {
    "request":{
        "streaming_type":"quote",
        "data": {
            "symbols":[
                {
                    "symbol":"532826_BSE"
                }
            ]
        },
        "request_type":"subscribe",
        "response_format":"json"
    }
}
</code>```

I have written Websocket client Python script as below

```<code>#!/usr/bin/env python

import asyncio

import websockets

import logging

import json

async def getData():

    headers = {'x-session-token':'3f7dd35e126bc06bfc5e1fcfd52a6b46'}
    uri = "wss://stream.stocknote.com"

    logging.basicConfig(
        format="%(message)s",
        level=logging.DEBUG,
    )
    async with websockets.connect(uri, extra_headers=headers) as websocket:
        try:
            print("client is connected")

            data = {
                "request":{
                    "streaming_type":"quote",
                    "data": {
                        "symbols":[
                            {
                                "symbol":"532826_BSE"
                            }
                        ]
                    },
                    "request_type":"subscribe",
                    "response_format":"json"
                }
            }

            await websocket.send(json.dumps(data))

            response = await websocket.recv()

            print(f"<<< {json.parse(response)}")
        except websockets.ConnectionClosed:
            print ("web socket connection closed")

if __name__ == "__main__":
    asyncio.run(getData())
</code>```

When I run this script, it can

Connect to server

send and receive ping-pong data

but it is not receiving the data from broker.

JSON data is expected to be received from broker with below sample format.

```<code>{
  "aPr": "44561.00",
  "bPr": "44554.00",
  "aSz": "1",
  "bSz": "1",
  "sym": "2885_NSE",
  "avgPr": "44371.85",
  "c": "44119.00",
  "h": "44786.00",
  "l": "43969.00",
  "o": "44105.00",
  "oI": "361290",
  "oIChg": "22350.00",
  "ch": "435.00",
  "chPer": "0.99",
  "lTrdT": "01 Oct 2019, 06:47:03 PM",
  "ltp": "44554.00",
  "ltq": "1",
  "ltt": "01 Oct 2019, 06:47:03 PM",
  "lttUTC": "01 Oct 2019, 01:17:03 PM",
  "tBQ": "973",
  "tSQ": "610",
  "ttv": "782763833.41",
  "vol": "782763833.41",
  "yH": "44786.00",
  "yL": "0.00",
  "streaming_type": "quote"
}
</code>```

My question is :
How to send and receive data in JSON format using websockets library ?

Also when I terminate the script, I am getting message (showing there is some error/ warnings in source code) as below, what does it mean?

Body:
I am not Python developer but I am trying to get streaming data from broker. For that I am using Python's websockets library.
I want to send the data in JSON format as below

data = {
    "request":{
        "streaming_type":"quote",
        "data": {
            "symbols":[
                {
                    "symbol":"532826_BSE"
                }
            ]
        },
        "request_type":"subscribe",
        "response_format":"json"
    }
}

I have written Websocket client Python script as below

#!/usr/bin/env python

import asyncio

import websockets

import logging

import json

async def getData():

    headers = {'x-session-token':'3f7dd35e126bc06bfc5e1fcfd52a6b46'}
    uri = "wss://stream.stocknote.com"

    logging.basicConfig(
        format="%(message)s",
        level=logging.DEBUG,
    )
    async with websockets.connect(uri, extra_headers=headers) as websocket:
        try:
            print("client is connected")

            data = {
                "request":{
                    "streaming_type":"quote",
                    "data": {
                        "symbols":[
                            {
                                "symbol":"532826_BSE"
                            }
                        ]
                    },
                    "request_type":"subscribe",
                    "response_format":"json"
                }
            }

            await websocket.send(json.dumps(data))

            response = await websocket.recv()

            print(f"<<< {json.parse(response)}")
        except websockets.ConnectionClosed:
            print ("web socket connection closed")

if __name__ == "__main__":
    asyncio.run(getData())

When I run this script, it can

Connect to server

send and receive ping-pong data

but it is not receiving the data from broker.

JSON data is expected to be received from broker with below sample format.

{
  "aPr": "44561.00",
  "bPr": "44554.00",
  "aSz": "1",
  "bSz": "1",
  "sym": "2885_NSE",
  "avgPr": "44371.85",
  "c": "44119.00",
  "h": "44786.00",
  "l": "43969.00",
  "o": "44105.00",
  "oI": "361290",
  "oIChg": "22350.00",
  "ch": "435.00",
  "chPer": "0.99",
  "lTrdT": "01 Oct 2019, 06:47:03 PM",
  "ltp": "44554.00",
  "ltq": "1",
  "ltt": "01 Oct 2019, 06:47:03 PM",
  "lttUTC": "01 Oct 2019, 01:17:03 PM",
  "tBQ": "973",
  "tSQ": "610",
  "ttv": "782763833.41",
  "vol": "782763833.41",
  "yH": "44786.00",
  "yL": "0.00",
  "streaming_type": "quote"
}

My question is :
How to send and receive data in JSON format using websockets library ?

Also when I terminate the script, I am getting message (showing there is some error/ warnings in source code) as below, what does it mean?


问:
How to get an event series upcoming date with Google Apps Script?
[Goal]

I'm trying to figure out a way to retrieve the upcoming date of an existing event series that the attendees are required to join. For context, the event was created by another user, however, I am part of the event as well (if that matters).

With this date, I want to be able to use it for something else, to which it would be referring to the upcoming event (series).

[Issue]

I tried using the getEventSeriesById method as I was able to find the event ID by using the below code, however, there doesn't seems to be an option to retrieve dates or time from that object.

Utilities.newBlob(Utilities.base64Decode("long string")).getDataAsString();```

I also tried using the getEvents method, but it doesn't seem possible to get information about an event that is a series.

[Question]

Would there be some kind of workaround or am I completely missing the point on how to utilize the CalendarApp?

Thank you in advance.

Body:
[Goal]

I'm trying to figure out a way to retrieve the upcoming date of an existing event series that the attendees are required to join. For context, the event was created by another user, however, I am part of the event as well (if that matters).

With this date, I want to be able to use it for something else, to which it would be referring to the upcoming event (series).

[Issue]

I tried using the getEventSeriesById method as I was able to find the event ID by using the below code, however, there doesn't seems to be an option to retrieve dates or time from that object.

Utilities.newBlob(Utilities.base64Decode("long string")).getDataAsString();

I also tried using the getEvents method, but it doesn't seem possible to get information about an event that is a series.

[Question]

Would there be some kind of workaround or am I completely missing the point on how to utilize the CalendarApp?

Thank you in advance.


问:
In saleor storefront , input type checkbox not showing
In saleor storefront, If I set input type checkbox,it's now showing but it wokrs for input type radio.

I tried to show input type checkbox in front end but it's showing nothing.


问:
How to Populate the first column with the selected value from the combobox in C#?
whoever reading this, I had a question, I want to populate first column with selected combobox by user, I already writing a code

```<code>public DataSet RowEnumerator
    {
        get
        {
            frmMain mainForm = new frmMain();
            // Define the "sender" and "e" variables
            object sender = new object();
            EventArgs e = new EventArgs();

            // Call the "comboBox1_SelectedIndexChanged" method
            mainForm.comboBox1_SelectedIndexChanged(sender, e);
            string nama = items2.Nama;

            //string nama = mainForm.comboBox1_SelectedIndexChanged;

            string emptyColumn1 = "column1";
            string emptyColumn2 = "column2";

            if (null == __reader)
                throw new System.ApplicationException("I can't start reading without CSV input.");

            DataSet ds = new DataSet();
            DataTable dt = ds.Tables.Add("TheData");

            int __rowno = 0;
            string sLine;
            string sNextLine;

            while (null != (sLine = __reader.ReadLine()))
            {
                while (rexRunOnLine.IsMatch(sLine) && null != (sNextLine = __reader.ReadLine()))
                {
                    sLine += "\n" + sNextLine;
                }

                __rowno++;
                DataRow dr = dt.NewRow();
                string[] values = rexCsvSplitter.Split(sLine);
                values = new string[] { emptyColumn1, emptyColumn2 }.Concat(values).ToArray();

                for (int i = 0; i < values.Length; i++)
                {
                    values[i] = Csv.Unescape(values[i]);
                    if (__rowno == 1)
                    {
                        dt.Columns.Add(values[i].Trim());
                    }
                    else
                    {
                        if (Csv.CharNotAllowes(values[i]))
                        {
                            dr[i] = values[i].Trim();
                        }

                    }
                }
                if (__rowno != 1)
                {
                    //nama = items2.Nama;
                    // Populate the first column with the selected value from the combobox
                    //dr[0] = items2.Nama;
                    //dr[1] = items2.Nama;

                    // Add the new row to the data table
                    dt.Rows.Add(dr);
                }

                values[1] = "";

                // transpose code
                StringBuilder sb = new StringBuilder();

                for (int u = 0; u < dt.Columns.Count; u++)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sb.Append(dt.Rows[i][u].ToString());

                        if (i < dt.Rows.Count - 1)
                        {
                            sb.Append(',');
                        }
                    }
                    sb.AppendLine();
                }

                File.WriteAllText("C:\\Users\\Desktop\\Output.csv", sb.ToString());
            }
            __reader.Close();
            return ds;
        }

    }
</code>```

also the combobox code

```<code>public void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

            items items2 = combobox1.SelectedItem as items;
            textbox.Text = Convert.ToString(items2.ID);

            string nama = items2.Nama;
        }
</code>```

but,it didn't show anything just the column name, How to fix this?

I want to column 1 and 2 had a data from combobox and textbox, combobox and textbox value is from list dictionary anyway and combobox and dataset is in different class

Body:
whoever reading this, I had a question, I want to populate first column with selected combobox by user, I already writing a code

public DataSet RowEnumerator
    {
        get
        {
            frmMain mainForm = new frmMain();
            // Define the "sender" and "e" variables
            object sender = new object();
            EventArgs e = new EventArgs();

            // Call the "comboBox1_SelectedIndexChanged" method
            mainForm.comboBox1_SelectedIndexChanged(sender, e);
            string nama = items2.Nama;

            //string nama = mainForm.comboBox1_SelectedIndexChanged;

            string emptyColumn1 = "column1";
            string emptyColumn2 = "column2";

            if (null == __reader)
                throw new System.ApplicationException("I can't start reading without CSV input.");

            DataSet ds = new DataSet();
            DataTable dt = ds.Tables.Add("TheData");

            int __rowno = 0;
            string sLine;
            string sNextLine;

            while (null != (sLine = __reader.ReadLine()))
            {
                while (rexRunOnLine.IsMatch(sLine) && null != (sNextLine = __reader.ReadLine()))
                {
                    sLine += "\n" + sNextLine;
                }

                __rowno++;
                DataRow dr = dt.NewRow();
                string[] values = rexCsvSplitter.Split(sLine);
                values = new string[] { emptyColumn1, emptyColumn2 }.Concat(values).ToArray();

                for (int i = 0; i < values.Length; i++)
                {
                    values[i] = Csv.Unescape(values[i]);
                    if (__rowno == 1)
                    {
                        dt.Columns.Add(values[i].Trim());
                    }
                    else
                    {
                        if (Csv.CharNotAllowes(values[i]))
                        {
                            dr[i] = values[i].Trim();
                        }

                    }
                }
                if (__rowno != 1)
                {
                    //nama = items2.Nama;
                    // Populate the first column with the selected value from the combobox
                    //dr[0] = items2.Nama;
                    //dr[1] = items2.Nama;

                    // Add the new row to the data table
                    dt.Rows.Add(dr);
                }

                values[1] = "";

                // transpose code
                StringBuilder sb = new StringBuilder();

                for (int u = 0; u < dt.Columns.Count; u++)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sb.Append(dt.Rows[i][u].ToString());

                        if (i < dt.Rows.Count - 1)
                        {
                            sb.Append(',');
                        }
                    }
                    sb.AppendLine();
                }

                File.WriteAllText("C:\\Users\\Desktop\\Output.csv", sb.ToString());
            }
            __reader.Close();
            return ds;
        }

    }

also the combobox code

public void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

            items items2 = combobox1.SelectedItem as items;
            textbox.Text = Convert.ToString(items2.ID);

            string nama = items2.Nama;
        }

but,it didn't show anything just the column name, How to fix this?

I want to column 1 and 2 had a data from combobox and textbox, combobox and textbox value is from list dictionary anyway and combobox and dataset is in different class


问:
Why is GraphQL returning an empty array from MongoDB Atlas?
I'm trying to get my head round GraphQL and am looking to connect to a MongoDB collection called 'users'. Obviously I'm getting something fundamentally wrong but I can't spot it. In the Apollo Sandbox I'm just getting an empty array returned and logging return values in the user-api and resolvers shows nothing. I'm guessing there is something wrong with the way I've done async/await as I'm not too experienced with promises and such like.

index.js (I've removed my username/password from the connection string)

```<code>import resolvers from './resolvers.js';
import typeDefs from './schema.js';
import User from './datasources/user-api.js';

const client = new MongoClient(
  'mongodb+srv://<myusername>:<mypassword>@cluster0.ruaf8.mongodb.net/?retryWrites=true&w=majority'
);

client
  .connect()
  .then(() => {
    console.log('MongDB connected');
    return server.listen({ port: 4000 });
  })
  .then((res) => {
    console.log(`Server running at ${res.url}`);
  });

const server = new ApolloServer({
  typeDefs,
  resolvers,
  dataSources: () => ({
    users: new User(client.db().collection('users')),
  }),
});
</code>```

schema.js

```<code>import { gql } from 'apollo-server';

const typeDefs = gql`
  type User {
    id: ID!
    username: String!
    email: String!
    password: String!
    token: String!
  }

  type Query {
    getUsers: [User]
  }

`;

export default typeDefs;
</code>```

user-api.js

```<code>import { MongoDataSource } from 'apollo-datasource-mongodb';

const MINUTE = 60;

export default class User extends MongoDataSource {

  async getUsers() {
    const users = await this.findByFields({}, { ttl: MINUTE });
    console.log(`user-api: ${users}`);
    return users;
  }
}
</code>```

resolvers.js

```<code>const resolvers = {
  Query: {
    getUsers: async (_, __, { dataSources: { users } }) => {
      const userList = await users.getUsers();
      console.log(`resolver: ${userList}`);
      return userList;
    },
  },
};

export default resolvers;
</code>```

Body:
I'm trying to get my head round GraphQL and am looking to connect to a MongoDB collection called 'users'. Obviously I'm getting something fundamentally wrong but I can't spot it. In the Apollo Sandbox I'm just getting an empty array returned and logging return values in the user-api and resolvers shows nothing. I'm guessing there is something wrong with the way I've done async/await as I'm not too experienced with promises and such like.

index.js (I've removed my username/password from the connection string)

import resolvers from './resolvers.js';
import typeDefs from './schema.js';
import User from './datasources/user-api.js';

const client = new MongoClient(
  'mongodb+srv://<myusername>:<mypassword>@cluster0.ruaf8.mongodb.net/?retryWrites=true&w=majority'
);

client
  .connect()
  .then(() => {
    console.log('MongDB connected');
    return server.listen({ port: 4000 });
  })
  .then((res) => {
    console.log(`Server running at ${res.url}`);
  });

const server = new ApolloServer({
  typeDefs,
  resolvers,
  dataSources: () => ({
    users: new User(client.db().collection('users')),
  }),
});

schema.js

import { gql } from 'apollo-server';

const typeDefs = gql`
  type User {
    id: ID!
    username: String!
    email: String!
    password: String!
    token: String!
  }

  type Query {
    getUsers: [User]
  }

`;

export default typeDefs;

user-api.js

import { MongoDataSource } from 'apollo-datasource-mongodb';

const MINUTE = 60;

export default class User extends MongoDataSource {

  async getUsers() {
    const users = await this.findByFields({}, { ttl: MINUTE });
    console.log(`user-api: ${users}`);
    return users;
  }
}

resolvers.js

const resolvers = {
  Query: {
    getUsers: async (_, __, { dataSources: { users } }) => {
      const userList = await users.getUsers();
      console.log(`resolver: ${userList}`);
      return userList;
    },
  },
};

export default resolvers;


问:
Ship google cloud logs with only jsonPayload part without jsonPayload field name
We are using the logstash encoder with logback to write our logs in a json format. These json logs appear under the jsonPayload field in google cloud logging. We have routed these logs using a pubsub sink and then to elasticsearch using a dataflow job. Everything is smooth, the logs are seen on Kibana with all the fields separated from the json payload. The only issue is that we see the jsonPayload prefix for all of our logging fields, for example jsonPayload.app.name. Now, the issue is that we are using Spring Data to read these logs from ES and can't change the index fields names because the same data layer reads from non-gcp deployments and the ELK setup in those environments creates fields names like app.name.

Is there a way to just ship the jsonPayload from cloud logging, perhaps using the inclusion filter or a schema on pubsub topic?


问:
How to rescale the coordinates processed by YoloV5 TensorFlow Lite model in Android Java?
I'm new to android and machine learning. I'm developing an android application, in which I have passed an image in buffer format to the machine learning TensorFlow lite model which will look at the interested region of the image, the model processed the image but the model is sending back scaled coordinates in float format. The model is generating the coordinates using the yoloV5 tf-lite model. I want to convert those coordinates in the original X, Y, width, and height format. I want to crop the image by those coordinates. How can I rescale those float coordinates in the original format?</p>


问:
Access to second RTDB in different region
I have issues with access to second RTDB instanace i added to my project.

Default instance is in us-central1

Second instance is in asia-southeast1

My flutter app works fine with USA rtdb. However, App is not able to access second db where rules require auth != null. I removed auth check in rules and it was able to read/write second instance. Access to first default instance works as intended with auth check in rules.

Please help. I want to keep rtdb in multiple regions.

I have downloaded google-serices.json and recomipled app to test but that didn't help.


问:
Axios not sending cookie to Express server only in production
I have a React frontend speaking to a Node/Express backend, including some protected routes which require the cookie to be sent in the request headers. I have withCredentials: true set on my Axios requests as well as app.use(cors({ credentials: true, origin: true })); on my server.

The setup works just fine on my machine, but once deployed to Render.com it is not sending the token cookie when making requests :(

Any advice would be greatly appreciated.

Many thanks,
Dave


问:
Make an registry file which contains multiple cascade context (sub) menu
Up front, i am not a good programmer, just a novice / beginner:

The following script has 2 levels of context menu (see screenshot)
What i am trying to do is 1 level more from within (like in the screenshot) remote control sub menu. So another sub menu IN the remote control sub menu

```<code>[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl]
"Icon"="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"
"MUIVerb"="Remote Control"
"Position"="Top"
"SubCommands"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu]
"MUIVerb"="TightVNC Viewer"
"Icon"="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu\command]
@="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\02menu]
"MUIVerb"="VCN Viewer"
"Icon"="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\02menu\command]
@="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"
</code>```

I've added this:

```<code>[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu]
"MUIVerb"="TightVNC Viewer"
"Icon"="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"
"SubCommands"=""
</code>```

and it DID added a submenu, but without content, i've tried many ways, but the new content is not showing. (this example is not complete)

Body:
Up front, i am not a good programmer, just a novice / beginner:

The following script has 2 levels of context menu (see screenshot)
What i am trying to do is 1 level more from within (like in the screenshot) remote control sub menu. So another sub menu IN the remote control sub menu

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl]
"Icon"="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"
"MUIVerb"="Remote Control"
"Position"="Top"
"SubCommands"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu]
"MUIVerb"="TightVNC Viewer"
"Icon"="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu\command]
@="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\02menu]
"MUIVerb"="VCN Viewer"
"Icon"="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\02menu\command]
@="D:\\Mijn Data\\Portables\\VNC Viewer\\vncviewer.exe"

I've added this:

[HKEY_CLASSES_ROOT\Directory\Background\shell\RemoteControl\Shell\01menu]
"MUIVerb"="TightVNC Viewer"
"Icon"="D:\\Mijn Data\\Portables\\TightVNCViewer\\TightVNCViewerPortable.exe"
"SubCommands"=""

and it DID added a submenu, but without content, i've tried many ways, but the new content is not showing. (this example is not complete)


问:
What makes NebulaGraph a Graph Database?
NebulaGraph leveraged RocksDB, why do we consider it as a Graph Database instead of a multiple model one?

From my understanding, it's related to how we defined the storage KV structure and storage API, while I am not quite sure about this and would like to hear more from the community :)


问:
Spring JDBC batchUpdate - Batch Insert on Postgres yields DeadlockLoserDataAccessException
On Postgres: 9.2, Springboot: 2.4.6.RELEASE

Here's my table structure (4 columns):

```<code>TransactionID (primaryKey) | Amount  | Tax | TaxPayerID
</code>```

TaxPayerID is indexed column using a postgres btree index for faster queries.

I get a batch of messages from a queue and they are consumed by a spring listener.

The listener calls a service to process and batch insert the records.

Every batch received by the listener always have unique records (in terms of the primary key, but TaxPayerID can be repeated). But there are multiple threads consuming and inserting into the db in batch.

My listener looks like this:

```<code>@SqsListener("\${dataload.event.queue}")
    fun onDataLoadEvent(raw: String) {
        val jacksonObjectMapper = jacksonObjectMapper()
        val payload = jacksonObjectMapper.readValue(raw, Map::class.java)["payload"]
        val event = jacksonObjectMapper.readValue(payload.toString(), DataLoadEvent::class.java)
        dataLoadService.loadData(event)
    }
</code>```

My service looks like this:

```<code>    @Transactional
    override fun loadData(dataLoadEvent: DataLoadEvent) {
            dataLoadRepository.loadData(dataLoadEvent)
    }
</code>```

My repository looks like this:

```<code>fun loadData(event: DataLoadEvent) {
    // Omitting many stuff for brevity.
    jdbcTemplate.batchUpdate(sql, ....)
}
</code>```

My question is, why does the DB think it's a deadlock even when the inserted batch every concurrent thread has unique records (different primary keys)? There's nothing common (in terms of the id of the rows) across the sessions. However, if I remove the index on the TaxPayerID column, there is no deadlock.

I'm hearing the common solution is to employ a retry strategy. I could do that, but want to understand why this happens and is retry the only solution and it's possible caveats and downsides (perhaps, reduced throughput etc?)

Body:
On Postgres: 9.2, Springboot: 2.4.6.RELEASE

Here's my table structure (4 columns):

TransactionID (primaryKey) | Amount  | Tax | TaxPayerID

TaxPayerID is indexed column using a postgres btree index for faster queries.

I get a batch of messages from a queue and they are consumed by a spring listener.

The listener calls a service to process and batch insert the records.

Every batch received by the listener always have unique records (in terms of the primary key, but TaxPayerID can be repeated). But there are multiple threads consuming and inserting into the db in batch.

My listener looks like this:

@SqsListener("\${dataload.event.queue}")
    fun onDataLoadEvent(raw: String) {
        val jacksonObjectMapper = jacksonObjectMapper()
        val payload = jacksonObjectMapper.readValue(raw, Map::class.java)["payload"]
        val event = jacksonObjectMapper.readValue(payload.toString(), DataLoadEvent::class.java)
        dataLoadService.loadData(event)
    }

My service looks like this:

    @Transactional
    override fun loadData(dataLoadEvent: DataLoadEvent) {
            dataLoadRepository.loadData(dataLoadEvent)
    }

My repository looks like this:

fun loadData(event: DataLoadEvent) {
    // Omitting many stuff for brevity.
    jdbcTemplate.batchUpdate(sql, ....)
}

My question is, why does the DB think it's a deadlock even when the inserted batch every concurrent thread has unique records (different primary keys)? There's nothing common (in terms of the id of the rows) across the sessions. However, if I remove the index on the TaxPayerID column, there is no deadlock.

I'm hearing the common solution is to employ a retry strategy. I could do that, but want to understand why this happens and is retry the only solution and it's possible caveats and downsides (perhaps, reduced throughput etc?)


问:
Performance of Shared Memory I/O frrom diffrenet CPU cores
While optimizing a server(Running CentOS7) I a noticed performance diffrence realted to reading and writing shared memory region.
The system is running two processes, each process has a dedicated thread to read or write the shared memory(1 producer 1 consumer).

If both threads have the CPU affinity, the performance is much better.

If the threads are on separate cores, the CPU utilization is higher and there is less throughput.

I assume it happens due to one or both of the following reasons:

No synchronization needed when the threads are running on the same CPU. I didn't find any documentation that linux detects such a situation and stops the synchronization.

Memory access is more efficient as the data is stored in L1 and L2 caches, and when the threads are on separate cores the data is probably stored in L3 line which is the shared cache line.

The performance difference is due to one of my assumptions? or can someone think of another reason?

Tried to research the topic in google but didn't come to a conclusion.


问:
itext 7 multiple page pdf generation
I am new to iText7 can someone help me in generating multiple page pdf with huge html string content.

Here is the code where i just converted html string to pdf using itext 7, can someone help me in modifying this code

```<code>
@Service
public class ITextServiceImpl implements iTextService{

    private static final Logger logger = LoggerFactory.getLogger(ITextServiceImpl.class);

    @Override
    public Object downloadItextPDF(String htmlContent, String dest,int pdfPageWidth, int pdfPageHeight,int pdfCardsLength,String dashboardtitle) throws IOException  {
        logger.info("PDF Downloading.........");

//        itext code
        HtmlConverter.convertToPdf(htmlContent, new FileOutputStream(dest));
        System.out.println(htmlContent);

        logger.info(" PDF Created!");
        return true;
    }
}

</code>```

iText does not show my html string content on the next page I want a multiple page pdf in which my html string content is continuous on the next pdf page after a page break

here is the output I am getting for html string to pdf using itext7

Thanks

Title: itext 7 multiple page pdf generation

Body:
I am new to iText7 can someone help me in generating multiple page pdf with huge html string content.

Here is the code where i just converted html string to pdf using itext 7, can someone help me in modifying this code

@Service
public class ITextServiceImpl implements iTextService{

    private static final Logger logger = LoggerFactory.getLogger(ITextServiceImpl.class);

    @Override
    public Object downloadItextPDF(String htmlContent, String dest,int pdfPageWidth, int pdfPageHeight,int pdfCardsLength,String dashboardtitle) throws IOException  {
        logger.info("PDF Downloading.........");

//        itext code
        HtmlConverter.convertToPdf(htmlContent, new FileOutputStream(dest));
        System.out.println(htmlContent);

        logger.info(" PDF Created!");
        return true;
    }
}

iText does not show my html string content on the next page I want a multiple page pdf in which my html string content is continuous on the next pdf page after a page break

here is the output I am getting for html string to pdf using itext7

Thanks


问:
Android HCE service not triggering anymore after Android Update (Realme GT2 PRO)
I'm developing a HCE application using two smartphones (OnePlus 6 - Android 11 and Realme GT2 Pro - Android 13).
The HCE APDU service worked on both devices until I updated my Realme GT2 PRO to rmx3301_11_c.12.
The Realme was already running Android 13 before this official update.
The update is performed using the standard updating routine of Realme, keeping all your apps and data in place.
Since the update the HCE service is not invoked anymore on the Realme.
However, it still works on the OnePlus.

I tried the following without any success:

changed application id

queried CardEmulation.isDefaultServiceForAid for my AID: it returns true!

removed installed payment applications (however, my category is: 'other'; not payment. )

experimented with requireDeviceUnlock

apduservice.xml:

```<code><host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:description="@string/servicedesc"
    android:requireDeviceUnlock="false">

    <aid-group
        android:category="other"
        android:description="@string/aiddescription" >
        <aid-filter android:name="F4078D5A92B5B8" />
    </aid-group>

</host-apdu-service>
</code>```

Part of ApduService: init() is called when the reader sends a select APDU with the AID.
However, this does not happen anymore on the Realme, after the update.
Before the update, it worked well.

```<code>
class SecureScanApduService : HostApduService() {

    private var challengeSignature: ByteArray? = null
    private val hasCertificate: Boolean
    private val x509: X509Certificate?

    private var securecontainerhash: ByteArray? = null
    private var securecontainerpassword: ByteArray? = null

    init {
        val cm = CertificateManager()
        hasCertificate = cm.hasCertificate()
        x509 = if (hasCertificate) cm.getCertificate()!! else null
    }

    private fun isSelectApdu(apdu: ByteArray?): Boolean =
        apdu!!.size >= 2 && apdu[0] === 0.toByte() && apdu[1] === 0xa4.toByte()

</code>```

Manifest:

```<code>uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<service
    android:name=".SecureScanApduService"
    android:enabled="true"
    android:exported="true"
    android:permission="android.permission.BIND_NFC_SERVICE">
    <intent-filter>
        <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
    </intent-filter>

    <meta-data
        android:name="android.nfc.cardemulation.host_apdu_service"
        android:resource="@xml/apduservice" />
</service>
</code>```

Body:
I'm developing a HCE application using two smartphones (OnePlus 6 - Android 11 and Realme GT2 Pro - Android 13).
The HCE APDU service worked on both devices until I updated my Realme GT2 PRO to rmx3301_11_c.12.
The Realme was already running Android 13 before this official update.
The update is performed using the standard updating routine of Realme, keeping all your apps and data in place.
Since the update the HCE service is not invoked anymore on the Realme.
However, it still works on the OnePlus.

I tried the following without any success:

changed application id

queried CardEmulation.isDefaultServiceForAid for my AID: it returns true!

removed installed payment applications (however, my category is: 'other'; not payment. )

experimented with requireDeviceUnlock

apduservice.xml:

<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:description="@string/servicedesc"
    android:requireDeviceUnlock="false">

    <aid-group
        android:category="other"
        android:description="@string/aiddescription" >
        <aid-filter android:name="F4078D5A92B5B8" />
    </aid-group>

</host-apdu-service>

Part of ApduService: init() is called when the reader sends a select APDU with the AID.
However, this does not happen anymore on the Realme, after the update.
Before the update, it worked well.

class SecureScanApduService : HostApduService() {

    private var challengeSignature: ByteArray? = null
    private val hasCertificate: Boolean
    private val x509: X509Certificate?

    private var securecontainerhash: ByteArray? = null
    private var securecontainerpassword: ByteArray? = null

    init {
        val cm = CertificateManager()
        hasCertificate = cm.hasCertificate()
        x509 = if (hasCertificate) cm.getCertificate()!! else null
    }

    private fun isSelectApdu(apdu: ByteArray?): Boolean =
        apdu!!.size >= 2 && apdu[0] === 0.toByte() && apdu[1] === 0xa4.toByte()

Manifest:

uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<service
    android:name=".SecureScanApduService"
    android:enabled="true"
    android:exported="true"
    android:permission="android.permission.BIND_NFC_SERVICE">
    <intent-filter>
        <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
    </intent-filter>

    <meta-data
        android:name="android.nfc.cardemulation.host_apdu_service"
        android:resource="@xml/apduservice" />
</service>