问:
How to create a close source SDK for iOS with other framework dependencies
I have multiple projects that build into XCFramework. For example:

FeatureA.xcframework

FeatureB.xcframework

FeatureC.xcframework

When I build MySDK, it produces a .xcframework with a "frameworks" folder in it. FeatureA, B and C are inside that folder. This means that the frameworks were embeded.

But, when I add MySDK into another project and try to build I get: no such module "FeatureA" OR Could not build "FeatureA" to Objc.

The only way that my test project builds is by adding each .xcframework dependency. I tried using the search paths, but no luck.

I also tried change the modulemap file, but the error describe above continues.

I want to build a SDK, MySDK.xcframework that contains all depencency frameworks. In this way I hope that someone who wants to use my library will only have to import MySDK.xcframework.

What I want is even possible for iOS?


来源: stackexchange

问:
"Program received signal SIGSEGV: Segmentation fault - invalid memory reference." when using large-size array and MPI_BARRIER
I used Fortran with MPI (CRAY's compiler) for my code.  I used 512 cores, and I found that as my variable exceeds certain size, the code crashed at MPI_BARRIER, and the error message is

```<code>Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
.
.
.
</code>```

One possibly useful information is that I print out a tag (i.e., write(,) "tag") before conducting MPI_BARRIER, and I found that the number of outputted tags (426) plus the number of the repeated error messages (86) is equal to the cores I used (512).

I think this is memory issue.  I use slurm to submit my job, and I remember I've tried something like "ulimit -s unlimited" (couldn't find the web now...), but I haven't been able to solve this problem.

ContentLicense: CC BY-SA 4.0

Body:
I used Fortran with MPI (CRAY's compiler) for my code.  I used 512 cores, and I found that as my variable exceeds certain size, the code crashed at MPI_BARRIER, and the error message is

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
.
.
.

One possibly useful information is that I print out a tag (i.e., write(,) "tag") before conducting MPI_BARRIER, and I found that the number of outputted tags (426) plus the number of the repeated error messages (86) is equal to the cores I used (512).

I think this is memory issue.  I use slurm to submit my job, and I remember I've tried something like "ulimit -s unlimited" (couldn't find the web now...), but I haven't been able to solve this problem.


问:
Subprocess Popen to call a tasks file python which cannot able to load models in Django
I have Django app ..we have several tasks file(stored into tasks folder).
And we want to call those tasks file from views.py

Now when we call

```<code>p = Popen("python","./tasks/task1.py", "jobid", stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output_filename, err = p.communicate(b"input data that is passed to subprocess' stdin")
</code>```

now in task1.py

```<code>from app.models import Job #its throwing error
</code>```

It cannot import Models into task1.py where I have sent job id

```<code>from app.models import Job\r\nModuleNotFoundError: No module named \'app\'\r\n
</code>```

Folder structure

```<code>project
 |-app
    |-models.py
    |-views.py
 |-tasks
    |- task1.py
</code>```

Body:
I have Django app ..we have several tasks file(stored into tasks folder).
And we want to call those tasks file from views.py

Now when we call

p = Popen("python","./tasks/task1.py", "jobid", stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output_filename, err = p.communicate(b"input data that is passed to subprocess' stdin")

now in task1.py

from app.models import Job #its throwing error

It cannot import Models into task1.py where I have sent job id

from app.models import Job\r\nModuleNotFoundError: No module named \'app\'\r\n

Folder structure

project
 |-app
    |-models.py
    |-views.py
 |-tasks
    |- task1.py


问:
iOS app recompile for MacOS can't share on Catalina
I new to Swift, so I'm looking for help.

I'm working in an app for iOS that shows a list of data that you can share through the system share. I recompile the app to Work in MacOS too. On iOS works perfect, in my Ventura Mac works fine also... but when I tried to make it work on Catalina, it just don't show the menu, and even the button get grayed out like it get pushed and never released. The code is this:

```<code>    @IBAction func shareRecord(_ sender: Any) {
        if resultado == ""{
            print("No Item Selected")
        }else{
            print("Reenviando \(resultado)")
            let text = resultado
            let textToShare = [ text ]
            let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
            activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
            self.present(activityViewController, animated: true, completion: nil)
        }
    }
</code>```

So, any ideas?

I tried several times, but nothing shows, I expect to a menu with options appears.

Body:
I new to Swift, so I'm looking for help.

I'm working in an app for iOS that shows a list of data that you can share through the system share. I recompile the app to Work in MacOS too. On iOS works perfect, in my Ventura Mac works fine also... but when I tried to make it work on Catalina, it just don't show the menu, and even the button get grayed out like it get pushed and never released. The code is this:

    @IBAction func shareRecord(_ sender: Any) {
        if resultado == ""{
            print("No Item Selected")
        }else{
            print("Reenviando \(resultado)")
            let text = resultado
            let textToShare = [ text ]
            let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
            activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
            self.present(activityViewController, animated: true, completion: nil)
        }
    }

So, any ideas?

I tried several times, but nothing shows, I expect to a menu with options appears.


问:
Linux or WSL2 does not make requests with large BODY
My setup, I have a Win11 machine with WSL2 running docker, I have a container of my Laravel application that when making HTTP requests if the body is too big, it gives an error, but the error is generic, it doesn't say it's the size, see:

Laravel application error: cURL error 28: Operation timed out after 60001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for "https://example.com".

So I made the request outside the application and the container, directly in WSL2 with Curl, command:
curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json
Command error on WSL2:

Bad request!

     Your browser (or proxy) sent a request that
     this server could not understand.

     If you think this is a server error, please contact
     the webmaster.

```

But I don't think it's the server/url/api, because if I make this request from anywhere else it works, for example through Postaman I sent a body 5 times bigger and it worked and if I run this same command in the terminal from Windows11 it works, same command and same body, but now running from outside WSL (windows cmd, same computer):
curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json works successfully.

What could it be? I've been looking for a solution for over 20 hours.

Body:
My setup, I have a Win11 machine with WSL2 running docker, I have a container of my Laravel application that when making HTTP requests if the body is too big, it gives an error, but the error is generic, it doesn't say it's the size, see:

Laravel application error: cURL error 28: Operation timed out after 60001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for "https://example.com".

So I made the request outside the application and the container, directly in WSL2 with Curl, command:
curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json
Command error on WSL2:

Bad request!

     Your browser (or proxy) sent a request that
     this server could not understand.

     If you think this is a server error, please contact
     the webmaster.

But I don't think it's the server/url/api, because if I make this request from anywhere else it works, for example through Postaman I sent a body 5 times bigger and it worked and if I run this same command in the terminal from Windows11 it works, same command and same body, but now running from outside WSL (windows cmd, same computer):
curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json works successfully.

What could it be? I've been looking for a solution for over 20 hours.


问:
Keyboard pushing up buttons in Stack
How do I add a scrollView without covering everything else up. I added .ignoresSafeArea(.keyboard) to the outer Stack to stop the keyboard from pushing my buttons at the bottom up but when I try to add a scrollView all that is displayed is the confirm and back buttons and navigation title and none of the form I want the user to scroll through and fill out</p>
```<code>import SwiftUI

struct NewEventView: View{

    @State private var newEventName: String = ""
    @State private var newEventAddress: String = ""
    @State private var newEventPrivacy: String = ""
    @State private var newEventMaxAttendents: String = ""
    @State private var newEventPrice: String = ""
    @State private var newEventNotes: String = ""
    @State private var newEventStartTime = Date.now
    @State private var newEventEndTime = Date()
    @State private var newEventStartDate = Date.now
    @State private var newEventEndDate = Date()
    @State private var newEventType: String = ""

    var body: some View{

        VStack{
            Text("New Event")
            List(){
                HStack{
                    Text("Event Name:   ")
                    TextField("Name", text: $newEventName)
                }
                HStack{
                    Text("Address:         ")
                    TextField("Address", text: $newEventAddress)
                }
                HStack{
                    Picker(selection: $newEventPrivacy, label: Text("Privacy:         ")) {
                        Text("Public ").tag("1")
                        Text("Private").tag("2")
                    }
                    .fixedSize()
                    .scaledToFit()
                }
                HStack{
                    Text("Attendance:    ")
                    TextField("Max Attendents", text: $newEventMaxAttendents)
                }
                HStack{
                    DatePicker("Start Date    ", selection: $newEventStartDate, displayedComponents: [.date])
                }
                .scaledToFit()
                HStack{
                    DatePicker("Start Time    ", selection: $newEventStartTime, displayedComponents: [.hourAndMinute])
                }
                .scaledToFit()
                HStack{
                    DatePicker("End Date      ", selection: $newEventEndDate, displayedComponents: [.date])
                }
                .scaledToFit()
                HStack{
                    DatePicker("End Time      ", selection: $newEventEndTime, displayedComponents: [.hourAndMinute])
                }
                .scaledToFit()
                HStack{
                    Text("Price               ")
                    TextField("Price", text: $newEventPrice)
                }
                HStack{
                    Picker(selection: $newEventType, label: Text("Type            ")) {
                        Text("Private   ").tag("1")
                        Text("Education ").tag("2")
                        Text("Concert   ").tag("3")
                        Text("Festival  ").tag("4")
                        Text("Food      ").tag("5")
                        Text("Religious ").tag("6")
                        Text("Attraction").tag("7")
                        Text("Business  ").tag("8")
                    }
                    .fixedSize()
                }
            }
                // HStack for confirm and cancel buttons
                HStack{
                    // BASH button
                    Button(action: {
                        print("Confirm")

                    }, label: {
                        Text("Confirm")
                            .font(.headline)
                            .fontWeight(.semibold)
                            .foregroundColor(.white)
                            .padding()
                            .padding(.horizontal, 20)
                            .background{
                                Color.red
                                    .cornerRadius(10)
                                    .shadow(radius: 5)
                            }
                    }) // confirm button

                    // back button
                    Button(action: {
                        print("Back")

                    }, label: {
                        Text("  Back   ")
                            .font(.headline)
                            .fontWeight(.semibold)
                            .foregroundColor(.white)
                            .padding()
                            .padding(.horizontal, 20)
                            .background{
                                Color.red
                                    .cornerRadius(10)
                                    .shadow(radius: 5)
                            }
                    }) // BASH button
                } // HStack for confirm and back buttons
            } // VStack
            .ignoresSafeArea(.keyboard)
        } // View

    }
</code>```

Title: Keyboard pushing up buttons in Stack

Body:
How do I add a scrollView without covering everything else up. I added .ignoresSafeArea(.keyboard) to the outer Stack to stop the keyboard from pushing my buttons at the bottom up but when I try to add a scrollView all that is displayed is the confirm and back buttons and navigation title and none of the form I want the user to scroll through and fill out

import SwiftUI

struct NewEventView: View{

    @State private var newEventName: String = ""
    @State private var newEventAddress: String = ""
    @State private var newEventPrivacy: String = ""
    @State private var newEventMaxAttendents: String = ""
    @State private var newEventPrice: String = ""
    @State private var newEventNotes: String = ""
    @State private var newEventStartTime = Date.now
    @State private var newEventEndTime = Date()
    @State private var newEventStartDate = Date.now
    @State private var newEventEndDate = Date()
    @State private var newEventType: String = ""

    var body: some View{

        VStack{
            Text("New Event")
            List(){
                HStack{
                    Text("Event Name:   ")
                    TextField("Name", text: $newEventName)
                }
                HStack{
                    Text("Address:         ")
                    TextField("Address", text: $newEventAddress)
                }
                HStack{
                    Picker(selection: $newEventPrivacy, label: Text("Privacy:         ")) {
                        Text("Public ").tag("1")
                        Text("Private").tag("2")
                    }
                    .fixedSize()
                    .scaledToFit()
                }
                HStack{
                    Text("Attendance:    ")
                    TextField("Max Attendents", text: $newEventMaxAttendents)
                }
                HStack{
                    DatePicker("Start Date    ", selection: $newEventStartDate, displayedComponents: [.date])
                }
                .scaledToFit()
                HStack{
                    DatePicker("Start Time    ", selection: $newEventStartTime, displayedComponents: [.hourAndMinute])
                }
                .scaledToFit()
                HStack{
                    DatePicker("End Date      ", selection: $newEventEndDate, displayedComponents: [.date])
                }
                .scaledToFit()
                HStack{
                    DatePicker("End Time      ", selection: $newEventEndTime, displayedComponents: [.hourAndMinute])
                }
                .scaledToFit()
                HStack{
                    Text("Price               ")
                    TextField("Price", text: $newEventPrice)
                }
                HStack{
                    Picker(selection: $newEventType, label: Text("Type            ")) {
                        Text("Private   ").tag("1")
                        Text("Education ").tag("2")
                        Text("Concert   ").tag("3")
                        Text("Festival  ").tag("4")
                        Text("Food      ").tag("5")
                        Text("Religious ").tag("6")
                        Text("Attraction").tag("7")
                        Text("Business  ").tag("8")
                    }
                    .fixedSize()
                }
            }
                // HStack for confirm and cancel buttons
                HStack{
                    // BASH button
                    Button(action: {
                        print("Confirm")

                    }, label: {
                        Text("Confirm")
                            .font(.headline)
                            .fontWeight(.semibold)
                            .foregroundColor(.white)
                            .padding()
                            .padding(.horizontal, 20)
                            .background{
                                Color.red
                                    .cornerRadius(10)
                                    .shadow(radius: 5)
                            }
                    }) // confirm button

                    // back button
                    Button(action: {
                        print("Back")

                    }, label: {
                        Text("  Back   ")
                            .font(.headline)
                            .fontWeight(.semibold)
                            .foregroundColor(.white)
                            .padding()
                            .padding(.horizontal, 20)
                            .background{
                                Color.red
                                    .cornerRadius(10)
                                    .shadow(radius: 5)
                            }
                    }) // BASH button
                } // HStack for confirm and back buttons
            } // VStack
            .ignoresSafeArea(.keyboard)
        } // View

    }


问:
White circle in notification Samsung s22 ultra, android 13. (Flutter, awesome_notifications)
After the update to android 13, the background color for notifications is not working, the color is always white.

```<code>
await AwesomeNotifications().createNotification(
      content: NotificationContent(
        id: 100,
        channelKey: 'scheduled_channel',
        title: 'Hello',
        body: 'This is a sample notification.',
        notificationLayout: NotificationLayout.Default,
        icon: icon,
        backgroundColor: Colors.red,
        color: Colors.red,
      ),
    );

</code>```

This happens only in this version and this device. Android 13 in the emulator works.

There are some posts on other forums where people talk about some apps modifying the default theme, but this is not the case.

https://www.reddit.com/r/GalaxyS22/comments/yczni0/anyone_else_getting_blank_icons_for_notifications/

https://www.reddit.com/r/GalaxyS21/comments/yrgabv/notification_bug_after_oneui_update_all/

Body:
After the update to android 13, the background color for notifications is not working, the color is always white.

await AwesomeNotifications().createNotification(
      content: NotificationContent(
        id: 100,
        channelKey: 'scheduled_channel',
        title: 'Hello',
        body: 'This is a sample notification.',
        notificationLayout: NotificationLayout.Default,
        icon: icon,
        backgroundColor: Colors.red,
        color: Colors.red,
      ),
    );

This happens only in this version and this device. Android 13 in the emulator works.

There are some posts on other forums where people talk about some apps modifying the default theme, but this is not the case.

https://www.reddit.com/r/GalaxyS22/comments/yczni0/anyone_else_getting_blank_icons_for_notifications/

https://www.reddit.com/r/GalaxyS21/comments/yrgabv/notification_bug_after_oneui_update_all/


问:
Google Sheets Script on Form sumbission
I have a working script for Google sheets that checks 3 columns with trues and falses and writes baked TRUE/FALSE value for a 4th column when new data is entered.

```<code>function onEdit() {
var s = SpreadsheetApp.getActiveSheet(); if(s.getName() == "test" ) { //checks that we're on the right sheet
var r = s.getActiveCell();
if(r.getColumn() == 1) { //checks that the cell being edited is in column A
var trgtCell = r.offset(0, 7);
if(r.offset(0, 5) == "TRUE" && r.offset(0, 6) == "TRUE" && trgtCell.getValue() === ' ') //checks the rule + if the target (trgt) cell is empty
trgtCell.setValue("TRUE");
 } else {
trgtCell.setValue("FALSE");
}}}
</code>```

The sheet is connected with more Google Forms.

Now my script only works when data is manually entered but when the relevant form is submitted, it creates a new row and my script does not get active. I guess because it only triggers by "edit" which I guess is manually editing the sheets.

Can anyone help me how I could convert the script to work when form is submitted? That would be my main goal.

Title: Google Sheets Script on Form sumbission

Body:
I have a working script for Google sheets that checks 3 columns with trues and falses and writes baked TRUE/FALSE value for a 4th column when new data is entered.

function onEdit() {
var s = SpreadsheetApp.getActiveSheet(); if(s.getName() == "test" ) { //checks that we're on the right sheet
var r = s.getActiveCell();
if(r.getColumn() == 1) { //checks that the cell being edited is in column A
var trgtCell = r.offset(0, 7);
if(r.offset(0, 5) == "TRUE" && r.offset(0, 6) == "TRUE" && trgtCell.getValue() === ' ') //checks the rule + if the target (trgt) cell is empty
trgtCell.setValue("TRUE");
 } else {
trgtCell.setValue("FALSE");
}}}

The sheet is connected with more Google Forms.

Now my script only works when data is manually entered but when the relevant form is submitted, it creates a new row and my script does not get active. I guess because it only triggers by "edit" which I guess is manually editing the sheets.

Can anyone help me how I could convert the script to work when form is submitted? That would be my main goal.


问:
Writing into word document with different font sizes, etc
I am trying to pick string values from different Excel worksheets and write it into Word. However, each text line will have different font size, bold and underline.

I managed to pull all values into Word with StringBuilder, however I am not able to format each line way I wanted, therefore trying to make other solution without StringBuilder.

Please see code below. Unfortunately, the end result has only the last row of Excel sheet value.

Anyone has idea, what I can do here:

```<code>for (int c = 0; c < aList.Count; c++)
{
    Worksheet excelWorksheet = excelWorkbook.Worksheets[aList[c]];
    Microsoft.Office.Interop.Excel.Range lastRow = excelWorksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell);
    int lastUsedRow = lastRow.Row;
    currentItemNumber = "Item " + (c + 1).ToString();

    docRange.Text = currentItemNumber;
    docRange.Font.Bold = 1;
    docRange.Font.Size = 12;
    docRange.Font.Underline = (WdUnderline)1;
    docWholeRange.Text = docRange.Text;

    for (int d = 0; d < lastUsedRow; d++)
    {
        if (d == 0)
        {
            currentRowValue = excelWorksheet.Range["A" + (d + 1)].Value2 + "\t" + excelWorksheet.Range["D"+(d+1)].Value2;
            docRange.Text = currentRowValue;
            docRange.Font.Bold = 0;
            docRange.Font.Size = 12;
            docRange.Font.Underline = (WdUnderline)0;
            docWholeRange.Text = docWholeRange.Text + docRange.Text;
        }
        else
        {
            currentRowValue = excelWorksheet.Range["A" + (d + 1)].Value2+ excelWorksheet.Range["B" + (d + 1)].Value2+ excelWorksheet.Range["C" + (d + 1)].Value2;

            docRange.Text = currentRowValue;
            docRange.Font.Bold = 0;
            docRange.Font.Size = 10;
            docRange.Font.Underline = (WdUnderline)0;
            docWholeRange.Text = docWholeRange.Text + docRange.Text;
        }
    }

    wordDocument.Bookmarks.Add(bookmarkPlace, docWholeRange);
}
</code>```

I tried using StringBuilder, however it is not possible to format each line separately and keep it formatted.

Then tried using Selection object in similar manner as shown in code and then tried to use Selection.TypeText. Instead of being entered at Bookmark place, it was actually starting from the beginning of word file. The size of the letter was way too small.

Managed to get all lines correctly to be written in Word without using StringBuilder.
However, trying to get all text lines between two bookmarks and all samples advising to use Bookmarks.get_Item and this does not exists in Visual Studio 2019 and C#.
Anyone has idea, how to store it into Range?
Tried following:

```<code>object start = bm.Range.End;
object end = ebm.Range.Start;

Microsoft.Office.Interop.Word.Range textRange = wordDocument.Range(ref start, ref end);
</code>```

bm and ebm are two bookmarks.
I am trying to store all text line into range, then iterate line by line and change font size/bold in each text line.
Anyone has better idea how it can be done.
Regards,

Body:
I am trying to pick string values from different Excel worksheets and write it into Word. However, each text line will have different font size, bold and underline.

I managed to pull all values into Word with StringBuilder, however I am not able to format each line way I wanted, therefore trying to make other solution without StringBuilder.

Please see code below. Unfortunately, the end result has only the last row of Excel sheet value.

Anyone has idea, what I can do here:

for (int c = 0; c < aList.Count; c++)
{
    Worksheet excelWorksheet = excelWorkbook.Worksheets[aList[c]];
    Microsoft.Office.Interop.Excel.Range lastRow = excelWorksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell);
    int lastUsedRow = lastRow.Row;
    currentItemNumber = "Item " + (c + 1).ToString();

    docRange.Text = currentItemNumber;
    docRange.Font.Bold = 1;
    docRange.Font.Size = 12;
    docRange.Font.Underline = (WdUnderline)1;
    docWholeRange.Text = docRange.Text;

    for (int d = 0; d < lastUsedRow; d++)
    {
        if (d == 0)
        {
            currentRowValue = excelWorksheet.Range["A" + (d + 1)].Value2 + "\t" + excelWorksheet.Range["D"+(d+1)].Value2;
            docRange.Text = currentRowValue;
            docRange.Font.Bold = 0;
            docRange.Font.Size = 12;
            docRange.Font.Underline = (WdUnderline)0;
            docWholeRange.Text = docWholeRange.Text + docRange.Text;
        }
        else
        {
            currentRowValue = excelWorksheet.Range["A" + (d + 1)].Value2+ excelWorksheet.Range["B" + (d + 1)].Value2+ excelWorksheet.Range["C" + (d + 1)].Value2;

            docRange.Text = currentRowValue;
            docRange.Font.Bold = 0;
            docRange.Font.Size = 10;
            docRange.Font.Underline = (WdUnderline)0;
            docWholeRange.Text = docWholeRange.Text + docRange.Text;
        }
    }

    wordDocument.Bookmarks.Add(bookmarkPlace, docWholeRange);
}

I tried using StringBuilder, however it is not possible to format each line separately and keep it formatted.

Then tried using Selection object in similar manner as shown in code and then tried to use Selection.TypeText. Instead of being entered at Bookmark place, it was actually starting from the beginning of word file. The size of the letter was way too small.

Managed to get all lines correctly to be written in Word without using StringBuilder.
However, trying to get all text lines between two bookmarks and all samples advising to use Bookmarks.get_Item and this does not exists in Visual Studio 2019 and C#.
Anyone has idea, how to store it into Range?
Tried following:

object start = bm.Range.End;
object end = ebm.Range.Start;

Microsoft.Office.Interop.Word.Range textRange = wordDocument.Range(ref start, ref end);

bm and ebm are two bookmarks.
I am trying to store all text line into range, then iterate line by line and change font size/bold in each text line.
Anyone has better idea how it can be done.
Regards,


问:
Can I run a Bluetooth Central in Background in my WatchKit app while supporting WatchOS version < 8?
As of WatchOS 9 a WatchKit app can receive alerts via Bluetooth in background. This is really great for my use case.

However, apps running on watchOS 7 or earlier need a special entitlement for this that is not available for most apps and won't be available to mine.

The problem is > 10% of the active user base for this app has an Apple Watch series 2 or earlier. These devices are not compatible with watchOS 8. So raising the minimum target to >= 8 is not ideal.

If I ship the app without changing the target will:

the app pass review?

And will it work for those on < watchOS 8 (just with bg BLE disabled)?

Here is a message I got on this topic at build validation:

Missing entitlement. The Info.plist for the watchOS app bundle at
“--Redacted--” uses the bluetooth-central value for UIBackgroundModes
without the com.apple.developer.bluetooth-central-background
entitlement signed into the bundle. We encourage you to add the
entitlement to the app’s entitlements list, or set the watchOS
deployment target to 8.0 or later to use Bluetooth during Background
App Refresh.


问:
miniconda/pkgs taking up a lot of space
I have run out of disk space on my cluster machine. Doing
du -h --max-depth=20 | sort -hr > size_of_folders.txt
reveals that there is a directory called ./miniconda3/pkgs that is taking up 22Gbs.
Looking in this folder at the subfolders, I don't know what most of these . For example here are the top 50 entries:

804M    ./qt-main-5.15.4-ha5833f6_2

769M    ./qt-5.12.9-h1304e3e_6

629M    ./qt-5.9.7-h5867ecd_1

629M    ./cache

619M    ./qt-5.9.7-h0c104cb_3

482M    ./mkl-2020.2-256

481M    ./mkl-2020.2-256/lib

360M    ./qt-main-5.15.4-ha5833f6_2/include

359M    ./qt-main-5.15.4-ha5833f6_2/include/qt

343M    ./qt-5.12.9-h1304e3e_6/include/qt

343M    ./qt-5.12.9-h1304e3e_6/include

321M    ./qt-5.9.7-h5867ecd_1/include

321M    ./qt-5.9.7-h0c104cb_3/include

320M    ./qt-5.9.7-h5867ecd_1/include/qt

320M    ./qt-5.9.7-h0c104cb_3/include/qt

307M    ./libdb-6.2.32-h9c3ff4c_0

299M    ./libdb-6.2.32-h9c3ff4c_0/docs

244M    ./scipy-1.7.3-py310hea5193d_0

243M    ./scipy-1.7.3-py310hea5193d_0/lib/python3.10

243M    ./scipy-1.7.3-py310hea5193d_0/lib

242M    ./scipy-1.7.3-py310hea5193d_0/lib/python3.10/site-packages/scipy

242M    ./scipy-1.7.3-py310hea5193d_0/lib/python3.10/site-packages

221M    ./pandas-1.3.4-py310hb5077e9_1

220M    ./pandas-1.3.4-py310hb5077e9_1/lib/python3.10/site-packages

220M    ./pandas-1.3.4-py310hb5077e9_1/lib/python3.10

220M    ./pandas-1.3.4-py310hb5077e9_1/lib

219M    ./python-3.8.3-cpython_he5300dc_0

219M    ./pandas-1.3.4-py310hb5077e9_1/lib/python3.10/site-packages/pandas

199M    ./python-3.8.3-cpython_he5300dc_0/lib

196M    ./python-3.8.3-hcff3b4d_0

175M    ./python-3.8.3-hcff3b4d_0/lib

172M    ./pandas-1.4.1-py310hb5077e9_0
171M    ./pandas-1.4.1-py310hb5077e9_0/lib/python3.10/site-packages

171M    ./pandas-1.4.1-py310hb5077e9_0/lib/python3.10

171M    ./pandas-1.4.1-py310hb5077e9_0/lib

170M    ./pandas-1.4.3-py310h769672d_0

170M    ./pandas-1.4.2-py310h769672d_2

170M    ./pandas-1.4.1-py310hb5077e9_0/lib/python3.10/site-packages/pandas

169M    ./pandas-1.4.3-py310h769672d_0/lib/python3.10/site-packages

169M    ./pandas-1.4.3-py310h769672d_0/lib/python3.10

169M    ./pandas-1.4.3-py310h769672d_0/lib

169M    ./pandas-1.4.2-py310h769672d_2/lib/python3.10/site-packages

169M    ./pandas-1.4.2-py310h769672d_2/lib/python3.10

169M    ./pandas-1.4.2-py310h769672d_2/lib

168M    ./perl-5.32.1-1_h7f98852_perl5

168M    ./pandas-1.4.3-py310h769672d_0/lib/python3.10/site-packages/pandas

168M    ./pandas-1.4.2-py310h769672d_2/lib/python3.10/site-packages/pandas

166M    ./statsmodels-0.13.1-py310h96516ba_0

165M    ./statsmodels-0.13.1-py310h96516ba_0/lib/python3.10/site-packages   165M    ./statsmodels-0.13.1-py310h96516ba_0/lib/python3.10`

Can someone explain if these are deletable? These recognisable packages - such as pandas and scipy - have strange suffixes and I'm not sure if they're deletable.

I presume I can delete the cache but I'm not sure about the rest.

Title: miniconda/pkgs taking up a lot of space


问:
How can I exclude from a certain date in my dataset?
Given I have the following dataset:

```<code>     reference     country         date                   title     author  is_gov  text
0   r901128a_BOA    australia   1990-11-28 00:00:00     A Proper Role for Monetary Policy   fraser  0   They would no doubt argue that to have two obj...
1   r911003a_BOA    australia   1991-10-03 00:00:00         fraser  0   Today I wish to talk about real interest rates...
</code>```

The problem is briefly explained, I wish to include dates that are after or on Janaury 1st 2016. To do so, I've ran the following code:

```<code>import pandas as pd
import datetime as dt
df = pd.read_excel(r"C:...",parse_dates=['date'])
df1 = df[['reference','country','date','title','author','is_gov','text']].copy()

start = dt.datetime(2016,1,1)
df1 = df1[df1['date']>=start]
df1
</code>```

Upon running 6th line I receive the following error:

```<code>TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime'
</code>```

Body:
Given I have the following dataset:

     reference     country         date                   title     author  is_gov  text
0   r901128a_BOA    australia   1990-11-28 00:00:00     A Proper Role for Monetary Policy   fraser  0   They would no doubt argue that to have two obj...
1   r911003a_BOA    australia   1991-10-03 00:00:00         fraser  0   Today I wish to talk about real interest rates...

The problem is briefly explained, I wish to include dates that are after or on Janaury 1st 2016. To do so, I've ran the following code:

import pandas as pd
import datetime as dt
df = pd.read_excel(r"C:...",parse_dates=['date'])
df1 = df[['reference','country','date','title','author','is_gov','text']].copy()

start = dt.datetime(2016,1,1)
df1 = df1[df1['date']>=start]
df1

Upon running 6th line I receive the following error:

TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime'


问:
How to make datastructure for searching specific patterned data on large datasets
I have 100,000,000 string data.

000000001
000000002
.
.
.
100000000
```

All data will be loaded on database.
After that we should find patterned data.
If client requests data like having 2839, we have to show them x2839xxxx,xxxx2839x,xxxxx2839.

I think table should have index but I don't know how.
Pattern must 4 character. So I think I have to set index every 4 character from start to end.

What would be a better way?

Body:
I have 100,000,000 string data.

000000001
000000002
.
.
.
100000000

All data will be loaded on database.
After that we should find patterned data.
If client requests data like having 2839, we have to show them x2839xxxx,xxxx2839x,xxxxx2839.

I think table should have index but I don't know how.
Pattern must 4 character. So I think I have to set index every 4 character from start to end.

What would be a better way?


问:
The TS time of TD is at the millisecond level, it seems that the support is not enough
The TS time of TD is at the millisecond level. Now if there is an update mechanism, the same TS will be updated, so can only 1000 data come up from the device at the same time? For example, 2019-04-22 13:39:14.000 to 2019-04-22 13:39:14.999?</p>


问:
How to limit Content-Type header in Amazon s3 Pre-Signed Url
We have a client incorrectly setting the Content-Type to application/json when uploading a pdf file to s3. This results in the client library we use to download the file to give it the wrong extension, also happens when you download the file from the s3 console, even though it has .pdf as the suffix, it downloads to .json.

Is there anyway to prevent clients from doing this? The Content type should always be application/x-www-form-urlencoded from my understanding.


问:
Stored procedure some inserts not working properly
```<code>CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_TRX_BUCKET`(
IN sMethod          varchar(30),
IN sCode            varchar(25),
IN sName            varchar(100),
IN sIsActive        varchar(2),
IN sIsSystem        varchar(2),
IN sBy              varchar(10),
IN bType            varchar(6),
IN ReplicateChoice  varchar(20),
IN Adjust           varchar(10),
IN Percentage       varchar(3),
OUT Result          varchar(30),
OUT Message         varchar(30)

)
BEGIN
 DECLARE _statement VARCHAR(8000);
    IF sMethod = 'UPDATE_BUCKET' THEN

                  UPDATE  stkm_pricebucket
                  SET   bucket_isactive =  sIsActive,
                        bucket_issystem = sIsSystem,
                        modifiedby = sBy,
                        modifieddt = NOW(),
                        bucket_desc = sName
                        WHERE bucket_code =  sCode ;

                   SELECT '00000' INTO Result;
                   SELECT  'Success Update' INTO Message;

    END IF;

    IF sMethod = 'ADD_BUCKET' THEN

            IF NOT EXISTS(SELECT bucket_code FROM stkm_pricebucket WHERE bucket_code = sCode) THEN
                INSERT INTO stkm_pricebucket (bucket_code, bucket_desc, bucket_isactive, bucket_issystem, createdby, createddt)
                VALUES (sCode, sName, sIsActive, sIsSystem, sBy, NOW());

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE
                SELECT 'DUPLICATE BUCKET CODE' INTO Result;
            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_DDL' THEN

            IF NOT EXISTS (SELECT cd_cdcode FROM stkc_codedesc WHERE cd_cdcode = sCode) THEN
                INSERT INTO stkc_codedesc (cd_cdtype, cd_cdcode, cd_cddesc, createdby, createddt, recstatus)
                VALUES (bType, sCode, sName, sBy, NOW(), sIsActive);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;
            ELSE
                SELECT 'DUPLICATE BUCKET CODE' INTO Result;
            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_SPUOM' THEN

            IF Adjust = 'MarkUp' THEN

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, round((spu_unitprice + (spu_unitprice*Percentage/100)),2), spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSEIF Adjust = 'MarkDown' THEN

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode as spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, round((spu_unitprice - (spu_unitprice*Percentage/100)),2) as spu_unitprice, spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode as spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_CIP' THEN

            IF Adjust = 'MarkUp' THEN

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, round((cip_unitprice + (cip_unitprice*Percentage/100)),3), cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSEIF Adjust = 'MarkDown' THEN

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, round((cip_unitprice - (cip_unitprice*Percentage/100)),3) as cip_unitprice, cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            END IF;
    END IF;
END
</code>```

I have a webapp where users can store prices in pricebuckets. For any given pricebucket, there will be its associated items (stock_codes) and prices (unitprices). So for example, PRICE1 will have a bunch of rows of items with its prices, PRICE2 will have its own and so on.

I need help with this stored procedure. When I call the procedure through the webapp, inserts should occur 5 times, but only the first 3 are successful (UPDATE_BUCKET, ADD_BUCKET, ADD_BUCKET_DDL). The remaining 2 display "successes" (SELECT INTO Result and Message work correctly) but the data is never inserted (ADD_BUCKET_SPUOM, ADD_BUCKET_CIP). I can confirm the required variables are also being sent within the logs the webapp (sMethod, sCode, Adjust, Percentage, ReplicateChoice). What's wrong with my SQL?

Some more notes:

Its ok for percentage to be varchar, sql automatically casts it as int, so thats not the problem

ReplicateChoice is case-insensitive, doesnt matter if its all caps or not

If I perform the insert statements on their own, it works just fine. It just doesn't work when the procedure is called

Really lost here, i don't see anything wrong with the sql. I'm using MySQL Server v8.0.16 with MySQL Workbench

Body:
CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_TRX_BUCKET`(
IN sMethod          varchar(30),
IN sCode            varchar(25),
IN sName            varchar(100),
IN sIsActive        varchar(2),
IN sIsSystem        varchar(2),
IN sBy              varchar(10),
IN bType            varchar(6),
IN ReplicateChoice  varchar(20),
IN Adjust           varchar(10),
IN Percentage       varchar(3),
OUT Result          varchar(30),
OUT Message         varchar(30)

)
BEGIN
 DECLARE _statement VARCHAR(8000);
    IF sMethod = 'UPDATE_BUCKET' THEN

                  UPDATE  stkm_pricebucket
                  SET   bucket_isactive =  sIsActive,
                        bucket_issystem = sIsSystem,
                        modifiedby = sBy,
                        modifieddt = NOW(),
                        bucket_desc = sName
                        WHERE bucket_code =  sCode ;

                   SELECT '00000' INTO Result;
                   SELECT  'Success Update' INTO Message;

    END IF;

    IF sMethod = 'ADD_BUCKET' THEN

            IF NOT EXISTS(SELECT bucket_code FROM stkm_pricebucket WHERE bucket_code = sCode) THEN
                INSERT INTO stkm_pricebucket (bucket_code, bucket_desc, bucket_isactive, bucket_issystem, createdby, createddt)
                VALUES (sCode, sName, sIsActive, sIsSystem, sBy, NOW());

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE
                SELECT 'DUPLICATE BUCKET CODE' INTO Result;
            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_DDL' THEN

            IF NOT EXISTS (SELECT cd_cdcode FROM stkc_codedesc WHERE cd_cdcode = sCode) THEN
                INSERT INTO stkc_codedesc (cd_cdtype, cd_cdcode, cd_cddesc, createdby, createddt, recstatus)
                VALUES (bType, sCode, sName, sBy, NOW(), sIsActive);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;
            ELSE
                SELECT 'DUPLICATE BUCKET CODE' INTO Result;
            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_SPUOM' THEN

            IF Adjust = 'MarkUp' THEN

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, round((spu_unitprice + (spu_unitprice*Percentage/100)),2), spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSEIF Adjust = 'MarkDown' THEN

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode as spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, round((spu_unitprice - (spu_unitprice*Percentage/100)),2) as spu_unitprice, spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE

                INSERT INTO stkm_stockpricesuom (spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate)
                SELECT sCode as spu_pricebucket, spu_stockcode, spu_uomcode, recstatus, createdby, createddt, modifiedby, modifieddt, spu_unitprice, spu_factor, spu_effdate
                FROM stkm_stockpricesuom where spu_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            END IF;
    END IF;

    IF sMethod = 'ADD_BUCKET_CIP' THEN

            IF Adjust = 'MarkUp' THEN

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, round((cip_unitprice + (cip_unitprice*Percentage/100)),3), cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSEIF Adjust = 'MarkDown' THEN

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, round((cip_unitprice - (cip_unitprice*Percentage/100)),3) as cip_unitprice, cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            ELSE

                INSERT INTO stkc_chargeitemprices (cip_pricebucket, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate)
                SELECT sCode, cip_chargecategory, cip_code, recstatus, createdby, createddt, modifiedby, modifieddt, cip_unitprice, cip_effdate
                FROM stkc_chargeitemprices WHERE cip_pricebucket=(SELECT bucket_code from stkm_pricebucket WHERE bucket_desc=ReplicateChoice);

                SELECT '00000' INTO Result;
                SELECT 'Success Update' INTO Message;

            END IF;
    END IF;
END

I have a webapp where users can store prices in pricebuckets. For any given pricebucket, there will be its associated items (stock_codes) and prices (unitprices). So for example, PRICE1 will have a bunch of rows of items with its prices, PRICE2 will have its own and so on.

I need help with this stored procedure. When I call the procedure through the webapp, inserts should occur 5 times, but only the first 3 are successful (UPDATE_BUCKET, ADD_BUCKET, ADD_BUCKET_DDL). The remaining 2 display "successes" (SELECT INTO Result and Message work correctly) but the data is never inserted (ADD_BUCKET_SPUOM, ADD_BUCKET_CIP). I can confirm the required variables are also being sent within the logs the webapp (sMethod, sCode, Adjust, Percentage, ReplicateChoice). What's wrong with my SQL?

Some more notes:

Its ok for percentage to be varchar, sql automatically casts it as int, so thats not the problem

ReplicateChoice is case-insensitive, doesnt matter if its all caps or not

If I perform the insert statements on their own, it works just fine. It just doesn't work when the procedure is called

Really lost here, i don't see anything wrong with the sql. I'm using MySQL Server v8.0.16 with MySQL Workbench


问:
Trying to create a bar chart using Matplotlib
Here is the chart I want to replicate.
The data after Pivoting below.

My code is below:

pivoted. Plot(kind='bar',
                         stacked=True,
                         colormap='tab10',
                         figsize=(10, 6))

plt.legend(loc="lower left", ncol=2)
for n, x in enumerate([*pivoted.index.values]):
    for (proportion, y_loc) in zip(pivoted.loc[x],
                                    pivoted.loc[x].cumsum()):

        plt.text(x=n - 0.17,
                  y=(y_loc - proportion) + (proportion / 2),
                  s=f'{np.round(proportion * 100, 1)}%',
                  color="black",
                  fontsize=12,
                  fontweight="bold")

plt.show()

```

Please help me recreate the graph. If you need the dataset let me know as well.

Body:
Here is the chart I want to replicate.
The data after Pivoting below.

My code is below:

pivoted. Plot(kind='bar',
                         stacked=True,
                         colormap='tab10',
                         figsize=(10, 6))

plt.legend(loc="lower left", ncol=2)
for n, x in enumerate([*pivoted.index.values]):
    for (proportion, y_loc) in zip(pivoted.loc[x],
                                    pivoted.loc[x].cumsum()):

        plt.text(x=n - 0.17,
                  y=(y_loc - proportion) + (proportion / 2),
                  s=f'{np.round(proportion * 100, 1)}%',
                  color="black",
                  fontsize=12,
                  fontweight="bold")

plt.show()

Please help me recreate the graph. If you need the dataset let me know as well.


问:
Using generic views with HTTP verbs
I am trying to mix HTTP verbs with Django's Built-in class-based generic views, i understand that is a good pattern (correct me if not) to keep Url's like app/pets/ and use HTTP's verbs to define what to do (GET, POST/create, PUT/update, DELETE/delete, etc) instead of something like app/pets/add or app/pets/delete as Django's documentation shows when using generic views with forms

So i tried something like this:

urls.py:

```<code>    path('login/', views.sign_in, name='login'),
    path('logout/', views.log_out, name='logout'),
    path('register/', views.register, name='register'),
    path('pets/', views.Pet.as_view(), name= "pets"),
</code>```

Views.py

```<code>class Pet(LoginRequiredMixin, View):
    login_url= "/vet/login/"

    #handle Get Request
    class PetListView(ListView):
        model= models.Pet
        context_object_name= "pets"
        template_name= "vet/index.html"

    #Handle Put request
    class PetUpdateView():
        pass
</code>```

but i am getting and error of 405 method not allowed (and i think is not a good practice do this).

i also tried this (defining the PetListView same as above):

```<code>class Pet(LoginRequiredMixin, View):
    login_url= "/vet/login/"

    def get(self, request):
        return HttpResponse(PetListView.as_view())
</code>```

But this just print the object on the screen.

I am new to Django and i do not know what is the better approach to accomplish this using Django generic's views since it reduce a lot code for CRUD operations

Title: Using generic views with HTTP verbs

Body:
I am trying to mix HTTP verbs with Django's Built-in class-based generic views, i understand that is a good pattern (correct me if not) to keep Url's like app/pets/ and use HTTP's verbs to define what to do (GET, POST/create, PUT/update, DELETE/delete, etc) instead of something like app/pets/add or app/pets/delete as Django's documentation shows when using generic views with forms

So i tried something like this:

urls.py:

    path('login/', views.sign_in, name='login'),
    path('logout/', views.log_out, name='logout'),
    path('register/', views.register, name='register'),
    path('pets/', views.Pet.as_view(), name= "pets"),

Views.py

class Pet(LoginRequiredMixin, View):
    login_url= "/vet/login/"

    #handle Get Request
    class PetListView(ListView):
        model= models.Pet
        context_object_name= "pets"
        template_name= "vet/index.html"

    #Handle Put request
    class PetUpdateView():
        pass

but i am getting and error of 405 method not allowed (and i think is not a good practice do this).

i also tried this (defining the PetListView same as above):

class Pet(LoginRequiredMixin, View):
    login_url= "/vet/login/"

    def get(self, request):
        return HttpResponse(PetListView.as_view())

But this just print the object on the screen.

I am new to Django and i do not know what is the better approach to accomplish this using Django generic's views since it reduce a lot code for CRUD operations


Title: Python GLM converges but R GLM doesn't?

Body:
I am trying to train an (identity link Poisson) GLM model on some data.  I built what I believe to be equivalent models in R and Python.  In R, the GLM fails to converge.  In Python, the GLM does converge.  Can anyone explain why this is the case?

Starting from the observation (R code)

b <- c(1607.72888, 1457.32996, 2230.17041, 2371.61865, 2759.7373,
2200.35571, 3700.06104, 75333.8906, 33347.0156, 24970.9219, 5840.49512,
2465.53516, 1882.85522, 1027.7406, 796.484009, 863.635925, 926.715149,
1315.60522, 7734.25879, 255625, 130990.281, 71047.9375, 23927.1992,
15792.1631, 13041.4033, 6688.22559, 2822.23682, 2115.25049, 1618.78552,
1517.86987, 482027.531, 213073.016, 98384.4844, 35729.2227, 21157.3594,
16215.7432, 14006.8438, 4750.69092, 3116.08838, 1554.2738, 587.872559,
0, 0, 64.625, 16.4270325, 37.5073662, 274.369263, 0)

and the predictor

M <- c(-7.9675869936053e-06, -2.9465510727696e-06, -2.21335646368051e-06,
3.64491029094931e-05, 1.27785515404535e-05, 3.38522978187467e-05,
0.00062461548108636, 0.0464058660868474, 0.0196678752619104,
0.0153096807169331, 0.00349654677177638, 0.0015296157844073,
0.00101697130553886, 0.00053606322761061, 0.00032545716927196,
0.00015466321949303, 0.00037175222102242, 0.00032327446276574,
0.00455841559776405, 0.169167191854014, 0.0871342536136015, 0.0473945835827427,
0.0161442668339746, 0.010567700966009, 0.00948533330933113, 0.00421478996145066,
0.00184265032175036, 0.00149379880911122, 0.00103486520709283,
0.00093688509002056, 0.298346941396298, 0.133754666017589, 0.0633174899164175,
0.0228254672410591, 0.0134052216553624, 0.0100745170940446, 0.00871104028108377,
0.00284039230023698, 0.00189497902518704, 0.00080088467813307,
1.5570018119882e-05, 5.27906279865597e-05, 5.36030668242488e-05,
2.02817303022873e-05, 2.78819345726129e-05, 2.85829668669995e-05,
1.83105158084491e-05, 4.3102208421767e-06)

or in python the observation

b = array([[1.60772888e+03],
       [1.45732996e+03],
       [2.23017041e+03],
       [2.37161865e+03],
       [2.75973730e+03],
       [2.20035571e+03],
       [3.70006104e+03],
       [7.53338906e+04],
       [3.33470156e+04],
       [2.49709219e+04],
       [5.84049512e+03],
       [2.46553516e+03],
       [1.88285522e+03],
       [1.02774060e+03],
       [7.96484009e+02],
       [8.63635925e+02],
       [9.26715149e+02],
       [1.31560522e+03],
       [7.73425879e+03],
       [2.55625000e+05],
       [1.30990281e+05],
       [7.10479375e+04],
       [2.39271992e+04],
       [1.57921631e+04],
       [1.30414033e+04],
       [6.68822559e+03],
       [2.82223682e+03],
       [2.11525049e+03],
       [1.61878552e+03],
       [1.51786987e+03],
       [4.82027531e+05],
       [2.13073016e+05],
       [9.83844844e+04],
       [3.57292227e+04],
       [2.11573594e+04],
       [1.62157432e+04],
       [1.40068438e+04],
       [4.75069092e+03],
       [3.11608838e+03],
       [1.55427380e+03],
       [5.87872559e+02],
       [0.00000000e+00],
       [0.00000000e+00],
       [6.46250000e+01],
       [1.64270325e+01],
       [3.75073662e+01],
       [2.74369263e+02],
       [0.00000000e+00]])

and the predictor

M = array([[-7.96758699e-06],
       [-2.94655107e-06],
       [-2.21335646e-06],
       [ 3.64491029e-05],
       [ 1.27785515e-05],
       [ 3.38522978e-05],
       [ 6.24615481e-04],
       [ 4.64058661e-02],
       [ 1.96678753e-02],
       [ 1.53096807e-02],
       [ 3.49654677e-03],
       [ 1.52961578e-03],
       [ 1.01697131e-03],
       [ 5.36063228e-04],
       [ 3.25457169e-04],
       [ 1.54663219e-04],
       [ 3.71752221e-04],
       [ 3.23274463e-04],
       [ 4.55841560e-03],
       [ 1.69167192e-01],
       [ 8.71342536e-02],
       [ 4.73945836e-02],
       [ 1.61442668e-02],
       [ 1.05677010e-02],
       [ 9.48533331e-03],
       [ 4.21478996e-03],
       [ 1.84265032e-03],
       [ 1.49379881e-03],
       [ 1.03486521e-03],
       [ 9.36885090e-04],
       [ 2.98346941e-01],
       [ 1.33754666e-01],
       [ 6.33174899e-02],
       [ 2.28254672e-02],
       [ 1.34052217e-02],
       [ 1.00745171e-02],
       [ 8.71104028e-03],
       [ 2.84039230e-03],
       [ 1.89497903e-03],
       [ 8.00884678e-04],
       [ 1.55700181e-05],
       [ 5.27906280e-05],
       [ 5.36030668e-05],
       [ 2.02817303e-05],
       [ 2.78819346e-05],
       [ 2.85829669e-05],
       [ 1.83105158e-05],
       [ 4.31022084e-06]])

I first tried to construct the glm using R's stats library with:

glm(b ~ 0 + M,
         family = poisson(identity)))

This fails to converge, with the error:

Error: no valid set of coefficients has been found: please supply starting values
In addition: Warning message:
In log(y/mu) : NaNs produced

I then built the following (I believe equivalent) python model:

poiReg = sm.GLM(b, M, family =
       sm.families.Poisson(link =
                           sm.families.links.identity())).fit()

and this model converged to 1578382.6635341388


问:
PHP: upload (POST) file to /dev/null
With PHP, I would like to post file directly to /dev/null, without writing to disk. I have this upload.php, which basically moves the file from a /tmp/yyXXXx to the /tmp/repos dir, but instead I would want to directly drop it to /dev/null.

Can $_FILES['userfile']['tmp_name'] be set or overridden to /dev/null?
Also, I tried setting the upload_file_path to /dev/null in php.ini file.

```<code>    ?php
$uldir = '/tmp/repos/';
$ulfile = $uldir . basename($_FILES['userfile']['name']);

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $ulfile)) {
    echo "Uploaded successfully.\n";
} else {
    echo "Could not upload file!\n";
}

?>
</code>```

Title: PHP: upload (POST) file to /dev/null

Body:
With PHP, I would like to post file directly to /dev/null, without writing to disk. I have this upload.php, which basically moves the file from a /tmp/yyXXXx to the /tmp/repos dir, but instead I would want to directly drop it to /dev/null.

Can $_FILES['userfile']['tmp_name'] be set or overridden to /dev/null?
Also, I tried setting the upload_file_path to /dev/null in php.ini file.

    ?php
$uldir = '/tmp/repos/';
$ulfile = $uldir . basename($_FILES['userfile']['name']);

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $ulfile)) {
    echo "Uploaded successfully.\n";
} else {
    echo "Could not upload file!\n";
}

?>


问:
How can we customize button in such a way that one button can delete items from table and same items be added in another table in Microsoft Access?
I have two table tbl1,tbl2 ,one form contain one button while clicking that button need to be delete from tbl1 nad add to be in tbl2 in microsoft access?</p>


问:
Using data with different files
I'm trying to display the name that the user enters in the text field, but when I launch the app, it only shows 'The player is'. I tried to assign the value of player1Name immediately to a string and it worked

This is my first view

```<code>class PlayerList : ObservableObject {
    @Published var player1Name = ""
    }
struct Player : Identifiable {
    var name : String
    let id = UUID()
}
struct ViewJouer: View {
    @ObservedObject var player = PlayerList()
    @Environment(\.presentationMode) var presentationMode
        var body: some View {
            VStack {
                TextField("Enter player name", text: $player.player1Name)
}
</code>```

This is my second view:

```<code>struct ViewTest: View {
    @ObservedObject var player = PlayerList()

    var body: some View {
        Text("The player is \(player.player1Name)")
    }
}
</code>```

Title: Using data with different files

Body:
I'm trying to display the name that the user enters in the text field, but when I launch the app, it only shows 'The player is'. I tried to assign the value of player1Name immediately to a string and it worked

This is my first view

class PlayerList : ObservableObject {
    @Published var player1Name = ""
    }
struct Player : Identifiable {
    var name : String
    let id = UUID()
}
struct ViewJouer: View {
    @ObservedObject var player = PlayerList()
    @Environment(\.presentationMode) var presentationMode
        var body: some View {
            VStack {
                TextField("Enter player name", text: $player.player1Name)
}

This is my second view:

struct ViewTest: View {
    @ObservedObject var player = PlayerList()

    var body: some View {
        Text("The player is \(player.player1Name)")
    }
}


问:
PyInstaller to .exe error when opening app. NoneType has no attribute write
Everything works well when i run the script using python but once i package it as an exe no output errors are found until i open the app and it crashes with: Failed to Execute script "Xtrarim" due to unhandled exception: NoneType object has no attribute 'write'.

I compiled with:

```<code>python -m eel Xtrarim.py web --noconsole --onefile --icon=./icon.ico
</code>```

Here is the source: Github
I've tried everything including reinstalling python.

Body:
Everything works well when i run the script using python but once i package it as an exe no output errors are found until i open the app and it crashes with: Failed to Execute script "Xtrarim" due to unhandled exception: NoneType object has no attribute 'write'.

I compiled with:

python -m eel Xtrarim.py web --noconsole --onefile --icon=./icon.ico

Here is the source: Github
I've tried everything including reinstalling python.


问:
Unity Input Action Binding for HTC Vive Flow Mobile phone Controller
I am trying to develop a VR application for the HTC VIVE Flow device, and currently, I'm in the stage of trying to identify inputs from the mobile controller (Mobile phone Trigger/Menu/Select) to unity. I'm using Unity Input System and non-of the listed controls for trigger events not identifying. https://www.vive.com/nz/support/flow/category_howto/about-phone-controller.html

To verify the code, I bound extra controls for the Keyboard key press events, which worked fine. [Keys: T, M, S keys of Keyboard] I would be grateful if someone could help me to sort out this problem. What binding control should I add in Unity to catch the inputs from the HTC Vive flow Mobile phone controller?


问:
ValueError: Number of labels is 1. Valid values are 2 to n_samples - 1 (inclusive) : with cluster greater than 1
I am trying to find the optimal number of clusters and i get the error. Below is my code:

```<code>def mbkmeans_clusters(
X,
k,
mb,
print_silhouette_values):

km = MiniBatchKMeans(n_clusters=k, batch_size=mb).fit(X)
print(f"Silhouette coefficient: {silhouette_score(X, km.labels_, metric='euclidean'):0.2f}")

if print_silhouette_values:
    sample_silhouette_values = silhouette_samples(X, km.labels_)
    print(f"Silhouette values:")
    silhouette_values = []
    for i in range(5, k-1):
        cluster_silhouette_values = sample_silhouette_values[km.labels_ == i]
        silhouette_values.append(
            (
                i,
                cluster_silhouette_values.shape[0],
                cluster_silhouette_values.mean(),
                cluster_silhouette_values.min(),
                cluster_silhouette_values.max(),
            )
        )
    silhouette_values = sorted(
        silhouette_values, key=lambda tup: tup[2], reverse=True
    )
    for s in silhouette_values:
        print(
            f"    Cluster {s[0]}: Size:{s[1]} | Avg:{s[2]:.2f} | Min:{s[3]:.2f} | Max: {s[4]:.2f}"
        )
return km, km.labels_
clustering, cluster_labels = mbkmeans_clusters(X=vectorized_docs,k=50,mb=500, print_silhouette_values=True)
</code>```

These links were not helpful: Link1 Link2

When I tried np.unique(km.labels_) i get array([0]). what am i missing?

Body:
I am trying to find the optimal number of clusters and i get the error. Below is my code:

def mbkmeans_clusters(
X,
k,
mb,
print_silhouette_values):

km = MiniBatchKMeans(n_clusters=k, batch_size=mb).fit(X)
print(f"Silhouette coefficient: {silhouette_score(X, km.labels_, metric='euclidean'):0.2f}")

if print_silhouette_values:
    sample_silhouette_values = silhouette_samples(X, km.labels_)
    print(f"Silhouette values:")
    silhouette_values = []
    for i in range(5, k-1):
        cluster_silhouette_values = sample_silhouette_values[km.labels_ == i]
        silhouette_values.append(
            (
                i,
                cluster_silhouette_values.shape[0],
                cluster_silhouette_values.mean(),
                cluster_silhouette_values.min(),
                cluster_silhouette_values.max(),
            )
        )
    silhouette_values = sorted(
        silhouette_values, key=lambda tup: tup[2], reverse=True
    )
    for s in silhouette_values:
        print(
            f"    Cluster {s[0]}: Size:{s[1]} | Avg:{s[2]:.2f} | Min:{s[3]:.2f} | Max: {s[4]:.2f}"
        )
return km, km.labels_
clustering, cluster_labels = mbkmeans_clusters(X=vectorized_docs,k=50,mb=500, print_silhouette_values=True)

These links were not helpful: Link1 Link2

When I tried np.unique(km.labels_) i get array([0]). what am i missing?


问:
getting pipeline to execure only in current directory
My current gitlab yml code looks like this.

```<code>  stage:                terraform-apply
  script:
    -                   terragrunt run-all apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir env/${ENVIRONMENT}
  when:                 manual
</code>```

Consider I have folders like this
../api/
../infra/
If I'm working on 'api' folder I want to execute commits only from current working directory in my cicd pipeline how do i go about about doing this.How to edit the gitlab yml to make pipeline execute only from the current working directory.

Body:
My current gitlab yml code looks like this.

  stage:                terraform-apply
  script:
    -                   terragrunt run-all apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir env/${ENVIRONMENT}
  when:                 manual

Consider I have folders like this
../api/
../infra/
If I'm working on 'api' folder I want to execute commits only from current working directory in my cicd pipeline how do i go about about doing this.How to edit the gitlab yml to make pipeline execute only from the current working directory.


问:
ConvergenceError: The model did not converge. Try adding a larger penalizer to see if that helps convergence
I tried the following code from the lifetimes library, using a 1 million row dataset. I get the error "ConvergenceError:  The model did not converge. Try adding a larger penalizer to see if that helps convergence." I havent set any penalizer.</p>
```<code> bgf.fit(summary_cal_holdout['frequency_cal'],
        summary_cal_holdout['recency_cal'],
        summary_cal_holdout['T_cal'])

 fun: -0.6687805030754939
 hess_inv: array([[3.59401922e+00, 4.07817298e+00, 1.96553220e-04, 3.81178105e-01],
       [4.07817298e+00, 7.68848347e+00, 2.57679876e-04, 3.33282620e+00],
       [1.96553220e-04, 2.57679876e-04, 7.65922646e+01, 7.65930375e+01],
       [3.81178107e-01, 3.33282620e+00, 7.65930375e+01, 1.05547305e+02]])
      jac: array([ 5.54469203e-07, -1.18094006e-07, -6.14083829e-08,  6.21662541e-08])
  message: 'Desired error not necessarily achieved due to precision loss.'
     nfev: 87
      nit: 42
     njev: 76
   status: 2
  success: False
        x: array([-0.60365091, -1.75150201, 12.07528864, 14.80580897])
---------------------------------------------------------------------------
ConvergenceError                          Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28924\3528314986.py in <module>
----> 1 bgf.fit(summary_cal_holdout['frequency_cal'],
      2         summary_cal_holdout['recency_cal'],
      3         summary_cal_holdout['T_cal'])

~\anaconda3\lib\site-packages\lifetimes\fitters\beta_geo_fitter.py in fit(self, frequency, recency, T, weights, initial_params, verbose, tol, index, **kwargs)
    135         scaled_T = T * self._scale
    136
--> 137         log_params_, self._negative_log_likelihood_, self._hessian_ = self._fit(
    138             (frequency, scaled_recency, scaled_T, weights, self.penalizer_coef),
    139             initial_params,

~\anaconda3\lib\site-packages\lifetimes\fitters\__init__.py in _fit(self, minimizing_function_args, initial_params, params_size, disp, tol, bounds, **kwargs)
    113             return output.x, output.fun, hessian_
    114         print(output)
--> 115         raise ConvergenceError(
    116             dedent(
    117                 """

ConvergenceError:
The model did not converge. Try adding a larger penalizer to see if that helps convergence.
</code>```

Body:
I tried the following code from the lifetimes library, using a 1 million row dataset. I get the error "ConvergenceError:  The model did not converge. Try adding a larger penalizer to see if that helps convergence." I havent set any penalizer.

 bgf.fit(summary_cal_holdout['frequency_cal'],
        summary_cal_holdout['recency_cal'],
        summary_cal_holdout['T_cal'])

 fun: -0.6687805030754939
 hess_inv: array([[3.59401922e+00, 4.07817298e+00, 1.96553220e-04, 3.81178105e-01],
       [4.07817298e+00, 7.68848347e+00, 2.57679876e-04, 3.33282620e+00],
       [1.96553220e-04, 2.57679876e-04, 7.65922646e+01, 7.65930375e+01],
       [3.81178107e-01, 3.33282620e+00, 7.65930375e+01, 1.05547305e+02]])
      jac: array([ 5.54469203e-07, -1.18094006e-07, -6.14083829e-08,  6.21662541e-08])
  message: 'Desired error not necessarily achieved due to precision loss.'
     nfev: 87
      nit: 42
     njev: 76
   status: 2
  success: False
        x: array([-0.60365091, -1.75150201, 12.07528864, 14.80580897])
---------------------------------------------------------------------------
ConvergenceError                          Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28924\3528314986.py in <module>
----> 1 bgf.fit(summary_cal_holdout['frequency_cal'],
      2         summary_cal_holdout['recency_cal'],
      3         summary_cal_holdout['T_cal'])

~\anaconda3\lib\site-packages\lifetimes\fitters\beta_geo_fitter.py in fit(self, frequency, recency, T, weights, initial_params, verbose, tol, index, **kwargs)
    135         scaled_T = T * self._scale
    136
--> 137         log_params_, self._negative_log_likelihood_, self._hessian_ = self._fit(
    138             (frequency, scaled_recency, scaled_T, weights, self.penalizer_coef),
    139             initial_params,

~\anaconda3\lib\site-packages\lifetimes\fitters\__init__.py in _fit(self, minimizing_function_args, initial_params, params_size, disp, tol, bounds, **kwargs)
    113             return output.x, output.fun, hessian_
    114         print(output)
--> 115         raise ConvergenceError(
    116             dedent(
    117                 """

ConvergenceError:
The model did not converge. Try adding a larger penalizer to see if that helps convergence.


问:
onUserEarnedReward is never called in Admob 21.4.0
The onUserEarneredReward method of Google's incentive video advertisement does not call back, and the close button cannot be clicked. You need to press Return to exit the advertisement.

I operate according to the official documents


问:
Redux toolkit fullfilled even there is an error and showing the error message from django showing in fullfilled case
Fullfilled and update the state perfectly. But When use wrong credential, the detailed error from django showing in the fullfilled "userInfo" state. If we catch the error through rejectWithValue, the message is just

"code 401"

userSlice.js

```<code>import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";

export const login = createAsyncThunk(
  "USER_LOGIN_REQUEST",
  async (cred, thunkAPI) => {
    try {
      console.log("this is one thig");
      console.log("username: ", cred.username, "password: ", cred.password);
      const config = {
        headers: {
          "Content-type": "application/json",
        },
      };
      const { data } = await axios.post(
        "/api/users/login/",
        { username: cred.username, password: cred.password },
        config
      );
      localStorage.setItem("userInfo", JSON.stringify(data));
      return data;
    } catch (error) {
      return thunkAPI.rejectWithValue(error);
    }
  }
);

const userInfoFromStorage = localStorage.getItem("userInfo")
  ? JSON.parse(localStorage.getItem("userInfo"))
  : null;

const initialState = {
  userLogin: { userInfo: userInfoFromStorage },
};

const userSlice = createSlice({
  name: "userRegister",
  initialState,
  reducers: {},
  extraReducers: (builder) => {
    builder
      .addCase(login.pending, (state = {}, action) => {
        return { loading: true, userInfo: [] };
      })
      .addCase(login.fulfilled, (state = {}, action) => {
        return { loading: false, userInfo: action.payload };
      })
      .addCase(login.rejected, (state = {}, action) => {
        return { loading: false, error: action.payload.message };
      });
  },
});

export default userSlice.reducer;
</code>```

store.js

```<code>const store = configureStore({
  reducer: {
    userLogin: userLoginReducer,
    cart: cartReducer,
    productList: productListReducer,
    productDetails: productDetailsReducer,
  },
  // initialState,
  middleware,
});
</code>```

login.jsx

```<code>const { error, loading, userInfo } = userLogin;
const submitHandler = (e) => {
    e.preventDefault();
    dispatch(login({ username: email, password }));
  };
</code>```

I was expected error message form django on rejected case not in fullfilled case.

Body:
Fullfilled and update the state perfectly. But When use wrong credential, the detailed error from django showing in the fullfilled "userInfo" state. If we catch the error through rejectWithValue, the message is just

"code 401"

userSlice.js

import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";

export const login = createAsyncThunk(
  "USER_LOGIN_REQUEST",
  async (cred, thunkAPI) => {
    try {
      console.log("this is one thig");
      console.log("username: ", cred.username, "password: ", cred.password);
      const config = {
        headers: {
          "Content-type": "application/json",
        },
      };
      const { data } = await axios.post(
        "/api/users/login/",
        { username: cred.username, password: cred.password },
        config
      );
      localStorage.setItem("userInfo", JSON.stringify(data));
      return data;
    } catch (error) {
      return thunkAPI.rejectWithValue(error);
    }
  }
);

const userInfoFromStorage = localStorage.getItem("userInfo")
  ? JSON.parse(localStorage.getItem("userInfo"))
  : null;

const initialState = {
  userLogin: { userInfo: userInfoFromStorage },
};

const userSlice = createSlice({
  name: "userRegister",
  initialState,
  reducers: {},
  extraReducers: (builder) => {
    builder
      .addCase(login.pending, (state = {}, action) => {
        return { loading: true, userInfo: [] };
      })
      .addCase(login.fulfilled, (state = {}, action) => {
        return { loading: false, userInfo: action.payload };
      })
      .addCase(login.rejected, (state = {}, action) => {
        return { loading: false, error: action.payload.message };
      });
  },
});

export default userSlice.reducer;

store.js

const store = configureStore({
  reducer: {
    userLogin: userLoginReducer,
    cart: cartReducer,
    productList: productListReducer,
    productDetails: productDetailsReducer,
  },
  // initialState,
  middleware,
});

login.jsx

const { error, loading, userInfo } = userLogin;
const submitHandler = (e) => {
    e.preventDefault();
    dispatch(login({ username: email, password }));
  };

I was expected error message form django on rejected case not in fullfilled case.


问:
Discrepancy in computed output on pandas dataframe printed to screen, and loaded using to_csv() and to_pickle()
I've got a 1176 row pandas dataframe aug_pred_df with a column called predictions.

In the script where this is generated, running print(np.sum(aug_pred_df['prediction']))
returns 581066368.0.

I then save the dataframe using:

```<code>aug_pred_df.to_csv('aug_pred.csv', index = False)
aug_pred_df.to_pickle('aug_pred_df.pkl')
</code>```

Then on a different computer with the same version of Python (3.8.5) and Pandas (1.4.2) I run

```<code>df_csv = pd.read_csv("aug_pred_df.csv")
df_pkl = pd.read_pickle("aug_pred_df.pkl")
</code>```

np.sum(df_csv.prediction) returns 581066364.0385034 and

np.sum(df_pkl.prediction) returns 581066400.0

The difference of these values: 581066364.0385034 - 581066400.0 is -35.96149659156799.

BUT, if I run:
np.sum(df_csv.prediction) - np.sum(df_pkl.prediction) I get -3.961496591567993.

And I note that 581066364.0385034 + 3.961496591567993 is 581066368.0, which is the value I get if I compute the sum on the original dataframe in the script.

Any insight into what is happening here? It appears that somewhere in the dataframe loaded from the pickle file, the data is correct, but it's just not printing correctly. And the .csv is just wrong? I get the same results using feather and parquet in place of pickle.

Body:
I've got a 1176 row pandas dataframe aug_pred_df with a column called predictions.

In the script where this is generated, running print(np.sum(aug_pred_df['prediction']))
returns 581066368.0.

I then save the dataframe using:

aug_pred_df.to_csv('aug_pred.csv', index = False)
aug_pred_df.to_pickle('aug_pred_df.pkl')

Then on a different computer with the same version of Python (3.8.5) and Pandas (1.4.2) I run

df_csv = pd.read_csv("aug_pred_df.csv")
df_pkl = pd.read_pickle("aug_pred_df.pkl")

np.sum(df_csv.prediction) returns 581066364.0385034 and

np.sum(df_pkl.prediction) returns 581066400.0

The difference of these values: 581066364.0385034 - 581066400.0 is -35.96149659156799.

BUT, if I run:
np.sum(df_csv.prediction) - np.sum(df_pkl.prediction) I get -3.961496591567993.

And I note that 581066364.0385034 + 3.961496591567993 is 581066368.0, which is the value I get if I compute the sum on the original dataframe in the script.

Any insight into what is happening here? It appears that somewhere in the dataframe loaded from the pickle file, the data is correct, but it's just not printing correctly. And the .csv is just wrong? I get the same results using feather and parquet in place of pickle.


问:
Wordpress not use site url when redirect 301
I have Wordpress installed in a laravel project.

My Wordpress has site url and home url is same: https://laravel-domain/column

I config permalink to https://laravel-domain/column/sample-post/

My problem is: when I access link https://laravel-domain/column/post-name-abc
Page redirect 301 to https://laravel-domain/post-name-abc and show 404

My expectation: Access: https://laravel-domain/column/post-name-abc
--> Redirect 301 to https://laravel-domain/column/post-name-abc/

Please help me. thanks


问:
What is the proper configuration to use PHP Xdebug in VS Code via SSH Remote?
I have seen many references to VS Code being able to use Xdebug step debugging over SSH connection, but I've never been able to get it to work. Any explanations-- or tutorials-- I've read always must be missing something, as there are different procedures offered, and none of those I've tried result in a functional step debugging environment.

The following is the Terminal output in VS Code, after establishing a remote SSH Connection. What can I learn from this information that might help me better configure the environment, so using Xdebug Listen will begin the step debugging session when an HTTP request is made?

```<code>[20:12:44.651] > Running ssh connection command... /home/username/.vscode-server-insiders/bin/e7b5449579249db344d473370d56a5df9446c826/bin/code-server-insiders --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all   &> "/home/username/.vscode-server-insiders/.e7b5449579249db344d473370d56a5df9446c826.log" < /dev/null
> printenv:
>     SHELL=/bin/bash
>     PWD=/home/username
>     LOGNAME=username
>     XDG_SESSION_TYPE=tty
>     MOTD_SHOWN=pam
>     HOME=/home/username
>     LANG=en_US.UTF-8
>     VSCODE_AGENT_FOLDER=/home/username/.vscode-server-insiders
>     SSH_CONNECTION=10.xx.xx.02 62663 10.xx.xx.01 22
>     XDG_SESSION_CLASS=user
>     USER=username
>     SHLVL=0
>     XDG_SESSION_ID=1826
>     XDG_RUNTIME_DIR=/run/user/1000
>     SSH_CLIENT=10.xx.xx.02 62663 22
[20:12:44.698] > Waiting for server log...
> *
> * Visual Studio Code Server
> *
[20:12:44.744] Received install output:
[20:12:44.745] Remote server is listening on 41579
[20:12:44.746] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":41579},"osReleaseId":"debian","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"11aa1a11-a11a-1aaa-11a1-11a111a11111"},"serverStartTime":80,"installUnpackCode":""}
[20:12:44.755] >
[20:12:44.760] Starting forwarding server. localPort 62668 -> socksPort 62646 -> remotePort 41579
[20:12:44.763] Forwarding server listening on 62668
[20:12:44.764] Waiting for ssh tunnel to be ready
[20:12:44.768] [Forwarding server 62668] Got connection 0
[20:12:44.774] Tunneled 41579 to local port 62668
[20:12:44.774] Resolved "ssh-remote+10.xx.xx.01" to "127.0.0.1:62668"
[20:12:44.822] ------
[20:12:44.874] [Forwarding server 62668] Got connection 1
[20:12:44.966] [Forwarding server 62668] Got connection 2
</code>```

How do i know if i need to use "tunneling"? AM I using tunneling in this config? What about PuTTY? Would that help the situation?

If more info is needed about my system, please advise.
Thank you!

Body:
I have seen many references to VS Code being able to use Xdebug step debugging over SSH connection, but I've never been able to get it to work. Any explanations-- or tutorials-- I've read always must be missing something, as there are different procedures offered, and none of those I've tried result in a functional step debugging environment.

The following is the Terminal output in VS Code, after establishing a remote SSH Connection. What can I learn from this information that might help me better configure the environment, so using Xdebug Listen will begin the step debugging session when an HTTP request is made?

[20:12:44.651] > Running ssh connection command... /home/username/.vscode-server-insiders/bin/e7b5449579249db344d473370d56a5df9446c826/bin/code-server-insiders --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all   &> "/home/username/.vscode-server-insiders/.e7b5449579249db344d473370d56a5df9446c826.log" < /dev/null
> printenv:
>     SHELL=/bin/bash
>     PWD=/home/username
>     LOGNAME=username
>     XDG_SESSION_TYPE=tty
>     MOTD_SHOWN=pam
>     HOME=/home/username
>     LANG=en_US.UTF-8
>     VSCODE_AGENT_FOLDER=/home/username/.vscode-server-insiders
>     SSH_CONNECTION=10.xx.xx.02 62663 10.xx.xx.01 22
>     XDG_SESSION_CLASS=user
>     USER=username
>     SHLVL=0
>     XDG_SESSION_ID=1826
>     XDG_RUNTIME_DIR=/run/user/1000
>     SSH_CLIENT=10.xx.xx.02 62663 22
[20:12:44.698] > Waiting for server log...
> *
> * Visual Studio Code Server
> *
[20:12:44.744] Received install output:
[20:12:44.745] Remote server is listening on 41579
[20:12:44.746] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":41579},"osReleaseId":"debian","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"11aa1a11-a11a-1aaa-11a1-11a111a11111"},"serverStartTime":80,"installUnpackCode":""}
[20:12:44.755] >
[20:12:44.760] Starting forwarding server. localPort 62668 -> socksPort 62646 -> remotePort 41579
[20:12:44.763] Forwarding server listening on 62668
[20:12:44.764] Waiting for ssh tunnel to be ready
[20:12:44.768] [Forwarding server 62668] Got connection 0
[20:12:44.774] Tunneled 41579 to local port 62668
[20:12:44.774] Resolved "ssh-remote+10.xx.xx.01" to "127.0.0.1:62668"
[20:12:44.822] ------
[20:12:44.874] [Forwarding server 62668] Got connection 1
[20:12:44.966] [Forwarding server 62668] Got connection 2

How do i know if i need to use "tunneling"? AM I using tunneling in this config? What about PuTTY? Would that help the situation?

If more info is needed about my system, please advise.
Thank you!


问:
Fire onclick event in another page
I have two pages. There is a link on one page and an input on the next page. The input code is as follows:

```<code><input name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element('anew')" value="answer" title="Answer this question" type="submit">
</code>```

I have added #anew to the end of the link. I want the onclick event to occur on the next page when this link is clicked, or rather the input button should be sent.
I have tried the following codes but none of them work properly

```<code>if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").trigger(qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").onclick(qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").bind('onclick', qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").trigger('onclick', qa_toggle_element('anew'));
}
</code>```

In fact, I want a code that exactly simulates the action of clicking on the input and causes the onclick event to occur

Title: Fire onclick event in another page

Body:
I have two pages. There is a link on one page and an input on the next page. The input code is as follows:

<input name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element('anew')" value="answer" title="Answer this question" type="submit">

I have added #anew to the end of the link. I want the onclick event to occur on the next page when this link is clicked, or rather the input button should be sent.
I have tried the following codes but none of them work properly

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").trigger(qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").onclick(qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").bind('onclick', qa_toggle_element('anew'));
}

if(window.location.hash == "#anew"){
    document.getElementById("q_doanswer").trigger('onclick', qa_toggle_element('anew'));
}

In fact, I want a code that exactly simulates the action of clicking on the input and causes the onclick event to occur


问:
VueJS barchart not getting visualized properly
In my laravel vue application I'm trying to draw a bar chart using my backend data.

Following is what I'm getting from my back end,

```<code>return response()->json($day_totals);

array:8 [
  "2023-01-11" => 1
  "2023-01-09" => 1
  "2023-01-05" => 0
  "2023-01-06" => 0
  "2023-01-07" => 0
  "2023-01-08" => 0
  "2023-01-10" => 0
  "2023-01-12" => 0
]
</code>```

In my front end I have one reusable component called, ShopifyDayWiseSales.vue and this includes the barchart.

For the Y-axis I want to have the total number of sales and for the X-axis I need to have the 7 days in short format like Sat, Sun, Mon...etc as I'm trying to display the sales per week..

Following is my ShopifyDayWiseSales.vue

```<code><template>
        <div data-aos="fade-up" class="col-md-12 mx-1 border bg-white w-100 h-100 py-2 px-3" >
            <apexchart :options="chartOptions" :series="chartData" type="bar" height="350" ref="apexChart"></apexchart>
        </div>
  </template>

  <script>
  import {ApexCharts} from 'vue-apexcharts'

  export default {
    components: {
      ApexCharts
    },
    data() {
      return {
        chartOptions: {
          chart: {
            id: 'daywise_stats'
          },
          xaxis: {
            categories: []
          },
          yaxis: {
            title: {
              text: 'Sales'
            }
          }
        },
        chartData: [{
          name: 'Sales',
          data: []
        }]
      }
    },
    created(){
      this.fetchDaywiseSales()
    },
    methods: {
      fetchDaywiseSales() {
        //make api call to fetch the daywise sales from the backend
        axios.get('/shopify-day-wise-sales').then(response => {
          this.formatData(response.data)
        })
      },
      formatData(data) {
        let currentDate = new Date()
        let lastWeek = new Date()
        lastWeek.setDate(lastWeek.getDate() - 7)
        let days = []
        while (lastWeek <= currentDate) {
          days.push(new Date(lastWeek).toLocaleString('default', { weekday: 'short' }));
          lastWeek.setDate(lastWeek.getDate() + 1);
        }
        this.chartOptions.xaxis.categories = days;
        console.log('hello days:',days);
        this.chartData[0].data = Object.values(data)
        this.$refs.apexChart.updateSeries(this.chartData)
      }
    }
  }
  </script>
</code>```

my console.log('hello days:',days); outputs me following

```<code>hello days: (8) ['Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', __ob__: Observer]
</code>```

But it's not getting displayed on my x-axis...

I'm using apexcharts module to visualize the chart, and following is my current out put

so instead of 1,2... in x-Axis I need to have the days in short format..... Y axis and it's data are correct, but the x-axis is incorrect

Body:
In my laravel vue application I'm trying to draw a bar chart using my backend data.

Following is what I'm getting from my back end,

return response()->json($day_totals);

array:8 [
  "2023-01-11" => 1
  "2023-01-09" => 1
  "2023-01-05" => 0
  "2023-01-06" => 0
  "2023-01-07" => 0
  "2023-01-08" => 0
  "2023-01-10" => 0
  "2023-01-12" => 0
]

In my front end I have one reusable component called, ShopifyDayWiseSales.vue and this includes the barchart.

For the Y-axis I want to have the total number of sales and for the X-axis I need to have the 7 days in short format like Sat, Sun, Mon...etc as I'm trying to display the sales per week..

Following is my ShopifyDayWiseSales.vue

<template>

            <apexchart :options="chartOptions" :series="chartData" type="bar" height="350" ref="apexChart"></apexchart>

  </template>

my console.log('hello days:',days); outputs me following

hello days: (8) ['Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', __ob__: Observer]

But it's not getting displayed on my x-axis...

I'm using apexcharts module to visualize the chart, and following is my current out put

so instead of 1,2... in x-Axis I need to have the days in short format..... Y axis and it's data are correct, but the x-axis is incorrect


问:
Color group buttons in Shiny when clicked
I'm having trouble changing the color of checkboxGroupButton when clicked. There doesn't seem to be any way to do a checkboxGroup in shiny where you can specify the color of the button pre and post click.

The code below will make the boxes change colors but only between white and grey. I want to customize the color it is by default and also when clicked.

```<code>              checkboxGroupButtons(
                inputId = "checkboxInput", label = "",
                choices = c("A", "B", "C", "D"),
                justified = FALSE,
                status = "default",
                individual = TRUE,
                direction = "vertical",
                selected = "A",
                checkIcon = list(
                  yes = icon("circle-check", class = "fa-regular"),
                  no = icon("circle", class = "fa-regular")
                )
              )

</code>```

I included this tag and can get it to change to color orange but I can't get it to change to another color when clicked.

```<code>  tags$style(
    HTML(
      "
      .btn.checkbtn {
        font-size: 15px;
        line-height: 1px;
        border-color: #0C3261;
        border-width: 2px;
        background-color: orange;
        margin-bottom: 1px; /*set the margin, so boxes don't overlap*/
      }
      "
    )
  ),

</code>```

Body:
I'm having trouble changing the color of checkboxGroupButton when clicked. There doesn't seem to be any way to do a checkboxGroup in shiny where you can specify the color of the button pre and post click.

The code below will make the boxes change colors but only between white and grey. I want to customize the color it is by default and also when clicked.

              checkboxGroupButtons(
                inputId = "checkboxInput", label = "",
                choices = c("A", "B", "C", "D"),
                justified = FALSE,
                status = "default",
                individual = TRUE,
                direction = "vertical",
                selected = "A",
                checkIcon = list(
                  yes = icon("circle-check", class = "fa-regular"),
                  no = icon("circle", class = "fa-regular")
                )
              )

I included this tag and can get it to change to color orange but I can't get it to change to another color when clicked.

  tags$style(
    HTML(
      "
      .btn.checkbtn {
        font-size: 15px;
        line-height: 1px;
        border-color: #0C3261;
        border-width: 2px;
        background-color: orange;
        margin-bottom: 1px; /*set the margin, so boxes don't overlap*/
      }
      "
    )
  ),