问:
Modal content breaking page
I'm hoping someone may be able to help?
I'm using a regular bootstrap modal to show information but whenever there's too much information in the modal body it breaks the page.

```<code><div class="modal fade" id="modal1" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Hourly Jobs Information</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
 <h4><u>Hourly Contracts</u></h4>
          <p>We currently charge £25.00 per hour for jobs undertaken (with the first hour
            paid in full, regardless of completion time), then every hour entered into paid as a full hour.
            (e.g., If a shelf construction job takes 95 minutes, the team members time will be charged at
            £50.00.)</p>

            <p>However, if any hour (after the first hour) entered into does not go beyond the first half hour
            stage, a reduced fee of £15.00 will be charged for that shorter half hour.</p>

            <p>(e.g., If a painting job takes 75 minutes, the team members time will be charged at £40.00.)</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="button2" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
</code>```

The above absolutely fine, but any more content and it breaks the modal. This is the full content in the modal:

```<code><div class="modal fade" id="modal1" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Hourly Jobs Information</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
<h4><u>Hourly Contracts</u></h4>
      <p>We currently charge £25.00 per hour for jobs undertaken (with the first hour
        paid in full, regardless of completion time), then every hour entered into paid as a full hour.
        (e.g., If a shelf construction job takes 95 minutes, the team members time will be charged at
        £50.00.)</p>

        <p>However, if any hour (after the first hour) entered into does not go beyond the first half hour
        stage, a reduced fee of £15.00 will be charged for that shorter half hour.</p>

        <p>(e.g., If a painting job takes 75 minutes, the team members time will be charged at £40.00.)</p>

        <h4><u>Materials</u></h4>
        <p>If materials are required for a job in advance the client can choose to
        either purchase these in advance for the team member, or the team member can purchase the
        necessary materials. The team member will discuss materials required with the client and costs
        can be agreed before the job begins. However, the client will be charged a one-off fee of £15.00
        for the time it takes the team member to purchase, order, collect the materials on their behalf.</p>

        <h4><u>Payment</u></h4>
        <p>Once the job has been completed, payment for the work done will be made with the team
        member there and then. We accept cash and card payments (sorry, no cheques) and are happy
        to provide a receipt for works completed, both physically and/or by email.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="button2" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
</code>```

Would anyone have any idea why this might be happening? It's driving me bonkers!
Many thanks!

Edit:
Apologies, I should add that when visiting the page the rest of the menu system doesn't work until the modal is opened and closed.
Here's the page: http://fixnhelp.co.uk/dev/prices.html

Title: Modal content breaking page

Body:
I'm hoping someone may be able to help?
I'm using a regular bootstrap modal to show information but whenever there's too much information in the modal body it breaks the page.

Hourly Jobs Information

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

Hourly Contracts

We currently charge £25.00 per hour for jobs undertaken (with the first hour
            paid in full, regardless of completion time), then every hour entered into paid as a full hour.
            (e.g., If a shelf construction job takes 95 minutes, the team members time will be charged at
            £50.00.)

However, if any hour (after the first hour) entered into does not go beyond the first half hour
            stage, a reduced fee of £15.00 will be charged for that shorter half hour.

(e.g., If a painting job takes 75 minutes, the team members time will be charged at £40.00.)

        <button type="button" class="button2" data-dismiss="modal">Close</button>

The above absolutely fine, but any more content and it breaks the modal. This is the full content in the modal:

Hourly Jobs Information

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

Hourly Contracts

We currently charge £25.00 per hour for jobs undertaken (with the first hour
        paid in full, regardless of completion time), then every hour entered into paid as a full hour.
        (e.g., If a shelf construction job takes 95 minutes, the team members time will be charged at
        £50.00.)

However, if any hour (after the first hour) entered into does not go beyond the first half hour
        stage, a reduced fee of £15.00 will be charged for that shorter half hour.

(e.g., If a painting job takes 75 minutes, the team members time will be charged at £40.00.)

Materials

If materials are required for a job in advance the client can choose to
        either purchase these in advance for the team member, or the team member can purchase the
        necessary materials. The team member will discuss materials required with the client and costs
        can be agreed before the job begins. However, the client will be charged a one-off fee of £15.00
        for the time it takes the team member to purchase, order, collect the materials on their behalf.

Payment

Once the job has been completed, payment for the work done will be made with the team
        member there and then. We accept cash and card payments (sorry, no cheques) and are happy
        to provide a receipt for works completed, both physically and/or by email.

        <button type="button" class="button2" data-dismiss="modal">Close</button>

Would anyone have any idea why this might be happening? It's driving me bonkers!
Many thanks!

Edit:
Apologies, I should add that when visiting the page the rest of the menu system doesn't work until the modal is opened and closed.
Here's the page: http://fixnhelp.co.uk/dev/prices.html


来源: stackexchange

问:
Is the a way to schedule notebooks on JupyterHub
Hi Moved a lot of our local Jupyter notebooks to Jupyter hub but can't seem to find a way to schedule them to run.

Any advice will be appriciated

Can't find a way to run a scheduler on the hub

ContentLicense: CC BY-SA 4.0


问:
ReferenceError: Can't find variable: ResizeObserver on browsers that support ResizeObserver (Safari v15.6.1)
I'm seeing users get the error ReferenceError: Can't find variable: ResizeObserver even though the browser they are on (Safari v15.6.1, v16.1) are versions that are supposed to support ResizeObserver.

Anyone have an idea what could be causing this?

P.S. - I'm also using polyfill.io to load in a ResizeObserver polyfill for browsers that don't support it, but I guess it's not downloading a polyfill in these cases since these browsers versions supposedly support ResizeObserver

Thanks


问:
Does sukgu liberary support shadow-dom(user-agent)?
We have shadow dom elements of (user-agent) type. Need help on automating these elements.

Tried CSS selector for finding shadow dom elements but it didn't worked.


问:
How to use Single Page Application as Template in Multi-Tenant E-Commerce System?
I am developing a headless and multi-tenant e-commerce system with .NET Core. In this e-commerce system, I am using NextJS as the storefront. I want to create a multi-theme system in this e-commerce system. Each store owner should be able to select the theme they want from a management panel like WordPress. That is, instead of a single NextJS application, there should be multiple different NextJS applications and I should be able to select them from the management panel.

I thought of such a scenario: The themes are already added by us and each theme shows the data of the site it is running on by detecting the domain, so I can run them once and keep the application port in the database. This way, I can change the port of the selected theme from the administration panel on the file under the sites_enabled folder on my server.

But I don't know how to do this. Also, I'm not sure if this method is healthy. In your opinion, how can I do this? And if there are other solutions, I would like to learn about them. Thank you.

I tried using a nodejs project as a base and running other nextjs applications on a single port, but it lost performance.


问:
How can I turn off unnecessary command logs in Rails app?
I started to learn Ruby on Rails and I am facing a problem with command logs.

I am starting my server with Command Prompt.

My Ruby version is: 2.7

My Rails version is: 7.0

I want to turn off or hide unnecessary logs.

Logs example:

```<code>Post Load (0.5ms)  SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = $1 ORDER BY "posts"."created_at" DESC LIMIT $2  [["author_id", 3], ["LIMIT", 3]]

Could not log "sql.active_record" event. Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) [
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:96:in `sub'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:96:in `block in add_gem_filter'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:109:in `block (2 levels) in filter_backtrace'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `first'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `extract_query_source_location'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:136:in `log_query_source'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:131:in `debug'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:71:in `sql'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-
</code>```

I tried to find solution online, but I didn't find anything that will help me.

Body:
I started to learn Ruby on Rails and I am facing a problem with command logs.

I am starting my server with Command Prompt.

My Ruby version is: 2.7

My Rails version is: 7.0

I want to turn off or hide unnecessary logs.

Logs example:

Post Load (0.5ms)  SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = $1 ORDER BY "posts"."created_at" DESC LIMIT $2  [["author_id", 3], ["LIMIT", 3]]

Could not log "sql.active_record" event. Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) [
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:96:in `sub'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:96:in `block in add_gem_filter'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-7.0.4/lib/active_support/backtrace_cleaner.rb:109:in `block (2 levels) in filter_backtrace'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `each'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `first'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:144:in `extract_query_source_location'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:136:in `log_query_source'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:131:in `debug'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activerecord-7.0.4/lib/active_record/log_subscriber.rb:71:in `sql'",
  "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-

I tried to find solution online, but I didn't find anything that will help me.


问:
How to install Microsoft SQL server as userdata(powershell) on windows machine in AWS? or powershell error resolution for below
Its and windows machine and trying to install Sql Server(unattended) using powershell

```<code>

Write-Host "`nStarting the install of SQL Server" -ForegroundColor Green

[string]$userName = 'domain\username'

[string]$userPassword = 'xyz'

[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force

[pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)

Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ConfigurationFile=`"$temp_file_location`"" -Credential $credObject -NoNewWindow -Wait -RedirectStandardOutput $standardOutputFile -RedirectStandardError $errorOutputFile

</code>```
```<code>
ERROR:

PS C:\Windows\system32> C:\Users\manish\Desktop\custommain.ps1
domain
eu-west-1
fetching the password from parameter stores
Cleaning the outputfile error
finding and replacing the domains and secrets
writting the content of ini into temp file C:\xyz-softwares\ms-sql-server\scripts\batch-files\temp_ConfigurationFile.ini
Mounting SQL Server Image
Getting Disk drive of the mounted image
Starting the install of SQL Server
Start-Process : This command cannot be run due to the error: The user name or password is incorrect.
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:65 char:2
+     Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
SQL Installation Failed Installation with exit code
SQL Installation Failed Installation with exit code
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:72 char:9
+         throw $error_message
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (SQL Installatio... with exit code:String) [], RuntimeException
    + FullyQualifiedErrorId : SQL Installation Failed Installation with exit code
PS C:\Windows\system32>
</code>```

I have tried with powershell with domain credentials.
Although i have exe file and windows machine is connected with domain

Tried to start process command with domain credetials.

Body:
Its and windows machine and trying to install Sql Server(unattended) using powershell

Write-Host "`nStarting the install of SQL Server" -ForegroundColor Green

[string]$userName = 'domain\username'

[string]$userPassword = 'xyz'

[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force

[pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)

Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ConfigurationFile=`"$temp_file_location`"" -Credential $credObject -NoNewWindow -Wait -RedirectStandardOutput $standardOutputFile -RedirectStandardError $errorOutputFile

ERROR:

PS C:\Windows\system32> C:\Users\manish\Desktop\custommain.ps1
domain
eu-west-1
fetching the password from parameter stores
Cleaning the outputfile error
finding and replacing the domains and secrets
writting the content of ini into temp file C:\xyz-softwares\ms-sql-server\scripts\batch-files\temp_ConfigurationFile.ini
Mounting SQL Server Image
Getting Disk drive of the mounted image
Starting the install of SQL Server
Start-Process : This command cannot be run due to the error: The user name or password is incorrect.
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:65 char:2
+     Start-Process -Filepath "$driveLetter\setup.exe" -ArgumentList "/ ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
SQL Installation Failed Installation with exit code
SQL Installation Failed Installation with exit code
At C:\xyz-softwares\ms-sql-server\scripts\powershell\ms-sqlserver-installation.ps1:72 char:9
+         throw $error_message
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (SQL Installatio... with exit code:String) [], RuntimeException
    + FullyQualifiedErrorId : SQL Installation Failed Installation with exit code
PS C:\Windows\system32>

I have tried with powershell with domain credentials.
Although i have exe file and windows machine is connected with domain

Tried to start process command with domain credetials.


问:
Google maps in flutter does not update upon setState
I have Google maps for flutter wrapped in a child component among other components in a scrollable page. The map component is initially in "readonly" mode, but when the user clicks a certain button, the startPositionSelection function is called and the map should now be in editMode.
The gestureRecognizers property makes sure that when the map is dragged, the page scrolls ({}) OR the map is interacted with (EagerGestureRecognizer), based on the editMode state.
The problem is that gestureRecognizers does not update when setState is called. Only the first map initialization setting counts. The other four gesture properties responds to the editMode change, but not the gestureRecognizers.

Any idea?

```<code>Completer<GoogleMapController> _controller = Completer();
CameraPosition? cameraPosition;
bool editMode = false;

@override
  initState() {
    super.initState();
      final latLng = LatLng(widget.value!.lat, widget.value!.lng);
      setMarker(latLng);
      cameraPosition = CameraPosition(
        target: latLng,
        zoom: 19,
      );
  }

    startPositionSelection() {
        setState(() {
          editMode = true;
        });
      }

      @override
      Widget build(BuildContext context) {
        return FormField(
            onSaved: widget.onSaved,
            builder: (FormFieldState<bool> state) {
              return Padding(
                padding: const EdgeInsets.all(2),
                child: SizedBox(
                  height: 275,
                  width: MediaQuery.of(context).size.width,
                  child: Stack(
                    children: [
                      GoogleMap(
                        markers: markers,
                        tiltGesturesEnabled: editMode,
                        zoomGesturesEnabled: editMode,
                        rotateGesturesEnabled: editMode,
                        scrollGesturesEnabled: editMode,
                        gestureRecognizers: editMode
                            ? {}
                            : {
                                Factory<OneSequenceGestureRecognizer>(
                                  () => EagerGestureRecognizer(),
                                ),
                              },
                        mapType: MapType.normal,
                        initialCameraPosition: cameraPosition!,
                        buildingsEnabled: true,
                        onMapCreated: (GoogleMapController controller) {
                          _controller.complete(controller);
                        },
                      ),
                    ],
                  ),
                ),
              );
            });
      }
</code>```

Body:
I have Google maps for flutter wrapped in a child component among other components in a scrollable page. The map component is initially in "readonly" mode, but when the user clicks a certain button, the startPositionSelection function is called and the map should now be in editMode.
The gestureRecognizers property makes sure that when the map is dragged, the page scrolls ({}) OR the map is interacted with (EagerGestureRecognizer), based on the editMode state.
The problem is that gestureRecognizers does not update when setState is called. Only the first map initialization setting counts. The other four gesture properties responds to the editMode change, but not the gestureRecognizers.

Any idea?

Completer<GoogleMapController> _controller = Completer();
CameraPosition? cameraPosition;
bool editMode = false;

@override
  initState() {
    super.initState();
      final latLng = LatLng(widget.value!.lat, widget.value!.lng);
      setMarker(latLng);
      cameraPosition = CameraPosition(
        target: latLng,
        zoom: 19,
      );
  }

    startPositionSelection() {
        setState(() {
          editMode = true;
        });
      }

      @override
      Widget build(BuildContext context) {
        return FormField(
            onSaved: widget.onSaved,
            builder: (FormFieldState<bool> state) {
              return Padding(
                padding: const EdgeInsets.all(2),
                child: SizedBox(
                  height: 275,
                  width: MediaQuery.of(context).size.width,
                  child: Stack(
                    children: [
                      GoogleMap(
                        markers: markers,
                        tiltGesturesEnabled: editMode,
                        zoomGesturesEnabled: editMode,
                        rotateGesturesEnabled: editMode,
                        scrollGesturesEnabled: editMode,
                        gestureRecognizers: editMode
                            ? {}
                            : {
                                Factory<OneSequenceGestureRecognizer>(
                                  () => EagerGestureRecognizer(),
                                ),
                              },
                        mapType: MapType.normal,
                        initialCameraPosition: cameraPosition!,
                        buildingsEnabled: true,
                        onMapCreated: (GoogleMapController controller) {
                          _controller.complete(controller);
                        },
                      ),
                    ],
                  ),
                ),
              );
            });
      }


问:
FromSqlRaw : Cannot create a DbSet for 'Model' because this type is not included in the model for the context
I have defined a Model class with 2 attributes [keyless] and [NotMapped] to map with a Stored procedure written in database. I have also defined the below line in my ModelContext class

```<code>public DbSet<sp_MySP> sp_MySP { get; set; }
</code>```

When executing the SP using the below line, I am getting the error "Cannot create a DbSet for 'sp_MySP' because this type is not included in the model for the context"

```<code>var data= _context.Set<sp_MySP>().FromSqlRaw("EXEC sp_MySP {0}", id).ToList();
</code>```

2 questions -

How to solve this error.

Is there a way to not define the model class in modelcontext and use the SP using FromSqlRaw?

I am using EF Core7.0 and .net 6.0

Body:
I have defined a Model class with 2 attributes [keyless] and [NotMapped] to map with a Stored procedure written in database. I have also defined the below line in my ModelContext class

public DbSet<sp_MySP> sp_MySP { get; set; }

When executing the SP using the below line, I am getting the error "Cannot create a DbSet for 'sp_MySP' because this type is not included in the model for the context"

var data= _context.Set<sp_MySP>().FromSqlRaw("EXEC sp_MySP {0}", id).ToList();

2 questions -

How to solve this error.

Is there a way to not define the model class in modelcontext and use the SP using FromSqlRaw?

I am using EF Core7.0 and .net 6.0


问:
System.NullReferenceException in HRESULT[] results = group.Write(items, values) //TitaniumAS OPCda
i need an opc client for work, i used TitaniumAS as it's really simple, the read works fine but the write doesnt, i have the exception in the title
The tagID is correct as it works when i read it.</p>
```<code>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TitaniumAS.Opc.Client.Common;
using TitaniumAS.Opc.Client.Da;
using TitaniumAS.Opc.Client.Da.Browsing;
using System.Threading;

namespace OPCDA
{
    class Program
    {
        static void Main(string[] args)
        {

            TitaniumAS.Opc.Client.Bootstrap.Initialize();

            Uri url = UrlBuilder.Build("Kepware.KEPServerEX.V6");

            using (var server = new OpcDaServer(url))
            {
                server.Connect();

                //creating tag group
                OpcDaGroup group = server.AddGroup("MyGroup");
                group.IsActive= true;

//Write
                OpcDaItem int2 = group.Items.FirstOrDefault(i => i.ItemId == "Channel1.Device1.Woord");

                OpcDaItem[] items = { int2 };
                object[] values = { 15601 };
                HRESULT[] results = group.Write(items, values);

            }
        }
    }
}
</code>```

Body:
i need an opc client for work, i used TitaniumAS as it's really simple, the read works fine but the write doesnt, i have the exception in the title
The tagID is correct as it works when i read it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TitaniumAS.Opc.Client.Common;
using TitaniumAS.Opc.Client.Da;
using TitaniumAS.Opc.Client.Da.Browsing;
using System.Threading;

namespace OPCDA
{
    class Program
    {
        static void Main(string[] args)
        {

            TitaniumAS.Opc.Client.Bootstrap.Initialize();

            Uri url = UrlBuilder.Build("Kepware.KEPServerEX.V6");

            using (var server = new OpcDaServer(url))
            {
                server.Connect();

                //creating tag group
                OpcDaGroup group = server.AddGroup("MyGroup");
                group.IsActive= true;

//Write
                OpcDaItem int2 = group.Items.FirstOrDefault(i => i.ItemId == "Channel1.Device1.Woord");

                OpcDaItem[] items = { int2 };
                object[] values = { 15601 };
                HRESULT[] results = group.Write(items, values);

            }
        }
    }
}


问:
'MM-yyyy' date/string format for query parameter in SAP crystal report's command
We are working on an MM-yyyy parameter, it goes like this

Crystal Report's "Command" (STRING PARAMETER NAME = P_DATE_From and P_DATE_TO)

Select Column1,
Column2
from [dbo].[saptable] t1
where convert(date, t1.[DateColumn]) between convert(date,CONCAT(SUBSTRING({?P_DATE_From}, 4, 7),'-',SUBSTRING({?P_DATE_From}, 1, 2),'-', '01'))
and
EOMONTH(cast(CONCAT(SUBSTRING({?P_DATE_TO}, 1, 2), '-', '01', '-', SUBSTRING({?P_DATE_TO}, 4, 7)) as date))

but no data can be retrieved from the said query in SAP command.

I was able to successfully execute the idea through "RECORDS FORMULA" in SAP Crystal reports.
but the report will become less efficient as time goes due to the number of data contained in the table.


问:
Change CPT taxonomy archive URL structure to /cpt_name/category_name/
The task seems simple at first glance, but I've been searching for the answer for several hours and so far I've been unable to achieve anything.

Where I am now: I have created a custom post type named my-cpt, I have also assigned to it a taxonomy which I have named my-tax. To it I created some taxonomy terms: term-1, term-2 and term-2;

The effect I would like to achieve is a url in the following format. For the taxonomy archives:

https://example.com/my-cpt/term-1

at the moment I have:

https://example.com/my-tax/term-1

Similarly for a single entry. I would like to achieve:

https://example.com/my-cpt/term-1/my-post-title

at the moment I have:

https://example.com/my-cpt/my-post-title

I've tried a few solutions, but mostly end up with a 404 error. do any of you guys maybe know how to solve this?


问:
Google News/Without login: How to select topics in main page (URL?)
I'm in an organization that doesn't allow using outsiders email. Therefore, I refrain from logging in with my Google account, but Google pushes us to log in for the merest action, like setting the color theme...

I'd like to change which topics appear in the new December 2022 main page. Indeed, the health section doesn't appear anymore by default. And, Google tells me I have to log in to access my settings.

Would you know another way to change which topics (plural) appear on the main page without logging in? Is there, maybe, an URL GET-method argument that would achieve the same result (like topics=nation,world,business,science,technology,entertainment,sports,health which doesn't work) or whatever alternative?

Thanks.


问:
Android GIS one tap authentication unable to get the phone number
I have one tap authentication in my application. I am trying to do sign up request with setRequestVerifiedPhoneNumber. Sign up request return the result with profile details but doesn't return the phone number. My code looks like as follow

```<code>oneTapClient = Identity.getSignInClient(this);
            signUpRequest = BeginSignInRequest.builder()
                .setGoogleIdTokenRequestOptions(
                    BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
                        .setSupported(true)
                        .setServerClientId("userKey.apps.content.com")
                        .setFilterByAuthorizedAccounts(false)
                        .setRequestVerifiedPhoneNumber(true)
                        .build()
                )
                .build()

            oneTapClient.beginSignIn(signUpRequest)
                .addOnSuccessListener(this) { result ->
                    try {
                        startIntentSenderForResult(
                            result.pendingIntent.intentSender, REQ_ONE_TAP,
                            null, 0, 0, 0
                        )
                    } catch (e: IntentSender.SendIntentException) {
                        Log.e("GIS EXAMPLE ", "GIS EXAMPLE Couldn't start One Tap UI: ${e.localizedMessage}")
                    }
                }
                .addOnFailureListener(this) { e ->
                    // No Google Accounts found. Just continue presenting the signed-out UI.
                }

</code>```

After successful authentication app receives email and token details but receives number as null.

Body:
I have one tap authentication in my application. I am trying to do sign up request with setRequestVerifiedPhoneNumber. Sign up request return the result with profile details but doesn't return the phone number. My code looks like as follow

oneTapClient = Identity.getSignInClient(this);
            signUpRequest = BeginSignInRequest.builder()
                .setGoogleIdTokenRequestOptions(
                    BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
                        .setSupported(true)
                        .setServerClientId("userKey.apps.content.com")
                        .setFilterByAuthorizedAccounts(false)
                        .setRequestVerifiedPhoneNumber(true)
                        .build()
                )
                .build()

            oneTapClient.beginSignIn(signUpRequest)
                .addOnSuccessListener(this) { result ->
                    try {
                        startIntentSenderForResult(
                            result.pendingIntent.intentSender, REQ_ONE_TAP,
                            null, 0, 0, 0
                        )
                    } catch (e: IntentSender.SendIntentException) {
                        Log.e("GIS EXAMPLE ", "GIS EXAMPLE Couldn't start One Tap UI: ${e.localizedMessage}")
                    }
                }
                .addOnFailureListener(this) { e ->
                    // No Google Accounts found. Just continue presenting the signed-out UI.
                }

After successful authentication app receives email and token details but receives number as null.


问:
Open remote Jupyter Notebook in VSCode
I can open a remote Jupyter Notebook but I need to:

connect in SSH to the server

then use jupyter plugin to connect to the kernel.

Is there a way to do that more simply ?

Title: Open remote Jupyter Notebook in VSCode


问:
Splitting String of Numbers into String[]
Splitting a string of numbers separated by spaces or commas into a string array doesn't seem to work.

Using the code

```<code>string numStr = "12 13 2 7 8 105 6 5 29 0";
char[] delimiterChars = { ' ', ',' };
string[] numArray = numStr.Split(delimiterChars);
</code>```

I expect numbers to contain "12", "13", "2", "7", "8", "105", "6", "5", "29", "0" but instead numArray[0] = "12 13 2 7 8 105 6 5 29 0"

I've also tried using the following code but it doesn't work either.

```<code>string[] keywords = Regex.Split(numstr, @"(?<=\d) |, ");
</code>```

Body:
Splitting a string of numbers separated by spaces or commas into a string array doesn't seem to work.

Using the code

string numStr = "12 13 2 7 8 105 6 5 29 0";
char[] delimiterChars = { ' ', ',' };
string[] numArray = numStr.Split(delimiterChars);

I expect numbers to contain "12", "13", "2", "7", "8", "105", "6", "5", "29", "0" but instead numArray[0] = "12 13 2 7 8 105 6 5 29 0"

I've also tried using the following code but it doesn't work either.

string[] keywords = Regex.Split(numstr, @"(?<=\d) |, ");


问:
AsynchronousServerSocketChannel vs ServerSocketChannel performance
I am wondering about the performance using ServerSocketChannel and  AsynchronousServerSocketChannel. In theory, AsynchronousServerSocketChannel should be faster. Do you know which option is better from a performance perspective?</p>


问:
gRPC C# DNS Resolution Failed - Domain name not found
i got the issue that, when i want to connect to any of my grpc services. This started happening yesterday out of nowhere. (i did not change anything neither in the code nor the os).

This is the Error Message:

```<code>Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="DNS resolution failed for https://0.0.0.0:3000: C-ares status is not ARES_SUCCESS qtype=A name=https://0.0.0.0:3000 is_balancer=0: Domain name not found"
</code>```

All the Services get the Host/Port from a Config File, that has a scheme like this:

{
    "Services": {
        "Common": {
            "SSL": {
                "UseSSL": true,
                "CertificateChain": "server.crt",
                "PrivateKey": "server.pem"
            }
        },
        "GrpcService": {
            "Hostname": "0.0.0.0",
            "Port": 3000
        },
    }
}

```
<p>Each Server/Client has a Constructor that fetches the Configuration and (if necessary) configures ssl/https:
Server:</p>
<pre class="lang-cs prettyprint-override"><code>var host = config.GetValue<string>("Services:CameraIO:Hostname");
var port = config.GetValue<int>("Services:CameraIO:Port");
var hostBuilder = new HostBuilder()
    .ConfigureServices((hostContext, services) =>
    {
        Server server;
        if (config.GetValue<bool>("Services:Common:SSL:UseSSL"))
            server = new Server
            {
                Services = { CameraIOService.BindService(new CameraIOServer()) },
                Ports = { new ServerPort(host, port, Util.GetServerCertificates(config)) }
            };
        else
            server = new Server
            {
                Services = { CameraIOService.BindService(new CameraIOServer()) },
                Ports = { new ServerPort(host, port, ServerCredentials.Insecure) }
            };
        services.AddSingleton(server);
        services.AddSingleton<IHostedService, ServiceHost>();
    });
Console.WriteLine($"Starting RPC CameraIO Server on {host}:{port}");
hostBuilder.RunConsoleAsync();
</code>```

Client:

if (config.GetValue<bool>("Services:Common:SSL:UseSSL"))
{
    var sslChannel = new Channel("https://" + config.GetValue<string>("Services:CameraIO:Hostname"),
        config.GetValue<int>("Services:CameraIO:Port"),
        Util.GetClientCertificate(config));
    client = new CameraIOService.CameraIOServiceClient(sslChannel);
}
else
{
    var host = "http://" + config.GetValue<string>("Services:CameraIO:Hostname");
    var port = config.GetValue<int>("Services:CameraIO:Port");
    var channel = GrpcChannel.ForAddress($"{host}:{port}");
    client = new CameraIOService.CameraIOServiceClient(channel);
}
logger = new LoggingClient<CameraIOClient>();
```
<p>I do not know if this is relevant, but these are the Utility Methods to get the Client/Server SSL Credentials:</p>
<pre class="lang-cs prettyprint-override"><code>/// <summary>
/// Get Server SSL Credentials
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static SslServerCredentials GetServerCertificates(IConfiguration config)
{
    var ccPath = config.GetValue<string>("Services:Common:SSL:CertificateChain");
    var pkPath = config.GetValue<string>("Services:Common:SSL:PrivateKey");
    if (!File.Exists(ccPath))
        throw new FileNotFoundException(
            $"Could not find Certificate Chain File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}\nLooking for File: {ccPath}");

    if (!File.Exists(pkPath))
        throw new FileNotFoundException(
            $"Could not find Private Key File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}Looking for File: {pkPath}");
    var kcp = new KeyCertificatePair(
        File.ReadAllText(ccPath),
        File.ReadAllText(pkPath));
    return new SslServerCredentials(new List<KeyCertificatePair> { kcp });
}

/// <summary>
/// Get Client SSL Credentials
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static SslCredentials GetClientCertificate(IConfiguration config)
{
    var ccPath = config.GetValue<string>("Services:Common:SSL:CertificateChain");
    if (!File.Exists(ccPath))
        throw new FileNotFoundException(
            $"Could not find Certificate Chain File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}\nLooking for File: {ccPath}");
    return new SslCredentials(
        File.ReadAllText(ccPath));
}
</code>```

This is my Main.cs-File (Main Method)

if (File.Exists("imgui.ini")) File.Delete("imgui.ini");
var config = new ConfigurationBuilder().AddJsonFile("settings.json").AddEnvironmentVariables().Build();
var loggingService = new LoggingServerHost(config);
var cameraIOService = new CameraIOServerHost(config);
var metricServer = new MetricServerHost(config);
var gui = new CoreGUI.CoreGui();

var lst = Task.Run(loggingService.Start);
var ciost = Task.Run(cameraIOService.Start);
var mst = Task.Run(metricServer.Start);

var metricClient = new MetricClient();

if (lst.Status == TaskStatus.Running)
    RunningServices.Add("Logging Server");
else
    Console.WriteLine("Could not start Logging Server!");

if (ciost.Status == TaskStatus.Running)
    RunningServices.Add("CameraIO Server");
else
    Console.WriteLine("Could not start CameraIO Server!");

if (mst.Status == TaskStatus.Running)
    RunningServices.Add("Metric Server");
else
    Console.WriteLine("Could not start Metric Server");

metricClient.PushMetric(new Metric
    { ServiceName = "Core", Name = "running_services", Value = string.Join(",", RunningServices) });

if (config.GetValue<bool>("Services:Core:StartUI")) gui.Start();

Console.ReadLine();
```
<p>This Batch-Script creates the used Certificates:</p>
```@echo off
title Certificate Generation Script

if exist certs\ rd /q /s certs\
if exist request\ rd /q /s request\

mkdir certs
mkdir request

set OPENSSL_BIN=openssl
set EXPIRE_DAYS=7
set PASSPHRASE=password
set BIT_LENGTH=4096

set CRT_PATH=certs
set REQ_PATH=request

set CAC_SUBJ=""
set SSR_SUBJ=""

echo Generating Root Certificate Authority Key...
%OPENSSL_BIN% genrsa -passout pass:%PASSPHRASE% -des3 -out %CRT_PATH%\root.key %BIT_LENGTH%

echo Generating Root CA Certificate...
%OPENSSL_BIN% req -passin pass:%PASSPHRASE% -new -x509 -days %EXPIRE_DAYS% -key %CRT_PATH%\root.key -out %CRT_PATH%\root.crt -subj %CAC_SUBJ%

echo Generating Server Key...
%OPENSSL_BIN% genrsa -passout pass:%PASSPHRASE% -des3 -out %CRT_PATH%\server.key %BIT_LENGTH%

echo Generating Server Signing Request...
%OPENSSL_BIN% req -passin pass:%PASSPHRASE% -new -key %CRT_PATH%\server.key -out %REQ_PATH%\server.csr -subj %SSR_SUBJ%

echo Self-Signing Server Certificate...
%OPENSSL_BIN% x509 -req -passin pass:%PASSPHRASE% -days %EXPIRE_DAYS% -extensions server_ssl -extfile openssl-ext.cnf -in %REQ_PATH%\server.csr -CA %CRT_PATH%\root.crt -CAkey %CRT_PATH%\root.key -set_serial 01 -out %CRT_PATH%\server.crt

echo Removing Passphrase from Server Key...
%OPENSSL_BIN% rsa -passin pass:%PASSPHRASE% -in %CRT_PATH%\server.key -out %CRT_PATH%\server.key

echo Exporting PKCS12 Keys...
%OPENSSL_BIN% pkcs12 -export -in %CRT_PATH%\root.crt -inkey %CRT_PATH%\root.key -out %CRT_PATH%\root.pfx -passout pass:%PASSPHRASE% -passin pass:%PASSPHRASE% -name "<My Company> Root CA Certificate"
%OPENSSL_BIN% pkcs12 -export -in %CRT_PATH%\server.crt -inkey %CRT_PATH%\server.key -out %CRT_PATH%\server.pfx -passout pass:%PASSPHRASE% -passin pass:%PASSPHRASE% -name "<My Application> Self-Signed Server Certificate"

echo Generating PEM Version of Key...
type %CRT_PATH%\server.key > %CRT_PATH%\server.pem
type %CRT_PATH%\server.crt >> %CRT_PATH%\server.pem

rd /q /s request\
```

Anyone got a clue on what the problem could be?

Body:
i got the issue that, when i want to connect to any of my grpc services. This started happening yesterday out of nowhere. (i did not change anything neither in the code nor the os).

This is the Error Message:

Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="DNS resolution failed for https://0.0.0.0:3000: C-ares status is not ARES_SUCCESS qtype=A name=https://0.0.0.0:3000 is_balancer=0: Domain name not found"

All the Services get the Host/Port from a Config File, that has a scheme like this:

{
    "Services": {
        "Common": {
            "SSL": {
                "UseSSL": true,
                "CertificateChain": "server.crt",
                "PrivateKey": "server.pem"
            }
        },
        "GrpcService": {
            "Hostname": "0.0.0.0",
            "Port": 3000
        },
    }
}

Each Server/Client has a Constructor that fetches the Configuration and (if necessary) configures ssl/https:
Server:

var host = config.GetValue<string>("Services:CameraIO:Hostname");
var port = config.GetValue<int>("Services:CameraIO:Port");
var hostBuilder = new HostBuilder()
    .ConfigureServices((hostContext, services) =>
    {
        Server server;
        if (config.GetValue<bool>("Services:Common:SSL:UseSSL"))
            server = new Server
            {
                Services = { CameraIOService.BindService(new CameraIOServer()) },
                Ports = { new ServerPort(host, port, Util.GetServerCertificates(config)) }
            };
        else
            server = new Server
            {
                Services = { CameraIOService.BindService(new CameraIOServer()) },
                Ports = { new ServerPort(host, port, ServerCredentials.Insecure) }
            };
        services.AddSingleton(server);
        services.AddSingleton<IHostedService, ServiceHost>();
    });
Console.WriteLine($"Starting RPC CameraIO Server on {host}:{port}");
hostBuilder.RunConsoleAsync();

Client:

if (config.GetValue<bool>("Services:Common:SSL:UseSSL"))
{
    var sslChannel = new Channel("https://" + config.GetValue<string>("Services:CameraIO:Hostname"),
        config.GetValue<int>("Services:CameraIO:Port"),
        Util.GetClientCertificate(config));
    client = new CameraIOService.CameraIOServiceClient(sslChannel);
}
else
{
    var host = "http://" + config.GetValue<string>("Services:CameraIO:Hostname");
    var port = config.GetValue<int>("Services:CameraIO:Port");
    var channel = GrpcChannel.ForAddress($"{host}:{port}");
    client = new CameraIOService.CameraIOServiceClient(channel);
}
logger = new LoggingClient<CameraIOClient>();

I do not know if this is relevant, but these are the Utility Methods to get the Client/Server SSL Credentials:

///
/// Get Server SSL Credentials
///
/// <param name="config"></param>
/// <returns></returns>
public static SslServerCredentials GetServerCertificates(IConfiguration config)
{
    var ccPath = config.GetValue<string>("Services:Common:SSL:CertificateChain");
    var pkPath = config.GetValue<string>("Services:Common:SSL:PrivateKey");
    if (!File.Exists(ccPath))
        throw new FileNotFoundException(
            $"Could not find Certificate Chain File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}\nLooking for File: {ccPath}");

    if (!File.Exists(pkPath))
        throw new FileNotFoundException(
            $"Could not find Private Key File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}Looking for File: {pkPath}");
    var kcp = new KeyCertificatePair(
        File.ReadAllText(ccPath),
        File.ReadAllText(pkPath));
    return new SslServerCredentials(new List<KeyCertificatePair> { kcp });
}

///
/// Get Client SSL Credentials
///
/// <param name="config"></param>
/// <returns></returns>
public static SslCredentials GetClientCertificate(IConfiguration config)
{
    var ccPath = config.GetValue<string>("Services:Common:SSL:CertificateChain");
    if (!File.Exists(ccPath))
        throw new FileNotFoundException(
            $"Could not find Certificate Chain File!\nCurrent Path: {AppDomain.CurrentDomain.BaseDirectory}\nLooking for File: {ccPath}");
    return new SslCredentials(
        File.ReadAllText(ccPath));
}

This is my Main.cs-File (Main Method)

if (File.Exists("imgui.ini")) File.Delete("imgui.ini");
var config = new ConfigurationBuilder().AddJsonFile("settings.json").AddEnvironmentVariables().Build();
var loggingService = new LoggingServerHost(config);
var cameraIOService = new CameraIOServerHost(config);
var metricServer = new MetricServerHost(config);
var gui = new CoreGUI.CoreGui();

var lst = Task.Run(loggingService.Start);
var ciost = Task.Run(cameraIOService.Start);
var mst = Task.Run(metricServer.Start);

var metricClient = new MetricClient();

if (lst.Status == TaskStatus.Running)
    RunningServices.Add("Logging Server");
else
    Console.WriteLine("Could not start Logging Server!");

if (ciost.Status == TaskStatus.Running)
    RunningServices.Add("CameraIO Server");
else
    Console.WriteLine("Could not start CameraIO Server!");

if (mst.Status == TaskStatus.Running)
    RunningServices.Add("Metric Server");
else
    Console.WriteLine("Could not start Metric Server");

metricClient.PushMetric(new Metric
    { ServiceName = "Core", Name = "running_services", Value = string.Join(",", RunningServices) });

if (config.GetValue<bool>("Services:Core:StartUI")) gui.Start();

Console.ReadLine();

This Batch-Script creates the used Certificates:

@echo off
title Certificate Generation Script

if exist certs\ rd /q /s certs\
if exist request\ rd /q /s request\

mkdir certs
mkdir request

set OPENSSL_BIN=openssl
set EXPIRE_DAYS=7
set PASSPHRASE=password
set BIT_LENGTH=4096

set CRT_PATH=certs
set REQ_PATH=request

set CAC_SUBJ=""
set SSR_SUBJ=""

echo Generating Root Certificate Authority Key...
%OPENSSL_BIN% genrsa -passout pass:%PASSPHRASE% -des3 -out %CRT_PATH%\root.key %BIT_LENGTH%

echo Generating Root CA Certificate...
%OPENSSL_BIN% req -passin pass:%PASSPHRASE% -new -x509 -days %EXPIRE_DAYS% -key %CRT_PATH%\root.key -out %CRT_PATH%\root.crt -subj %CAC_SUBJ%

echo Generating Server Key...
%OPENSSL_BIN% genrsa -passout pass:%PASSPHRASE% -des3 -out %CRT_PATH%\server.key %BIT_LENGTH%

echo Generating Server Signing Request...
%OPENSSL_BIN% req -passin pass:%PASSPHRASE% -new -key %CRT_PATH%\server.key -out %REQ_PATH%\server.csr -subj %SSR_SUBJ%

echo Self-Signing Server Certificate...
%OPENSSL_BIN% x509 -req -passin pass:%PASSPHRASE% -days %EXPIRE_DAYS% -extensions server_ssl -extfile openssl-ext.cnf -in %REQ_PATH%\server.csr -CA %CRT_PATH%\root.crt -CAkey %CRT_PATH%\root.key -set_serial 01 -out %CRT_PATH%\server.crt

echo Removing Passphrase from Server Key...
%OPENSSL_BIN% rsa -passin pass:%PASSPHRASE% -in %CRT_PATH%\server.key -out %CRT_PATH%\server.key

echo Exporting PKCS12 Keys...
%OPENSSL_BIN% pkcs12 -export -in %CRT_PATH%\root.crt -inkey %CRT_PATH%\root.key -out %CRT_PATH%\root.pfx -passout pass:%PASSPHRASE% -passin pass:%PASSPHRASE% -name "<My Company> Root CA Certificate"
%OPENSSL_BIN% pkcs12 -export -in %CRT_PATH%\server.crt -inkey %CRT_PATH%\server.key -out %CRT_PATH%\server.pfx -passout pass:%PASSPHRASE% -passin pass:%PASSPHRASE% -name "<My Application> Self-Signed Server Certificate"

echo Generating PEM Version of Key...
type %CRT_PATH%\server.key > %CRT_PATH%\server.pem
type %CRT_PATH%\server.crt >> %CRT_PATH%\server.pem

rd /q /s request\

Anyone got a clue on what the problem could be?


问:
Read truncated json file to pandas dataframe
I have a json file that is truncated. I have been looking for a way to read it into a pandas dataframe, but not been successfull. Several post refers to the read_json.

I've tried below approach;

```<code>import pandas as pd

df = pd.read_json("C:/Users/user1/Documents/history_truncated.json")
df.head()

### Results in ###
ValueError: Unexpected character found when decoding array value (2)

</code>```

A similar issue is found here where the solution was to use an absolute path. In my case that did not work. Any suggestions on how to solve this issue?

Edit adding last few lines to question

```<code>"departurePlatformName":null,"departureBoardingActivity":0,"departureBoardingActivitySpecified":true,"departureStopAssignment":null,
"departureOperatorRefs":null,"aimedHeadwayInterval":null,"expectedHeadwayInterval":null,"distanceFromStop":null,"numberOfStopsAway":null,"extensions":null},{"stopPointRef":{"value":"SE:276:Quay:9022012013003041"},"visitNumber":"1","order":"7","stopPointName":null,"item":false,"itemElementName":0,"predictionInaccurateSpecified":false,"occupancySpecified":false,"timingPointSpecified":false,"boardingStretch":false,"requestStop":false,"originDisplay":null,"destinationDisplay":null,"callNote":null,"facilityConditionElement":null,"facilityChangeElement":null,"situationRef":null,"aimedArrivalTime":"2022-08-30T09:33:00+02:00","aimedArrivalTimeSpecified":true,"expectedArrivalTime":"2022-08-30T09:33:00+02:00","expectedArrivalTimeSpecified":true,"expectedArrivalPredictionQuality":null,"arrivalStatus":0,"arrivalStatusSpecified":true,"arrivalProximityText":null,"arrivalPlatformName":null,"arrivalBoardingActivity":0,"arrivalBoardingActivitySpecified":true,"arrivalStopAssignment":null,"arrivalOperatorRefs":null,"aimedDepartureTimeSpecified":false,"expectedDepartureTimeSpecified":false,"provisionalExpectedDepartureTimeSpecified":false,"earliestExpectedDepartureTimeSpecified":false,"expectedDeparturePredictionQuality":null,"aimedLatestPassengerAccessTimeSpecified":false,"expectedLatestPassengerAccessTimeSpecified":false,"departureStatus":0,"departureStatusSpecified":true,"departureProximityText":null,"departurePlatformName":null,"departureBoardingActivity":0,
"departureBoardingActivitySpecified":true,
"departureStopAssignment":null,
"departureOperatorRefs":null,"aimedHeadwayInterval":null,
"expectedHeadwayInterval":null,"distanceFromStop":null,
"numberOfStopsAway":null,"extensions":null}],"isCompleteStopSequence":true,
"extensions":null}
}]
}]]}
}
</code>```

Body:
I have a json file that is truncated. I have been looking for a way to read it into a pandas dataframe, but not been successfull. Several post refers to the read_json.

I've tried below approach;

import pandas as pd

df = pd.read_json("C:/Users/user1/Documents/history_truncated.json")
df.head()

### Results in ###
ValueError: Unexpected character found when decoding array value (2)

A similar issue is found here where the solution was to use an absolute path. In my case that did not work. Any suggestions on how to solve this issue?

Edit adding last few lines to question

"departurePlatformName":null,"departureBoardingActivity":0,"departureBoardingActivitySpecified":true,"departureStopAssignment":null,
"departureOperatorRefs":null,"aimedHeadwayInterval":null,"expectedHeadwayInterval":null,"distanceFromStop":null,"numberOfStopsAway":null,"extensions":null},{"stopPointRef":{"value":"SE:276:Quay:9022012013003041"},"visitNumber":"1","order":"7","stopPointName":null,"item":false,"itemElementName":0,"predictionInaccurateSpecified":false,"occupancySpecified":false,"timingPointSpecified":false,"boardingStretch":false,"requestStop":false,"originDisplay":null,"destinationDisplay":null,"callNote":null,"facilityConditionElement":null,"facilityChangeElement":null,"situationRef":null,"aimedArrivalTime":"2022-08-30T09:33:00+02:00","aimedArrivalTimeSpecified":true,"expectedArrivalTime":"2022-08-30T09:33:00+02:00","expectedArrivalTimeSpecified":true,"expectedArrivalPredictionQuality":null,"arrivalStatus":0,"arrivalStatusSpecified":true,"arrivalProximityText":null,"arrivalPlatformName":null,"arrivalBoardingActivity":0,"arrivalBoardingActivitySpecified":true,"arrivalStopAssignment":null,"arrivalOperatorRefs":null,"aimedDepartureTimeSpecified":false,"expectedDepartureTimeSpecified":false,"provisionalExpectedDepartureTimeSpecified":false,"earliestExpectedDepartureTimeSpecified":false,"expectedDeparturePredictionQuality":null,"aimedLatestPassengerAccessTimeSpecified":false,"expectedLatestPassengerAccessTimeSpecified":false,"departureStatus":0,"departureStatusSpecified":true,"departureProximityText":null,"departurePlatformName":null,"departureBoardingActivity":0,
"departureBoardingActivitySpecified":true,
"departureStopAssignment":null,
"departureOperatorRefs":null,"aimedHeadwayInterval":null,
"expectedHeadwayInterval":null,"distanceFromStop":null,
"numberOfStopsAway":null,"extensions":null}],"isCompleteStopSequence":true,
"extensions":null}
}]
}]]}
}


问:
Unused dependencies should not be imported in application classpath
I have created a sdk which acts a library to generate api testcases .
Whenever I add my java-sdk dependency in the pom.xml file of the client application, those dependencies which are not in the client's application and used by java-sdk to add support for but are not used internally get imported along .

For eg: my java-sdk uses ApacheClient, so it contains the ApacheClient dependency for intercepting. But if the client is not using this dependency, it should not appear in the application classpath but it does.

I have created a multi-module project to upload at maven central , the module where all other module acts as dependency looks like -

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>java-sdk</artifactId>
        <groupId>io.keploy</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>keploy-sdk</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>keploy-sdk</name>
    <description>Client Java SDK for Keploy</description>
    <url>https://github.com/keploy/java-sdk</url>

    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>

        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>core</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>integration</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>models</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>common</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty-shaded</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency> <!-- necessary for Java 9+ -->
            <groupId>org.apache.tomcat</groupId>
            <artifactId>annotations-api</artifactId>
            <version>6.0.53</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.21.7</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.10.0</version>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.12.14</version>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy-agent</artifactId>
            <version>1.12.14</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
Footer
</code>```

Body:
I have created a sdk which acts a library to generate api testcases .
Whenever I add my java-sdk dependency in the pom.xml file of the client application, those dependencies which are not in the client's application and used by java-sdk to add support for but are not used internally get imported along .

For eg: my java-sdk uses ApacheClient, so it contains the ApacheClient dependency for intercepting. But if the client is not using this dependency, it should not appear in the application classpath but it does.

I have created a multi-module project to upload at maven central , the module where all other module acts as dependency looks like -

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>java-sdk</artifactId>
        <groupId>io.keploy</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>keploy-sdk</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>keploy-sdk</name>
    <description>Client Java SDK for Keploy</description>
    <url>https://github.com/keploy/java-sdk</url>

    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>

        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>core</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>api</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>integration</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>models</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.keploy</groupId>
            <artifactId>common</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty-shaded</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>1.49.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>annotations-api</artifactId>
            <version>6.0.53</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.21.7</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.10.0</version>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.12.14</version>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy-agent</artifactId>
            <version>1.12.14</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
Footer


问:
Showing a combined Top 10
I'm trying to create a combined top 10 in powerBI.

I have a 'process name' then for each process, I would like powerBI to find the top 10 of that process for 'cost', then the top 10 for 'count A' then top 10 for 'count B'.

The same process could be in the top 10 for cost, count A and count B. This also means there could be more than 10 of 'process name' showing because I would like it to show the top10 for 'cost','count A' and 'count B'.

I could achieve this in excel by using sumif's, countif's and then manually filtering for top10 on each category then remove duplicates and use for my graph.

I don't know if this is possible in powerbi, could somebody provide some guidance?

Thanks

I've tried ranking by top 10 but I can only add one value in powerbi. I've also thought of seeing if there is a formula that will check for top 10 of each and then return a result, then I could create a measure for combined top 10 but I'm not that experienced yet to know if it will work

Title: Showing a combined Top 10


问:
Axios getStore is undefined in NextJs api calls. (Redux, NextJs, Jwt)
I am trying to set up authentication for a project. Once a user signs up for our app they get sent to our home page with an id in the query. This id then gets used to submit user and then the jwt token gets saved inside redux state.

All our calls now go through an axios client where the jwt token is passed on every request. The token gets read with store.getState(injectStore)

This all works fine inside getserversideProps, but the issue comes in when using calls on the frontend that goes through NextJs built in 'pages/api' folder. Any calls inside those folders causes the store.getState() to be undefined. I do not understand why since it uses the exact same client as geserversideProps.

Example GetServersideProps(working)

```<code>    try {
        const response = await serverApiClient.get('v1/config');

        return {
            props: {

            },
        };
    } catch ({ error: { statusCode = 500, message = 'Internal Server Error' } }) {
        if (statusCode === 401) {
            return {
                redirect: {
                    permanent: false,
                    destination: '/',
                },
            };
        }
        throw new Error(message as string);
    }
};
</code>```

Example Frontend bff call(not working)

```<code>    try {
// Call below get sent to next built in api
        const players = await apiClient.get(`/defenders?sortBy=${statId}&team_id=${teamShortName}`);
        return players;
    } catch (error) {
        return { error };
    }
};

</code>```
```<code>export default async function handler(req: NextApiRequest) {
    console.log('Start request')

       try {
        const { sortBy, team_id: teamId } = req.query;
        const response = await serverApiClient.get(`/v1/players/picks?position=DEF&sort_by=${sortBy}&team_id=${teamId}`);
</code>```

Api Client

```<code> mergeConfigs(
        params: Record<string, string>,
        headers: Record<string, string>,
        configs: Record<string, string>,
    ): AxiosRequestConfig {
        const defaultConfigs = ApiClient.getDefaultConfigs();
        *const token = store?.getState()?.jwtToken?.value*

//ISSUE ABOVE - This store .getState() is only undefined in nextJS api folder calls.
        return {
            ...defaultConfigs,
            ...configs,
            params,
            headers: {
                ...defaultConfigs.headers,
                ...headers,
                ...(token ? { Authorization: `Bearer ${token}` } : {}),
            },
        };
    }

    get(
        uri: string,
        params = {},
        headers = {},
        configs = {},
    ): Promise<AxiosResponse | any> {
        return this.client
            .get(uri, this.mergeConfigs(params, headers, configs))
            .then((response) => {
                return (response.data ? response.data : response);
            })
            .catch((error) => {
                const errorObject = {
                    error: error?.response?.data,
                };

                throw Object.assign(errorObject);
            });
    }
</code>```

If anyone has some advice on why that getStore is undefined in frontend-to-backend calls please assist. Thanks all!

Body:
I am trying to set up authentication for a project. Once a user signs up for our app they get sent to our home page with an id in the query. This id then gets used to submit user and then the jwt token gets saved inside redux state.

All our calls now go through an axios client where the jwt token is passed on every request. The token gets read with store.getState(injectStore)

This all works fine inside getserversideProps, but the issue comes in when using calls on the frontend that goes through NextJs built in 'pages/api' folder. Any calls inside those folders causes the store.getState() to be undefined. I do not understand why since it uses the exact same client as geserversideProps.

Example GetServersideProps(working)

    try {
        const response = await serverApiClient.get('v1/config');

        return {
            props: {

            },
        };
    } catch ({ error: { statusCode = 500, message = 'Internal Server Error' } }) {
        if (statusCode === 401) {
            return {
                redirect: {
                    permanent: false,
                    destination: '/',
                },
            };
        }
        throw new Error(message as string);
    }
};

Example Frontend bff call(not working)

    try {
// Call below get sent to next built in api
        const players = await apiClient.get(`/defenders?sortBy=${statId}&team_id=${teamShortName}`);
        return players;
    } catch (error) {
        return { error };
    }
};

export default async function handler(req: NextApiRequest) {
    console.log('Start request')

       try {
        const { sortBy, team_id: teamId } = req.query;
        const response = await serverApiClient.get(`/v1/players/picks?position=DEF&sort_by=${sortBy}&team_id=${teamId}`);

Api Client

 mergeConfigs(
        params: Record<string, string>,
        headers: Record<string, string>,
        configs: Record<string, string>,
    ): AxiosRequestConfig {
        const defaultConfigs = ApiClient.getDefaultConfigs();
        *const token = store?.getState()?.jwtToken?.value*

//ISSUE ABOVE - This store .getState() is only undefined in nextJS api folder calls.
        return {
            ...defaultConfigs,
            ...configs,
            params,
            headers: {
                ...defaultConfigs.headers,
                ...headers,
                ...(token ? { Authorization: `Bearer ${token}` } : {}),
            },
        };
    }

    get(
        uri: string,
        params = {},
        headers = {},
        configs = {},
    ): Promise<AxiosResponse | any> {
        return this.client
            .get(uri, this.mergeConfigs(params, headers, configs))
            .then((response) => {
                return (response.data ? response.data : response);
            })
            .catch((error) => {
                const errorObject = {
                    error: error?.response?.data,
                };

                throw Object.assign(errorObject);
            });
    }

If anyone has some advice on why that getStore is undefined in frontend-to-backend calls please assist. Thanks all!


问:
How to send wordpress password reset email using api in python?
I am going to send a password reset email in wordpress using python. Despite the search I made for this issue, I did not find a suitable solution.
Of course, in WooCommerce it is possible to send and receive some information in WordPress, which I have used before (here).
But now I'm looking for a way to send a password recovery email.

If we are going to use WooCommerce, it is necessary to connect to it first.

```<code>def wp_connection():
    wcapi = API(
        url=settings.WORDPRESS_URL,
        consumer_key=settings.WORDPRESS_CUSTOMER_KEY,
        consumer_secret=settings.WORDPRESS_CUSTOMER_SECRET,
        wp_api=True,
        version="wc/v3",
    )
    return wcapi
</code>```

But after this step, I have no idea to continue.

Body:
I am going to send a password reset email in wordpress using python. Despite the search I made for this issue, I did not find a suitable solution.
Of course, in WooCommerce it is possible to send and receive some information in WordPress, which I have used before (here).
But now I'm looking for a way to send a password recovery email.

If we are going to use WooCommerce, it is necessary to connect to it first.

def wp_connection():
    wcapi = API(
        url=settings.WORDPRESS_URL,
        consumer_key=settings.WORDPRESS_CUSTOMER_KEY,
        consumer_secret=settings.WORDPRESS_CUSTOMER_SECRET,
        wp_api=True,
        version="wc/v3",
    )
    return wcapi

But after this step, I have no idea to continue.


问:
kafka-pyspark: Kafka local installation becomes non-responsive while reading messages
I have a local Apache Kafka installation, and I am trying to read streaming messages (offsets set to earliest), but the pyspark code becomes non-responsive even when I am pushing messages from another shell. Following logs are the only ones I can see in the console:

```<code>Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
22/12/12 02:08:31 WARN scheduler.FairSchedulableBuilder: Fair Scheduler configuration file not found so jobs will be scheduled in FIFO order. To use fair scheduling, configure pools in fairscheduler.xml or set spark.scheduler.allocation.file to a file that contains the configuration.
22/12/12 02:08:36 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:37 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:44 WARN cluster.YarnSchedulerBackend$YarnSchedulerEndpoint: Attempted to request executors before the AM has registered!
2022-12-12 02:08:44,981 - spark - INFO - Initiated Spark Session
2022-12-12 02:08:56,471 - stream - INFO - Writing to Console
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
[Stage 0:>                                                          (0 + 1) / 1]
22/12/12 02:13:57 WARN internals.AbstractCoordinator: [Consumer clientId=consumer-1, groupId=spark-kafka-source-da2c6a76-b603-44ac-9db3-b8f4022a2044--500293921-driver-0] This member will leave the group because consumer poll timeout has expired. This means the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time processing messages. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size of batches returned in poll() with max.poll.records.
[Stage 0:>                                                          (0 + 1) / 1]
</code>```

My server.properties is:

```<code>broker.id=1
group.initial.rebalance.delay.ms=0
listeners=PLAINTEXT://:9092
log.dirs=/home/aiman/kafka_local/kafka_2.11-2.0.0/kafka-logs
log.retention.check.interval.ms=300000
log.retention.hours=168
log.segment.bytes=1073741824
max.poll.interval.ms=5
num.io.threads=8
num.network.threads=3
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
session.timeout.ms=3
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
socket.send.buffer.bytes=102400
transaction.state.log.min.isr=1
transaction.state.log.replication.factor=1
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000
</code>```

My py-spark code is:

```<code>kafka_config = { 'checkpointLocation': '/user/aiman/checkpoint/kafka_local',
                 'kafka.bootstrap.servers': 'localhost:9092',
                 'subscribe': 'TEST_1',
                 'startingOffsets': '{"TEST_1":{"0":3}}'
               }
df = spark.readStream \
          .format("kafka") \
          .options(**kafka_config) \
          .load()
data = df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)","offset","timestamp","partition")

data.writeStream \
    .format("console") \
    .outputMode("append") \
    .option("truncate", False) \
    .start() \
    .awaitTermination()
</code>```

Is there anything specific that I need to set in server.properties?

Body:
I have a local Apache Kafka installation, and I am trying to read streaming messages (offsets set to earliest), but the pyspark code becomes non-responsive even when I am pushing messages from another shell. Following logs are the only ones I can see in the console:

Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
22/12/12 02:08:31 WARN scheduler.FairSchedulableBuilder: Fair Scheduler configuration file not found so jobs will be scheduled in FIFO order. To use fair scheduling, configure pools in fairscheduler.xml or set spark.scheduler.allocation.file to a file that contains the configuration.
22/12/12 02:08:36 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:37 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:44 WARN cluster.YarnSchedulerBackend$YarnSchedulerEndpoint: Attempted to request executors before the AM has registered!
2022-12-12 02:08:44,981 - spark - INFO - Initiated Spark Session
2022-12-12 02:08:56,471 - stream - INFO - Writing to Console
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
22/12/12 02:08:56 WARN ipc.Client: Exception encountered while connecting to the server : org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error
[Stage 0:>                                                          (0 + 1) / 1]
22/12/12 02:13:57 WARN internals.AbstractCoordinator: [Consumer clientId=consumer-1, groupId=spark-kafka-source-da2c6a76-b603-44ac-9db3-b8f4022a2044--500293921-driver-0] This member will leave the group because consumer poll timeout has expired. This means the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time processing messages. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size of batches returned in poll() with max.poll.records.
[Stage 0:>                                                          (0 + 1) / 1]

My server.properties is:

broker.id=1
group.initial.rebalance.delay.ms=0
listeners=PLAINTEXT://:9092
log.dirs=/home/aiman/kafka_local/kafka_2.11-2.0.0/kafka-logs
log.retention.check.interval.ms=300000
log.retention.hours=168
log.segment.bytes=1073741824
max.poll.interval.ms=5
num.io.threads=8
num.network.threads=3
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
session.timeout.ms=3
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
socket.send.buffer.bytes=102400
transaction.state.log.min.isr=1
transaction.state.log.replication.factor=1
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000

My py-spark code is:

kafka_config = { 'checkpointLocation': '/user/aiman/checkpoint/kafka_local',
                 'kafka.bootstrap.servers': 'localhost:9092',
                 'subscribe': 'TEST_1',
                 'startingOffsets': '{"TEST_1":{"0":3}}'
               }
df = spark.readStream \
          .format("kafka") \
          .options(**kafka_config) \
          .load()
data = df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)","offset","timestamp","partition")

data.writeStream \
    .format("console") \
    .outputMode("append") \
    .option("truncate", False) \
    .start() \
    .awaitTermination()

Is there anything specific that I need to set in server.properties?


问:
REGA OPA don't add duplicate values to array
I am trying to do validations , some duplicate keys should not be available in yaml object,
so when I am trying to add the values in array it behaves like set and removes the duplicates.
I wanted to find out the duplicate key .

```<code>test:
 - name : someName
   code: SomeCode
 - name : someNameNew
   code: SomeCodeNew
 - name : someName
   code: SomeCodeNew

</code>```

So I want to fail OPA policy with the message someName is duplicate in yml

getListOfArray[arr] {

arr := test.name[_]

}

print(getListOfArray) gives  value [someName, someNameNew]

i am expecting [someName, someNameNew, someName]

Body:
I am trying to do validations , some duplicate keys should not be available in yaml object,
so when I am trying to add the values in array it behaves like set and removes the duplicates.
I wanted to find out the duplicate key .

test:
 - name : someName
   code: SomeCode
 - name : someNameNew
   code: SomeCodeNew
 - name : someName
   code: SomeCodeNew

So I want to fail OPA policy with the message someName is duplicate in yml

getListOfArray[arr] {

arr := test.name[_]

}

print(getListOfArray) gives  value [someName, someNameNew]

i am expecting [someName, someNameNew, someName]


问:
basePath is being added twice
I'm using next-auth v4. I'm using a custom route for the next-auth api. The configuration is as follows.

.env

```<code>NEXTAUTH_URL=http://localhost:3000/api/nextauth
</code>```

_app.js

```<code>function MyApp({ Component, pageProps: { session, ...pageProps } }) {
  if (Component.getLayout) {
    return Component.getLayout(<Component {...pageProps} />);
  }

  return (
    <SessionProvider session={session} basePath="/api/nextauth">
      <Component {...pageProps} />
    </SessionProvider>
  );
}
</code>```

But when I try and sign-in with google account, the redirect uri ends up being http://localhost:3000/api/nextauth/api/nextauth/callback/google instead of http://localhost:3000/api/nextauth/callback/google where the basePath is being appended twice and not once.

Am I missing something?

Title: basePath is being added twice

Body:
I'm using next-auth v4. I'm using a custom route for the next-auth api. The configuration is as follows.

.env

NEXTAUTH_URL=http://localhost:3000/api/nextauth

_app.js

function MyApp({ Component, pageProps: { session, ...pageProps } }) {
  if (Component.getLayout) {
    return Component.getLayout(<Component {...pageProps} />);
  }

  return (
    <SessionProvider session={session} basePath="/api/nextauth">
      <Component {...pageProps} />
    </SessionProvider>
  );
}

But when I try and sign-in with google account, the redirect uri ends up being http://localhost:3000/api/nextauth/api/nextauth/callback/google instead of http://localhost:3000/api/nextauth/callback/google where the basePath is being appended twice and not once.

Am I missing something?


问:
How to upload sourcemaps to sentry using webpack & nextjs?
Sentry displays minified JavaScript code instead of original one.

Here is report in Sentry:

Here is my original code:

I set Sentry's Next.js through wizard with

```<code>npx @sentry/wizard -i nextjs.
</code>```

Then I had to update next.config.js for the needs of the project. This is my next.config.js

```<code>const { withRNV } = require('@rnv/engine-rn-next');
const path = require('path');
const fs = require('fs');
const { withSentryConfig } = require('@sentry/nextjs');

const getPackageVersion = () => {
    const manifest = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf8'));
    return manifest.version;
};

const config = {
    compress: false,
    webpack: (cfg, { isServer }) => {
        if (!isServer) cfg.resolve.alias['@sentry/node'] = '@sentry/browser';
        cfg.module.rules.push({
            test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
            use: {
                loader: 'url-loader',
                options: {
                    limit: 100000,
                    name: '[name].[ext]',
                },
            },
        });
        return cfg;
    },
    typescript: {
        ignoreBuildErrors: true,
    },
    publicRuntimeConfig: {
        deployEnv: process.env.DEPLOY_ENV || 'Development',
        customScripts: [],
    },

    images: {
        loader: 'akamai',
        path: '',
    },
    async headers() {
        return [
            {
                source: '/(.*)',
                headers: [
                    {
                        key: 'X-Application-Version',
                        value: getPackageVersion(),
                    },
                    {
                        key: 'access-control-allow-origin',
                        value: '*',
                    },
                ],
            },
        ];
    },
    experimental: {
        outputStandalone: true,
    },
};

module.exports = withSentryConfig(
    withRNV(config, {
        enableNextCss: false,
        enableOptimizedImages: true,
    })
);
</code>```

I am using:

```<code>"next": "12.0.9",
"@sentry/nextjs": "7.20.0",
</code>```

What can be root cause of wrong Sentry report?
Appreciate any help.

Body:
Sentry displays minified JavaScript code instead of original one.

Here is report in Sentry:

Here is my original code:

I set Sentry's Next.js through wizard with

npx @sentry/wizard -i nextjs.

Then I had to update next.config.js for the needs of the project. This is my next.config.js

const { withRNV } = require('@rnv/engine-rn-next');
const path = require('path');
const fs = require('fs');
const { withSentryConfig } = require('@sentry/nextjs');

const getPackageVersion = () => {
    const manifest = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf8'));
    return manifest.version;
};

const config = {
    compress: false,
    webpack: (cfg, { isServer }) => {
        if (!isServer) cfg.resolve.alias['@sentry/node'] = '@sentry/browser';
        cfg.module.rules.push({
            test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
            use: {
                loader: 'url-loader',
                options: {
                    limit: 100000,
                    name: '[name].[ext]',
                },
            },
        });
        return cfg;
    },
    typescript: {
        ignoreBuildErrors: true,
    },
    publicRuntimeConfig: {
        deployEnv: process.env.DEPLOY_ENV || 'Development',
        customScripts: [],
    },

    images: {
        loader: 'akamai',
        path: '',
    },
    async headers() {
        return [
            {
                source: '/(.*)',
                headers: [
                    {
                        key: 'X-Application-Version',
                        value: getPackageVersion(),
                    },
                    {
                        key: 'access-control-allow-origin',
                        value: '*',
                    },
                ],
            },
        ];
    },
    experimental: {
        outputStandalone: true,
    },
};

module.exports = withSentryConfig(
    withRNV(config, {
        enableNextCss: false,
        enableOptimizedImages: true,
    })
);

I am using:

"next": "12.0.9",
"@sentry/nextjs": "7.20.0",

What can be root cause of wrong Sentry report?
Appreciate any help.


问:
Facebook API find corresponding Page by Ad id
I'm trying to retrieve all the ad spent values for my facebook posts through the Facebook Graph API. I went from Business => Owned Ad Accounts => Ad Account => Campaign => Ad set => Ad, but now I can't find the page id or the ad spent value anywhere.

Read through this link  and tried https://graph.facebook.com/v15.0/{AD_ID}


问:
Spring boot serving only one request at a time
I am using spring boot 2.7.6 with tomcat version 9.0.69

My code

```<code>@GetMapping("/start")
    public String demo() {
        Response output = null;
        System.out.println("Inside API");

        InputRequest request = new InputRequest();
        request.setType("type1");
        request.setSize(50);
        request.setPageType("page1");

        for(int i = 0 ; i<10000000; i++) {
            System.out.println("ankit "+i);
        }

        System.out.println("Inside done");

        return "Success";

    }
</code>```

When I am hitting the controller multiple times using URL: http://localhost:8000/start, then at a time only one requesting is served.

Other requests are served when first one is completed. I got to know this from log I put.
I hit the start endpoint 10 times from 10 different browser window and output is :

```<code>Inside API
Inside Done
Inside API
Inside Done
Inside API
Inside Done
Inside API
Inside Done
..
</code>```

Ideally it should be

```<code>Inside API
Inside API
Inside API
Inside API
...
</code>```

What am I missing.  NO config in properties file. Using java 1.8

Body:
I am using spring boot 2.7.6 with tomcat version 9.0.69

My code

@GetMapping("/start")
    public String demo() {
        Response output = null;
        System.out.println("Inside API");

        InputRequest request = new InputRequest();
        request.setType("type1");
        request.setSize(50);
        request.setPageType("page1");

        for(int i = 0 ; i<10000000; i++) {
            System.out.println("ankit "+i);
        }

        System.out.println("Inside done");

        return "Success";

    }

When I am hitting the controller multiple times using URL: http://localhost:8000/start, then at a time only one requesting is served.

Other requests are served when first one is completed. I got to know this from log I put.
I hit the start endpoint 10 times from 10 different browser window and output is :

Inside API
Inside Done
Inside API
Inside Done
Inside API
Inside Done
Inside API
Inside Done
..

Ideally it should be

Inside API
Inside API
Inside API
Inside API
...

What am I missing.  NO config in properties file. Using java 1.8


问:
What is the correct way to configure a vite project for multiple customers?
I have this website builder created in vite-react.

I sell it to many customers.

It needs to know the API address.

If I use .env file, then that the configuration is hardcoded for one customer.

I can think of creating my own settings file and dynamically read configuration from there.

But is there a known library for that?

What is the correct way to handle this situation?

Right now, what I do is to change the .env file for a customer, build the project, deploy it, and change the .env file for the next customer. For any change, I need to do this manaully.


问:
Handling external backend error messages in next.js
I am migrating from Create React App to Next and I'm trying to access my custom error messages I get through external backend calls with the help of redux actions, but instead I get back the default next.js 404 page HTML:

```<code>    return axios.post(...)
        .then(res => {other code...})

        .catch(err => {
           console.log(err) //Here I get the 404 page HTML, earlier I got my custom message from the backend
         })
</code>```

Is there a way I can access it back?

I tried logging the err and got back the HTML, while I was expecting my same old error message.

Body:
I am migrating from Create React App to Next and I'm trying to access my custom error messages I get through external backend calls with the help of redux actions, but instead I get back the default next.js 404 page HTML:

    return axios.post(...)
        .then(res => {other code...})

        .catch(err => {
           console.log(err) //Here I get the 404 page HTML, earlier I got my custom message from the backend
         })

Is there a way I can access it back?

I tried logging the err and got back the HTML, while I was expecting my same old error message.