问:
Merging the 30-second sampling rate epochs into 30 minutes sampling epochs in the Excel File
I am a PhD student in Sport Science. In my excel file, there were five columns (Date, Time, ExactTime (computed by me using excel function), Activity Level) as shown in the attached photo. As you can see, in the "ExactTime" column, each row indicates the activity level at the 30-second intervals. However, my PhD supervisor would like to have a excel file containing the average activity level at each 30-minute interval, rather than the default 30-second interval. For instance, the first row becomes 09-08-2021 12:12:00 (in the first column) and the average activity level from 09-08-2021 11:42:00 to 12:12:00. Grateful if I could have some step-by-step guidelines on how to do it! Many thanks! The link to my data file is attached.(https://drive.google.com/drive/folders/1roIDdcxGwsq9l630YR0gapQ_yM9hvf0g?usp=sharing)
enter image description here

To have a excel file containing the average activity level at each 30-minute interval, rather than the default 30-second interval.


来源: stackexchange

问:
Chrome Extension: Access-Control-Allow-Origin in background script and content script
Please explain to me the difference in CORS for background script and content script.

When I make a fetch request from the content script, the headers are:

```<code>Referrer Policy: strict-origin-when-cross-origin
origin: http://example.org
sec-fetch-mode: cors
sec-fetch-site: **cross-site**
</code>```

and I get the error Access to fetch at 'https://api.blah-blah-blah' from origin 'http://example.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin'

And when I make the same request from the background script, everything is fine, the headers are:

```<code>Referrer Policy: strict-origin-when-cross-origin
origin: chrome-extension://faebbackmmlgdbgjmljofnijfdfaepbo
sec-fetch-mode: cors
sec-fetch-site: **none**
</code>```

and I get the correct responce.

Are http://example.org and chrome-extension the same origin?

ContentLicense: CC BY-SA 4.0

Body:
Please explain to me the difference in CORS for background script and content script.

When I make a fetch request from the content script, the headers are:

Referrer Policy: strict-origin-when-cross-origin
origin: http://example.org
sec-fetch-mode: cors
sec-fetch-site: **cross-site**

and I get the error Access to fetch at 'https://api.blah-blah-blah' from origin 'http://example.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin'

And when I make the same request from the background script, everything is fine, the headers are:

Referrer Policy: strict-origin-when-cross-origin
origin: chrome-extension://faebbackmmlgdbgjmljofnijfdfaepbo
sec-fetch-mode: cors
sec-fetch-site: **none**

and I get the correct responce.

Are http://example.org and chrome-extension the same origin?


问:
why lifetime works for shared but not for mutable in this code

struct Iter<'a, T> {
    slice: &'a [T],
}

impl<'a, T> Iterator for Iter<'a, T> {
    type Item = &'a T;

    fn next(&mut self) -> Option<Self::Item> {
        self.slice.get(0) // works
    }
}

struct MutIter<'a, T> {
    slice: &'a mut [T],
}

impl<'a, T> Iterator for MutIter<'a, T> {
    type Item = &'a mut T;

    fn next(&mut self) -> Option<Self::Item> {
        self.slice.get_mut(0) // fails
    }
}
fn main() {
    println!("Hello, world!");
}
```
<p>playground link</p>
```error: lifetime may not live long enough
  --> src/main.rs:21:9
   |
17 | impl<'a, T> Iterator for MutIter<'a, T> {
   |      -- lifetime `'a` defined here
...
20 |     fn next(&mut self) -> Option<Self::Item> {
   |             - let's call the lifetime of this reference `'1`
21 |         self.slice.get_mut(0) // fails
   |         ^^^^^^^^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`

```

you can see that similar line with shared reference works.

see lines with comments // works and // fails in the above code snippet

Body:
struct Iter<'a, T> {
    slice: &'a [T],
}

impl<'a, T> Iterator for Iter<'a, T> {
    type Item = &'a T;

    fn next(&mut self) -> Option<Self::Item> {
        self.slice.get(0) // works
    }
}

struct MutIter<'a, T> {
    slice: &'a mut [T],
}

impl<'a, T> Iterator for MutIter<'a, T> {
    type Item = &'a mut T;

    fn next(&mut self) -> Option<Self::Item> {
        self.slice.get_mut(0) // fails
    }
}
fn main() {
    println!("Hello, world!");
}

playground link

error: lifetime may not live long enough
  --> src/main.rs:21:9
   |
17 | impl<'a, T> Iterator for MutIter<'a, T> {
   |      -- lifetime `'a` defined here
...
20 |     fn next(&mut self) -> Option<Self::Item> {
   |             - let's call the lifetime of this reference `'1`
21 |         self.slice.get_mut(0) // fails
   |         ^^^^^^^^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`

you can see that similar line with shared reference works.

see lines with comments // works and // fails in the above code snippet


问:
How do I delete the previous possible moves when I click on a different sprite in my Pygame chess game?
I'm trying to create a small dot in all of the squares that the piece could possibly move into.

Here's some of my main loop:

moves = pg.sprite.Group()
#main loop
run = True
while run:
    #events

    for event in pg.event.get():
        if event.type == pg.QUIT:
            run = False

        if event.type == pg.KEYDOWN:
            if event.key == pg.K_s:
                for s in Pieces:
                    pg.draw.rect(board, (50, 50, 50, 30), s.rect, 2)
                Pieces.draw(board)

        if event.type == pg.MOUSEBUTTONDOWN:

            x, y = event.pos
            point = x-100,  y-100
            pg.draw.circle(board, (0, 255, 0), point, 2)

            for s in Pieces:
                if s.on_click(event) != None:
                    #should create a dot at every possible position
                    s.image.blit(board, s.get_position())
                    sel_piece = (s.on_click(event))
                    print(sel_piece.get_name())
                    tx, ty = sel_piece.get_position()
                    positions = sel_piece.get_moves(tx, ty)
                    for pos in positions:
                        move = move_checker(pos)
                        moves.add(move)
                        moves.draw(board)
                    break
                else:
                    #sel_piece = None
                    pass
            moves.clear(board, board)
```
<p>Here's the <code>move_checker</code> class:</p>
<pre class="lang-py prettyprint-override"><code>class move_checker(pg.sprite.Sprite):
    def __init__(self, pos):
        super().__init__()
        self.position = pos
        self.image = pg.image.load('images/moves.png')
        self.rect = self.image.get_rect(center = self.position)
    def place(self):
        self.image.blit(board, self.position)
        print("thx")
</code>```

I've tried to use the display.flip() function and the sprite.Group.clear() function, but they keep coming up with the same results of the dots being drawn and staying in the same place.

Body:
I'm trying to create a small dot in all of the squares that the piece could possibly move into.

Here's some of my main loop:

moves = pg.sprite.Group()
#main loop
run = True
while run:
    #events

    for event in pg.event.get():
        if event.type == pg.QUIT:
            run = False

        if event.type == pg.KEYDOWN:
            if event.key == pg.K_s:
                for s in Pieces:
                    pg.draw.rect(board, (50, 50, 50, 30), s.rect, 2)
                Pieces.draw(board)

        if event.type == pg.MOUSEBUTTONDOWN:

            x, y = event.pos
            point = x-100,  y-100
            pg.draw.circle(board, (0, 255, 0), point, 2)

            for s in Pieces:
                if s.on_click(event) != None:
                    #should create a dot at every possible position
                    s.image.blit(board, s.get_position())
                    sel_piece = (s.on_click(event))
                    print(sel_piece.get_name())
                    tx, ty = sel_piece.get_position()
                    positions = sel_piece.get_moves(tx, ty)
                    for pos in positions:
                        move = move_checker(pos)
                        moves.add(move)
                        moves.draw(board)
                    break
                else:
                    #sel_piece = None
                    pass
            moves.clear(board, board)

Here's the move_checker class:

class move_checker(pg.sprite.Sprite):
    def __init__(self, pos):
        super().__init__()
        self.position = pos
        self.image = pg.image.load('images/moves.png')
        self.rect = self.image.get_rect(center = self.position)
    def place(self):
        self.image.blit(board, self.position)
        print("thx")

I've tried to use the display.flip() function and the sprite.Group.clear() function, but they keep coming up with the same results of the dots being drawn and staying in the same place.


问:
ERROR: Could not install packages due to an OSError: [Errno 2] gym
I try:

```<code>pip3 install gym
</code>```

and get the following error:

```<code>ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/Users/acsolak/opt/anaconda3/lib/python3.8/site-packages/numpy-1.23.3.dist-info/METADATA'
</code>```

I use macOS, so this answer couldn't solve my problem. I also tried pip3 install gym --user and did not help either.

a list of packages in pip3 that I feel like might help:

```<code>conda                         22.9.0
conda-build                   3.21.9
conda-content-trust           0.1.3
conda-package-handling        1.9.0
conda-repo-cli                1.0.24
conda-token                   0.4.0
conda-verify                  3.4.2
numexpr                       2.8.4
numpy                         1.23.3
numpydoc                      1.5.0
python-dateutil               2.8.2
python-louvain                0.15
python-lsp-black              1.0.0
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.3.3
python-slugify                5.0.2
</code>```

Python version:
Python 3.8.15 (default, Nov 24 2022, 09:04:07)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin

Body:
I try:

pip3 install gym

and get the following error:

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/Users/acsolak/opt/anaconda3/lib/python3.8/site-packages/numpy-1.23.3.dist-info/METADATA'

I use macOS, so this answer couldn't solve my problem. I also tried pip3 install gym --user and did not help either.

a list of packages in pip3 that I feel like might help:

conda                         22.9.0
conda-build                   3.21.9
conda-content-trust           0.1.3
conda-package-handling        1.9.0
conda-repo-cli                1.0.24
conda-token                   0.4.0
conda-verify                  3.4.2
numexpr                       2.8.4
numpy                         1.23.3
numpydoc                      1.5.0
python-dateutil               2.8.2
python-louvain                0.15
python-lsp-black              1.0.0
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.3.3
python-slugify                5.0.2

Python version:
Python 3.8.15 (default, Nov 24 2022, 09:04:07)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin


问:
Oracle Cloud Infrastructure: VCN DNS Domain Name Update
Is it possible to update the DNS Domain Name label using either the console, CLI or REST API after the VCN has been provisioned? Or will i need to destroy and re-provision the VCN with the correct label?

The issue is that we have 2 VCN's - one in each region (Ashburn and Phoenix), and the DNS Domain Name label on the Phoenix VCN was set identically to that of Ashburn. This is causing an issue while tryin to configure conditional forwarders (e.g. domain name already used up by Ashburn). I was hoping to fix this without re-provisioning the VCN in Phoenix.


问:
Does iOS and MacOS support FIDO2 for native apps (Flutter)?
Apple's Safari browser supports WebAuthn now. However, I couldn't find information on if Apple MacOS and iOS support FIDO2 API calls natively. This is for a Flutter cross-platform app.

References:

Implementing FIDO2 (WebAuthN) in Native iOS

Fido2 implementation in iOS and Android

Implement Fido2 in Android and iOS using React Native

contrib-fido2-flutter-lib


问:
CSS how to make the distance of the content inside two flexbox columns equal
I have two flexbox-columns

```<code><div class="container">
   <div class="left">
      <div>
         <h1>This is some long title on two lines</h1>
      </div>
      <div>
         <p>This is some text</p>
      </div>
      <div>
        <button>
           this is some button
       </button>
     </div>
  </div>
  <div class="right">
    <div>
       <h1>This is some title</h1>
    </div>
    <div>
       <p>This is some text</p>
    </div>
    <div>
      <button>
        this is some button
      </button>
   </div>
 </div>
</div>
</code>```

and the css:

```<code>.container {
  display:flex;
  flex-direction:row;
  justify-content: space-between;
}

.left {
  flex:1;
  border:1px solid #000
 }

.right {
  flex:1;
  border:1px solid #000
 }
</code>```

The issue is, that when one of the
 is a bit longer, the height of the two columns is completely off. On large screens it works ok, but on "normal" screens the problem appears.

I´ve created a FIDDLE for it.

What I want to achieve, is that the <button always stays at the bottom, and the text fields start at the same position.

Can someone maybe help me out?

Body:
I have two flexbox-columns

This is some long title on two lines

This is some text

        <button>
           this is some button
       </button>

This is some title

This is some text

      <button>
        this is some button
      </button>

and the css:

.container {
  display:flex;
  flex-direction:row;
  justify-content: space-between;
}

.left {
  flex:1;
  border:1px solid #000
 }

.right {
  flex:1;
  border:1px solid #000
 }

The issue is, that when one of the
 is a bit longer, the height of the two columns is completely off. On large screens it works ok, but on "normal" screens the problem appears.

I´ve created a FIDDLE for it.

What I want to achieve, is that the <button always stays at the bottom, and the text fields start at the same position.

Can someone maybe help me out?


问:
Windows 10 PowerShell cmdlet's doesn't allow UTF-8 strings as parameters
I'm trying to help my wife who is a teacher with setting up computers in her classroom. On each of these Windows 10 computers exactly the same set of local accounts should be created. I'm trying to prepare simple PowerShell script which will simply add all these users automatically after system installation. Unfortunately this is so screwed that I've already lost two days on such simple task.

Problem is that this is a polish version of Windows 10 and local users have to be members of "Users" group which is "Użytkownicy" in polish version of Windows.

Therefore, my PowerShell script looks like this:

```<code>$SecurePassword = ConvertTo-SecureString "Password" -AsPlainText -Force
New-LocalUser "Maluch" -Password $SecurePassword -FullName "Uczen" -Description "Uczen"
Add-LocalGroupMember -Group "Użytkownicy" -Member "Maluch"
</code>```

Next, I run this script from cmd shell like this:

```<code>powershell.exe -ExecutionPolicy Bypass -File .\Add_Users.ps1
</code>```

Unfortunately it drops such error:

```<code>Add-LocalGroupMember : Group UĹĽytkownicy -Member was not found.
At C:\install\Add_Users.ps1:3 char:1
+ Add-LocalGroupMember -Group `UĹĽytkownicy` -Member 'Maluch'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (UĹĽytkownicy -Member:String) [Add-LocalGroupMember], GroupNotFoundException
+ FullyQualifiedErrorId :
GroupNotFound,Microsoft.PowerShell.Commands.AddLocalGroupMemberCommand
</code>```

I suppose the problem is that string "Użytkownicy" is encoded as UTF-8 which is not accepted as cmdlet parameter. For me it is quite shocking that programming language provided by Microsoft isn't compatible with their own operating system. Any idea how to prepare this script correctly?

Similarly I want to set password for one of users which contains UTF-8 chars in it:

```<code>$SecurePassword = ConvertTo-SecureString "trójka" -AsPlainText -Force
New-LocalUser "TestUser" -Password $SecurePassword -FullName "Test User" -Description "Test User"
</code>```

This goes well within the script but later when I try to log-in to the "TestUser" account then it turns out that password is wrong. Probably due exactly the same problem as above.

Tried to change PowerShell behavior but any of below settings didn't help:

```<code>$PSDefaultParameterValues['*:Encoding'] = 'utf8'
[Environment]::SetEnvironmentVariable("LC_ALL", "C.UTF-8", "User")
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
</code>```

Body:
I'm trying to help my wife who is a teacher with setting up computers in her classroom. On each of these Windows 10 computers exactly the same set of local accounts should be created. I'm trying to prepare simple PowerShell script which will simply add all these users automatically after system installation. Unfortunately this is so screwed that I've already lost two days on such simple task.

Problem is that this is a polish version of Windows 10 and local users have to be members of "Users" group which is "Użytkownicy" in polish version of Windows.

Therefore, my PowerShell script looks like this:

$SecurePassword = ConvertTo-SecureString "Password" -AsPlainText -Force
New-LocalUser "Maluch" -Password $SecurePassword -FullName "Uczen" -Description "Uczen"
Add-LocalGroupMember -Group "Użytkownicy" -Member "Maluch"

Next, I run this script from cmd shell like this:

powershell.exe -ExecutionPolicy Bypass -File .\Add_Users.ps1

Unfortunately it drops such error:

Add-LocalGroupMember : Group UĹĽytkownicy -Member was not found.
At C:\install\Add_Users.ps1:3 char:1
+ Add-LocalGroupMember -Group `UĹĽytkownicy` -Member 'Maluch'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (UĹĽytkownicy -Member:String) [Add-LocalGroupMember], GroupNotFoundException
+ FullyQualifiedErrorId :
GroupNotFound,Microsoft.PowerShell.Commands.AddLocalGroupMemberCommand

I suppose the problem is that string "Użytkownicy" is encoded as UTF-8 which is not accepted as cmdlet parameter. For me it is quite shocking that programming language provided by Microsoft isn't compatible with their own operating system. Any idea how to prepare this script correctly?

Similarly I want to set password for one of users which contains UTF-8 chars in it:

$SecurePassword = ConvertTo-SecureString "trójka" -AsPlainText -Force
New-LocalUser "TestUser" -Password $SecurePassword -FullName "Test User" -Description "Test User"

This goes well within the script but later when I try to log-in to the "TestUser" account then it turns out that password is wrong. Probably due exactly the same problem as above.

Tried to change PowerShell behavior but any of below settings didn't help:

$PSDefaultParameterValues['*:Encoding'] = 'utf8'
[Environment]::SetEnvironmentVariable("LC_ALL", "C.UTF-8", "User")
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding


问:
Passing Variables into other Variables and across files with SwiftUI
I want this file(file2) to revvieve edge input results of file1, modify them as desired then send them along to file 3 (charts) for realtime feedback. how do I pass variables into other variables as well across files while keeping the information live and modifiable?

Paste bin: Paste Bin Folder

`

```<code>/*
I want this file(file2) to revvieve edge input results of file1, modify them as desired then send them along to file 3 (charts) for realtime feedback. how do I pass variables into other variables as well across files while keeping the information live and modifiable?
*/
import PlaygroundSupport
import Foundation
import SwiftUI

import UniformTypeIdentifiers

struct sliderHalf: View {
    @State private var showingPopover = false
    @State private var edge = 50.0
    @State private var math = 50.0
    @State private var physics = 50.0
    @State private var isEditing = false
    var body: some View {

            VStack(alignment: .leading) {
                Divider()

                VStack(alignment: .leading) {
                    Button {
                        showingPopover = true
                    } label: {
                        ZStack(alignment: .leading){
                            RoundedRectangle(cornerRadius: 4.0)
                                .aspectRatio(4.5, contentMode: ContentMode.fit)
                                .shadow(radius: 3)
                                .foregroundColor(.blue)
                            HStack(alignment: .center){
                                Image("Hornet").resizable()
                                    .aspectRatio(contentMode: .fit).padding(.leading, 2).padding(.trailing, 2)
                                    .frame(
                                        maxWidth: 50,
                                        maxHeight: 50, alignment: .leading).shadow(radius: 3)
                                Text("Lab Math")
                            }.foregroundColor(.white)

                            //  Label("Overlay HUD", systemimage: "cloud")
                            //        .foregroundColor(.white)
                                .padding(.leading, 2)

                        }
                        .buttonStyle(.plain)
                        .popover(isPresented: $showingPopover) {
                            VStack(alignment: .leading){
                                Text("Crystalline")
                                    .font(.subheadline)

                                Text("Proportional")
                                    .font(.subheadline)

                                Text("Congruent")
                                    .font(.subheadline)

                                Divider()
                                Text("Edge")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $edge,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(edge)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }

                                Text("Math")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $math,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(math)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }
                                Text("Physics")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $physics,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(physics)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }
                            } .frame(width: 300, height: 400) .shadow(radius: 3)
                                .padding(5)
                                .background(Color.blue.opacity(1.0))
                            //  .padding()
                        } .foregroundColor(.white)
                    } .frame(
                        maxWidth: 200,
                        maxHeight: .infinity, alignment: .topLeading).padding(8)
                }
                HStack(alignment: .top){
                    VStack(alignment: .leading){
                        Text("Legend")
                            .italic()

                        Divider().frame(width:100)
                            VStack(alignment: .leading){
                                Text("File 1")
                                    .font(.subheadline)
                                VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                    .shadow(radius: 3)
                                    .foregroundColor(.indigo)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                        Text("File 2")
                            .font(.subheadline)
                        VStack(alignment: .leading){
                            VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                .shadow(radius: 3)
                                    .foregroundColor(.brown)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                        Text("File 3")
                            .font(.subheadline)
                        VStack(alignment: .leading){
                            VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                .shadow(radius: 3)
                                    .foregroundColor(.black)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                    }
                }.padding()
            }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading).background(Color.brown)
    }
}
</code>```

`

DART Edge Live Data Passing and Editing Interface

I have tried other methods to pass data that cater to specific scenarios such as pdf rendering or grabbing image of the day, etc but I need something specific to math and science where variables can be manipulated live while updating other variables. I’m looking for the most optimal method to pass and manipulate data so I can pass the whole math lab via a scenario down the road such as cloud scaling. If it is specific to math or science I don’t quite have SwiftUI down with things like: State, Static, ObservableObject, Object, Published, etc.

I am developing solely on iPad Pro 6th gen Swift Playgrounds.

Body:
I want this file(file2) to revvieve edge input results of file1, modify them as desired then send them along to file 3 (charts) for realtime feedback. how do I pass variables into other variables as well across files while keeping the information live and modifiable?

Paste bin: Paste Bin Folder

`

/*
I want this file(file2) to revvieve edge input results of file1, modify them as desired then send them along to file 3 (charts) for realtime feedback. how do I pass variables into other variables as well across files while keeping the information live and modifiable?
*/
import PlaygroundSupport
import Foundation
import SwiftUI

import UniformTypeIdentifiers

struct sliderHalf: View {
    @State private var showingPopover = false
    @State private var edge = 50.0
    @State private var math = 50.0
    @State private var physics = 50.0
    @State private var isEditing = false
    var body: some View {

            VStack(alignment: .leading) {
                Divider()

                VStack(alignment: .leading) {
                    Button {
                        showingPopover = true
                    } label: {
                        ZStack(alignment: .leading){
                            RoundedRectangle(cornerRadius: 4.0)
                                .aspectRatio(4.5, contentMode: ContentMode.fit)
                                .shadow(radius: 3)
                                .foregroundColor(.blue)
                            HStack(alignment: .center){
                                Image("Hornet").resizable()
                                    .aspectRatio(contentMode: .fit).padding(.leading, 2).padding(.trailing, 2)
                                    .frame(
                                        maxWidth: 50,
                                        maxHeight: 50, alignment: .leading).shadow(radius: 3)
                                Text("Lab Math")
                            }.foregroundColor(.white)

                            //  Label("Overlay HUD", systemimage: "cloud")
                            //        .foregroundColor(.white)
                                .padding(.leading, 2)

                        }
                        .buttonStyle(.plain)
                        .popover(isPresented: $showingPopover) {
                            VStack(alignment: .leading){
                                Text("Crystalline")
                                    .font(.subheadline)

                                Text("Proportional")
                                    .font(.subheadline)

                                Text("Congruent")
                                    .font(.subheadline)

                                Divider()
                                Text("Edge")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $edge,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(edge)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }

                                Text("Math")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $math,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(math)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }
                                Text("Physics")
                                    .font(.subheadline)

                                VStack(alignment: .center){
                                    Slider(
                                        value: $physics,
                                        in: 0...100,
                                        onEditingChanged: { editing in
                                            isEditing = editing
                                        }
                                    )
                                    Text("\(physics)")
                                        .foregroundColor(isEditing ? .yellow : .white)
                                }
                            } .frame(width: 300, height: 400) .shadow(radius: 3)
                                .padding(5)
                                .background(Color.blue.opacity(1.0))
                            //  .padding()
                        } .foregroundColor(.white)
                    } .frame(
                        maxWidth: 200,
                        maxHeight: .infinity, alignment: .topLeading).padding(8)
                }
                HStack(alignment: .top){
                    VStack(alignment: .leading){
                        Text("Legend")
                            .italic()

                        Divider().frame(width:100)
                            VStack(alignment: .leading){
                                Text("File 1")
                                    .font(.subheadline)
                                VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                    .shadow(radius: 3)
                                    .foregroundColor(.indigo)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                        Text("File 2")
                            .font(.subheadline)
                        VStack(alignment: .leading){
                            VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                .shadow(radius: 3)
                                    .foregroundColor(.brown)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                        Text("File 3")
                            .font(.subheadline)
                        VStack(alignment: .leading){
                            VStack(alignment: .leading){
                                RoundedRectangle(cornerRadius: 2.0)
                                    .aspectRatio(1, contentMode: ContentMode.fill)
                                    .shadow(radius: 3)
                                .shadow(radius: 3)
                                    .foregroundColor(.black)
                            }.frame(maxWidth: 10, maxHeight: 10, alignment: .topLeading)
                        }
                    }
                }.padding()
            }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading).background(Color.brown)
    }
}

`

DART Edge Live Data Passing and Editing Interface

I have tried other methods to pass data that cater to specific scenarios such as pdf rendering or grabbing image of the day, etc but I need something specific to math and science where variables can be manipulated live while updating other variables. I’m looking for the most optimal method to pass and manipulate data so I can pass the whole math lab via a scenario down the road such as cloud scaling. If it is specific to math or science I don’t quite have SwiftUI down with things like: State, Static, ObservableObject, Object, Published, etc.

I am developing solely on iPad Pro 6th gen Swift Playgrounds.


问:
Flask-SQLAlchemy Grid.js Slow Query
There is a query that is taking some time using Flask-SQLAlchemy, the raw query when ran in SQL Server is actually quite fast.

```<code>search = request.args.get('search')
    # sort = request.args.get('sort')
    start = request.args.get('start', type=int, default=-1)
    length = request.args.get('length', type=int, default=-1)

    base_query = db.session.query(
            Experience.uID,
            Person.ID,
            Person.fullName,
            Experience.companyID,
            Experience.jobTitle,
            Company.companyName,
            Experience.role,
            ).join(Person).join(Company)

    # if start != -1 and length != -1:
    #     base_query = base_query.order_by(Experience.uID).offset(start).limit(length)

    if search:
        base_query = base_query.filter(
                db.or_(
                Experience.companyID.like(f'%{search}%'),
                Experience.jobTitle.like(f'%{search}%'),
                Experience.role.like(f'%{search}%'),
                Person.fullName.like(f'%{search}%'),
                Company.companyName.like(f'%{search}%'),
                ))

        total_records = base_query.count()

        base_query = base_query.order_by(Experience.uID).offset(start).limit(length).all()

    else:
        total_records = base_query.count()
        base_query = base_query.order_by(Experience.uID).offset(start).limit(length).all()
</code>```

And to send the dict to Grid.js on the Flask template

```<code>query_data = []

    for i in base_query:
        query_data.append({
            'uniqueID': i[0],
            'personID': i[1],
            'fullName': i[2],
            'companyID': i[3],
            'jobTitle': i[4],
            'companyName': i[5],
            'role': i[6],
        })

    return {
            'data': query_data,
            'total': total_records,
        }
</code>```

When only using one of the filters the query is much quicker, however I would like to keep all the filters.

When using a query with only one table and multiple filters on that table it is responsive as it should be. With a joined table and multiple filters it slows down dramatically.

EDIT:

Below is the output from Flask-SQLAlchemy. This query runs with ease in SQL Management Studio in less than a second. The bottleneck seems to be occurring within python.

```<code>SELECT [xPDL_Experience].[UniqueID] AS [xPDL_Experience_UniqueID], [xPDL_Person].[PersonID] AS [xPDL_Person_PersonID], [xPDL_Person].[FullName] AS [xPDL_Person_FullName], [xPDL_Experience].[CompanyID] AS [xPDL_Experience_CompanyID], [xPDL_Experience].[JobTitle] AS [xPDL_Experience_JobTitle], [xPDL_Company].[Name] AS [xPDL_Company_Name], [xPDL_Experience].[BoardPosition] AS [xPDL_Experience_BoardPosition]
FROM [xPDL_Experience] JOIN [xPDL_Person] ON [xPDL_Person].[PersonID] = [xPDL_Experience].[PersonID] JOIN [xPDL_Company] ON [xPDL_Company].[CompanyID] = [xPDL_Experience].[CompanyID]
WHERE [xPDL_Experience].[JobTitle] LIKE ? OR [xPDL_Experience].[BoardPosition] LIKE ? OR [xPDL_Person].[FullName] LIKE ? OR [xPDL_Company].[Name] LIKE ? ORDER BY [xPDL_Experience].[UniqueID], [xPDL_Person].[FullName], [xPDL_Person].[PersonID], [xPDL_Company].[Name]
 OFFSET ? ROWS
 FETCH FIRST ? ROWS ONLY
</code>```

Title: Flask-SQLAlchemy Grid.js Slow Query

Body:
There is a query that is taking some time using Flask-SQLAlchemy, the raw query when ran in SQL Server is actually quite fast.

search = request.args.get('search')
    # sort = request.args.get('sort')
    start = request.args.get('start', type=int, default=-1)
    length = request.args.get('length', type=int, default=-1)

    base_query = db.session.query(
            Experience.uID,
            Person.ID,
            Person.fullName,
            Experience.companyID,
            Experience.jobTitle,
            Company.companyName,
            Experience.role,
            ).join(Person).join(Company)

    # if start != -1 and length != -1:
    #     base_query = base_query.order_by(Experience.uID).offset(start).limit(length)

    if search:
        base_query = base_query.filter(
                db.or_(
                Experience.companyID.like(f'%{search}%'),
                Experience.jobTitle.like(f'%{search}%'),
                Experience.role.like(f'%{search}%'),
                Person.fullName.like(f'%{search}%'),
                Company.companyName.like(f'%{search}%'),
                ))

        total_records = base_query.count()

        base_query = base_query.order_by(Experience.uID).offset(start).limit(length).all()

    else:
        total_records = base_query.count()
        base_query = base_query.order_by(Experience.uID).offset(start).limit(length).all()

And to send the dict to Grid.js on the Flask template

query_data = []

    for i in base_query:
        query_data.append({
            'uniqueID': i[0],
            'personID': i[1],
            'fullName': i[2],
            'companyID': i[3],
            'jobTitle': i[4],
            'companyName': i[5],
            'role': i[6],
        })

    return {
            'data': query_data,
            'total': total_records,
        }

When only using one of the filters the query is much quicker, however I would like to keep all the filters.

When using a query with only one table and multiple filters on that table it is responsive as it should be. With a joined table and multiple filters it slows down dramatically.

EDIT:

Below is the output from Flask-SQLAlchemy. This query runs with ease in SQL Management Studio in less than a second. The bottleneck seems to be occurring within python.

SELECT [xPDL_Experience].[UniqueID] AS [xPDL_Experience_UniqueID], [xPDL_Person].[PersonID] AS [xPDL_Person_PersonID], [xPDL_Person].[FullName] AS [xPDL_Person_FullName], [xPDL_Experience].[CompanyID] AS [xPDL_Experience_CompanyID], [xPDL_Experience].[JobTitle] AS [xPDL_Experience_JobTitle], [xPDL_Company].[Name] AS [xPDL_Company_Name], [xPDL_Experience].[BoardPosition] AS [xPDL_Experience_BoardPosition]
FROM [xPDL_Experience] JOIN [xPDL_Person] ON [xPDL_Person].[PersonID] = [xPDL_Experience].[PersonID] JOIN [xPDL_Company] ON [xPDL_Company].[CompanyID] = [xPDL_Experience].[CompanyID]
WHERE [xPDL_Experience].[JobTitle] LIKE ? OR [xPDL_Experience].[BoardPosition] LIKE ? OR [xPDL_Person].[FullName] LIKE ? OR [xPDL_Company].[Name] LIKE ? ORDER BY [xPDL_Experience].[UniqueID], [xPDL_Person].[FullName], [xPDL_Person].[PersonID], [xPDL_Company].[Name]
 OFFSET ? ROWS
 FETCH FIRST ? ROWS ONLY


问:
How to post-process a Yolov7 ONNX model?
I trained a YOLOv7 model on a custom dataset and converted it to ONNX. The input of the model on Netron reads "Float32(1,3,640,640)" which I understand. The output, however, is unclear to me as other tutorials mentioned there should be 6 elements representing bounding box position and size (xywh objectness and class number) but this model outputs 7 elements with an extra 0 as follows:

Float32(concatoutput_dim_0,7)

The output (sample data):

0, 24.744838, 50, 24.744838, 70.46938, 1 ,1, 0, 40.495939, 30.95939, 40.495939, 123.2848439, 1, 1, ...
(Each 7 values start with zero, and the second and fourth are almost always equal). Does the 0 mean (dimension 0)?

Successfully converted yolov7 to onnx, and pre-processed input image. Output is unclear as to why it has a 7th element.


问:
Python how to direct select excel file
My script is direct select a xls file at a location (d:\temp2}, once if my folder has more then one xls file will get error, so can I specify select a excel file?</p>
```<code>#  -----------------------------Main program entry----------------------------
if __name__ == '__main__':
    #  Switch the working directory
    os.chdir('D:\\temp2')
    #  Switch the working directory
    print('Folder Location：{0}'.format(os.getcwd()))
    #  Get all excel files under the current working directory
    file_names = os.listdir()
    excel_file_names = [x for x in file_names if x.endswith('XLS')]
    print('Excel file：'.format(len(excel_file_names)))
    first_file_mtime = ''
    for excel_file_name in excel_file_names:
        print(excel_file_name)
        first_file_mtime = get_file_mtime(excel_file_name)
    print('\n')

    print('mtime is ：{0}'.format(first_file_mtime))
    print('\n')

    columns_you_want_to_delete = ['no_so', 'dt_doc','no_csh']

</code>```

Title: Python how to direct select excel file

Body:
My script is direct select a xls file at a location (d:\temp2}, once if my folder has more then one xls file will get error, so can I specify select a excel file?

#  -----------------------------Main program entry----------------------------
if __name__ == '__main__':
    #  Switch the working directory
    os.chdir('D:\\temp2')
    #  Switch the working directory
    print('Folder Location：{0}'.format(os.getcwd()))
    #  Get all excel files under the current working directory
    file_names = os.listdir()
    excel_file_names = [x for x in file_names if x.endswith('XLS')]
    print('Excel file：'.format(len(excel_file_names)))
    first_file_mtime = ''
    for excel_file_name in excel_file_names:
        print(excel_file_name)
        first_file_mtime = get_file_mtime(excel_file_name)
    print('\n')

    print('mtime is ：{0}'.format(first_file_mtime))
    print('\n')

    columns_you_want_to_delete = ['no_so', 'dt_doc','no_csh']


问:
How to return nil from a TextField?
I am trying to return nil if the TextField is empty.

This is my code:

```<code>import SwiftUI

func ??<T>(lhs: Binding<Optional<T>>, rhs: T) -> Binding<T> {
    Binding(get: { lhs.wrappedValue ?? rhs },
            set: { lhs.wrappedValue = $0 })
}

struct SomeView: View {

    @State private var string: String?

    var body: some View {
        VStack {
            TextField("Enter something", text: $string ?? "")

            Text(string ?? "This string is nil.")
        }

    }
}
</code>```

I am trying to get a nil value if the TextField is empty, but instead it just returns an empty string. How can I go about returning nil instead of an empty string? Any help is greatly appreciated.

Title: How to return nil from a TextField?

Body:
I am trying to return nil if the TextField is empty.

This is my code:

import SwiftUI

func ??<T>(lhs: Binding<Optional<T>>, rhs: T) -> Binding<T> {
    Binding(get: { lhs.wrappedValue ?? rhs },
            set: { lhs.wrappedValue = $0 })
}

struct SomeView: View {

    @State private var string: String?

    var body: some View {
        VStack {
            TextField("Enter something", text: $string ?? "")

            Text(string ?? "This string is nil.")
        }

    }
}

I am trying to get a nil value if the TextField is empty, but instead it just returns an empty string. How can I go about returning nil instead of an empty string? Any help is greatly appreciated.


问:
OSError: [WinError 6] with undetected chromedriver
```<code>Exception ignored in: <function Chrome.__del__ at 0x00000241BFF44360>
Traceback (most recent call last):
  File "C:\Users\kevin\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 769, in __del__
  File "C:\Users\kevin\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 758, in quit
OSError: [WinError 6] The handle is invalid
</code>```

The code runs without error through python console and I just wanna know if there is anyway to run the code without running it through the python console. My python version is 3.1.1., Chrome is the lastest version, and undetected chrome driver is also the lastest version.

```<code>import undetected_chromedriver.v2 as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')
</code>```

This is the code that I found from the undetected chromedriver github.

Body:
Exception ignored in: <function Chrome.__del__ at 0x00000241BFF44360>
Traceback (most recent call last):
  File "C:\Users\kevin\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 769, in __del__
  File "C:\Users\kevin\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 758, in quit
OSError: [WinError 6] The handle is invalid

The code runs without error through python console and I just wanna know if there is anyway to run the code without running it through the python console. My python version is 3.1.1., Chrome is the lastest version, and undetected chrome driver is also the lastest version.

import undetected_chromedriver.v2 as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')

This is the code that I found from the undetected chromedriver github.


问:
MSAL signout - how to determine if the user selects 'cancel' [Swift]
I am currently using MSAL signout function in my iOS app and have no way of knowing if the user selects 'Continue' or 'Cancel'. Currently, once log out is completed the user is taken back to the root screen of the app. However, I need to be able to stop the flow so that if the user chooses to cancel, they are still on the same screen before choosing the log out option.

```<code>private func signout(with account: MSALAccount, signoutParameters: MSALSignoutParameters, completion: @escaping () -> Void) {
        self.application.signout(with: account, signoutParameters: signoutParameters, completionBlock: { (result, error) in

            if error != nil {
                return
            }

            SharedStorage.authData = nil
            completion()
        })
    }
</code>```

The issue I have is that result returns true whether the user chooses continue or cancel and error returns nil. Curious if anyone has run into this issue before?

Body:
I am currently using MSAL signout function in my iOS app and have no way of knowing if the user selects 'Continue' or 'Cancel'. Currently, once log out is completed the user is taken back to the root screen of the app. However, I need to be able to stop the flow so that if the user chooses to cancel, they are still on the same screen before choosing the log out option.

private func signout(with account: MSALAccount, signoutParameters: MSALSignoutParameters, completion: @escaping () -> Void) {
        self.application.signout(with: account, signoutParameters: signoutParameters, completionBlock: { (result, error) in

            if error != nil {
                return
            }

            SharedStorage.authData = nil
            completion()
        })
    }

The issue I have is that result returns true whether the user chooses continue or cancel and error returns nil. Curious if anyone has run into this issue before?


问:
How to convert binary python file to a readable format
I have a binary file that supposed to be a python function and I want to read it. right now when I open it and print the data thats what I get:

```<code>b'c\x00\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00C\x00\x00\x00s3\x03\x00\x00d\x01\x00\x01\x03\x03\x03\t\x02\x02\t\x03\x03\x03\t\x02\x02\td\x02\x00d\x00\x00l\x00\x00}\x01\x00d\x02\x00d\x00\x00l\x01\x00}\x02\x00t\x02\x00\x83\x00\x00}\x03\x00d\x03\x00}\x00\x00t\x03\x00|\x03\x00\x83...'
</code>```

Does someone knows how I can convert from this format to a readable data.

This is my python file that gave the output.

```<code>file = open('flag_function', 'rb')
data = file.read()
print(data)
# convert the data to a readable format
</code>```

Body:
I have a binary file that supposed to be a python function and I want to read it. right now when I open it and print the data thats what I get:

b'c\x00\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00C\x00\x00\x00s3\x03\x00\x00d\x01\x00\x01\x03\x03\x03\t\x02\x02\t\x03\x03\x03\t\x02\x02\td\x02\x00d\x00\x00l\x00\x00}\x01\x00d\x02\x00d\x00\x00l\x01\x00}\x02\x00t\x02\x00\x83\x00\x00}\x03\x00d\x03\x00}\x00\x00t\x03\x00|\x03\x00\x83...'

Does someone knows how I can convert from this format to a readable data.

This is my python file that gave the output.

file = open('flag_function', 'rb')
data = file.read()
print(data)
# convert the data to a readable format


问:
EXCEL: Get next value for next highest matches
I have two input fields: Length and Width. Depending on those two inputs i want to retrieve a price from a price matrix. Preciscley that price should be taken where the length and width are either equal or the first time higher than what was entered. See the screenshot for the example please.

The inputs are 15,5 (length) & 5,5 (width). From the price matrix the price from the last row should be taken. Why? Because only in the last row length and width are both equal or higher than my two inputs.

Any tips are a highly appreciated!

Thank you!

I tried INDEX and MATCH. MATCH with +1,-1 didn't do the trick.


问:
javascript methods push (error name expected)
How do I send a value from a variable here?
opinions.${idGoogleUser}.push(articleData);

I need
opinions.id117074500003811940767.push(articleData);

```<code>function ioread(){
    let opinions = [];
    let articleData = {
        name: "fghdfghfghjfghfghfghfgh",
        comment: "cool site",
        url: "https://assets.teenvogue.com/photos/5d3875dcc6732300082916c8/16:9/w_2560%2Cc_limit/00-story.jpg",
        email: "articles@gmail.com",
        okres: "Okresy Bratislavy",
        byvanie: "V byte, V dome"
    }
    function reqListenerComments() {
        let idGoogleUser = id117074500003811940767;
        if (this.status === 200) {
            let responseJSON = JSON.parse(this.responseText)
            opinions = JSON.parse(this.responseText)
            //
            console.log(opinions);
            opinions.`${idGoogleUser}`.push(articleData); // ERROR
            console.log(opinions);
            //console.log(this.responseText);

            let postReqSettings = //an object wih settings of the request
                {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json;charset=utf-8',
                    },
                    body: JSON.stringify(opinions)
                }
            fetch(`https://api.npoint.io/7277534d6c85d7e10b53`, postReqSettings)
                .then(response => {      //fetch promise fullfilled (operation completed successfully)
                    if (response.ok) {    //successful execution includes an error response from the server. So we have to check the return status of the response here.
                        return response.json(); //we return a new promise with the response data in JSON to be processed
                    } else { //if we get server error
                        return Promise.reject(new Error(`Server answered with ${response.status}: ${response.statusText}.`)); //we return a rejected promise to be catched later
                    }
                })
                .finally(() =>
                    alert("ok")
                )
        }
    }

    var ajax = new XMLHttpRequest();
    ajax.addEventListener("load", reqListenerComments);
    ajax.open("GET", `https://api.npoint.io/7277534d6c85d7e10b53`, false);
    ajax.send();
}

</code>```

opinions.${idGoogleUser}.push(articleData);

I need
opinions.id117074500003811940767.push(articleData);

Body:
How do I send a value from a variable here?
opinions.${idGoogleUser}.push(articleData);

I need
opinions.id117074500003811940767.push(articleData);

function ioread(){
    let opinions = [];
    let articleData = {
        name: "fghdfghfghjfghfghfghfgh",
        comment: "cool site",
        url: "https://assets.teenvogue.com/photos/5d3875dcc6732300082916c8/16:9/w_2560%2Cc_limit/00-story.jpg",
        email: "articles@gmail.com",
        okres: "Okresy Bratislavy",
        byvanie: "V byte, V dome"
    }
    function reqListenerComments() {
        let idGoogleUser = id117074500003811940767;
        if (this.status === 200) {
            let responseJSON = JSON.parse(this.responseText)
            opinions = JSON.parse(this.responseText)
            //
            console.log(opinions);
            opinions.`${idGoogleUser}`.push(articleData); // ERROR
            console.log(opinions);
            //console.log(this.responseText);

            let postReqSettings = //an object wih settings of the request
                {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json;charset=utf-8',
                    },
                    body: JSON.stringify(opinions)
                }
            fetch(`https://api.npoint.io/7277534d6c85d7e10b53`, postReqSettings)
                .then(response => {      //fetch promise fullfilled (operation completed successfully)
                    if (response.ok) {    //successful execution includes an error response from the server. So we have to check the return status of the response here.
                        return response.json(); //we return a new promise with the response data in JSON to be processed
                    } else { //if we get server error
                        return Promise.reject(new Error(`Server answered with ${response.status}: ${response.statusText}.`)); //we return a rejected promise to be catched later
                    }
                })
                .finally(() =>
                    alert("ok")
                )
        }
    }

    var ajax = new XMLHttpRequest();
    ajax.addEventListener("load", reqListenerComments);
    ajax.open("GET", `https://api.npoint.io/7277534d6c85d7e10b53`, false);
    ajax.send();
}

opinions.${idGoogleUser}.push(articleData);

I need
opinions.id117074500003811940767.push(articleData);


问:
How i mask my cdn bucket link on google cloud plataform
I have my applications that generates a pdf that can be accessed by a link in the bucket of gcp, and this link its like "https://media-cdn.cloud.com.br/.../140../.../#" , there's a way I can mask this "media-cdn.cloud" and make it like'' https://myaplication.com.br/... "https://myaplication.com.br/.."?

i'm looking in the https://cloud.google.com/media-cdn#section-2 trying to find a way to mask this link and make it customizable but i'm not finding anything


问:
How to mass-upload categories to MediaWiki?
I've uploaded approx. 3000 text files and converted them into MediaWiki pages using the php script provided. These contain about 1000 new categories. I can't create these categories individually as it’s too tedious.

I attempted to use the Extension:Auto Create Category But this only creates categories when users manually save pages to MediaWiki.

Is there a way to upload a list of categories to be created automatically or an extension or php script to automatically create categories upon converting the text files to MediaWiki pages?


问:
Ant-D Tree "Half-Checked" Property
I'm trying to build what I'd assumed would be a relatively straightforward implementation of Ant-D's Tree component, and I'm running into issues.

Specifically, I'm unclear how to replicate the "half-checked" vs. "full-checked" behavior of their example. I'd like for the child nodes, when all fully checked, to also check their parent. Likewise when the parents are de-selected, I'd like all of the children to be deselected as well. Finally, when only some of a child nodes are checked/unchecked, the parent should go into a "half-checked" state.

The API seems to allow for this, and indeed they have an example here that purports to show off this functionality.

```<code><template>
  <a-tree
    v-model:selectedKeys="selectedKeys"
    v-model:checkedKeys="checkedKeys"
    default-expand-all
    checkable
    :height="233"
    :tree-data="treeData"
  >
    <template #title="{ title, key }">
      <span v-if="key === '0-0-1-0'" style="color: #1890ff">{{ title }}</span>
      <template v-else>{{ title }}</template>
    </template>
  </a-tree>
</template>
<script lang="ts">
import type { TreeProps } from 'ant-design-vue';
import { defineComponent, ref, watch } from 'vue';

function dig(path = '0', level = 3) {
  const list: TreeProps['treeData'] = [];
  for (let i = 0; i < 10; i += 1) {
    const key = `${path}-${i}`;
    const treeNode: TreeProps['treeData'][number] = {
      title: key,
      key,
    };

    if (level > 0) {
      treeNode.children = dig(key, level - 1);
    }

    list.push(treeNode);
  }
  return list;
}

export default defineComponent({
  setup() {
    const selectedKeys = ref<string[]>(['0-0-0', '0-0-1']);
    const checkedKeys = ref<string[]>(['0-0-0', '0-0-1']);
    watch(selectedKeys, () => {
      console.log('selectedKeys', selectedKeys);
    });
    watch(checkedKeys, () => {
      console.log('checkedKeys', checkedKeys);
    });

    return {
      treeData: dig(),
      selectedKeys,
      checkedKeys,
    };
  },
});
</script>
</code>```

It's not clear to me how this works. Nowhere are they setting the checkedKeys data. Is this handled internally by the tree? I've tried copying this example locally and it's not even working.

The documentation further states about the checkedKeys prop:

"When this specifies the key of a treeNode which is also a parent treeNode, all the children treeNodes of will be checked; and vice versa, when it specifies the key of a treeNode which is a child treeNode, its parent treeNode will also be checked. When checkable and checkStrictly is true, its object has checked and halfChecked property."

If this example does not have checkStrictly set to true, then how are only some of the nodes supposed to become "half checked"?

Title: Ant-D Tree "Half-Checked" Property

Body:
I'm trying to build what I'd assumed would be a relatively straightforward implementation of Ant-D's Tree component, and I'm running into issues.

Specifically, I'm unclear how to replicate the "half-checked" vs. "full-checked" behavior of their example. I'd like for the child nodes, when all fully checked, to also check their parent. Likewise when the parents are de-selected, I'd like all of the children to be deselected as well. Finally, when only some of a child nodes are checked/unchecked, the parent should go into a "half-checked" state.

The API seems to allow for this, and indeed they have an example here that purports to show off this functionality.

<template>

    <template #title="{ title, key }">
      {{ title }}
      <template v-else>{{ title }}</template>
    </template>

</template>

It's not clear to me how this works. Nowhere are they setting the checkedKeys data. Is this handled internally by the tree? I've tried copying this example locally and it's not even working.

The documentation further states about the checkedKeys prop:

"When this specifies the key of a treeNode which is also a parent treeNode, all the children treeNodes of will be checked; and vice versa, when it specifies the key of a treeNode which is a child treeNode, its parent treeNode will also be checked. When checkable and checkStrictly is true, its object has checked and halfChecked property."

If this example does not have checkStrictly set to true, then how are only some of the nodes supposed to become "half checked"?


问:
Transparency issue with Scenekit renderer on arkit
I have an odd behaviour in certain conditions when I have two geometries one above the other and the first one at least has alpha value != 0.

I am using a program for the SCNMaterial, program is in metal and does simple stuff, color out is of the type

float4(color.x * alpha, color.y * alpha, color.z * alpha, alpha)

The geometry doesn't really influence the behaviour, but for the shake of explanation I have a SCNPlane on the back and an SCNCyclinder on the front.

It all looks good until camera it's perpendicular +/- 30 degs more or less, see below

As you can see you have a bluish background and then a cylinder few centimeters in front of it, it is semi transparent and we can clearly see the bluish behind it.

Whenever the camera get passed +/- 30 from being perpendicular, we can see through the background because it is not anymore rendered in corrispondence of the cylinder, see the one on the left

Basically when it is parpendicular or so the two layers are summed up and give the correct result, when reached that cone of angles only the layer on the top is rendered.

What I am missing here to make it as it should.

Not using any priority for the rendering as I am aware.

Thank you.


问:
How to suppress MongoSocketOpenException in the logs - Exception in monitor thread while connecting to server localhost:27017
I have a micro batch that runs every 5 mins, it works fine, but everytime it runs it'll throw that error in the logs at the beginning and then continue without any issues:

```<code>org.mongodb.driver.cluster               : Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67)
    at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:81)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
    at java.net.Socket.connect(Socket.java:606)
    at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62)
</code>```

Connection String in the properties file: mongoDBConnectionString=mongodb://svc.myserviceid:xxxxxxxxxx@server1.mycompany.com:30200,server2.mycompany.com:30200,/?authMechanism=PLAIN&replicaSet=myreplicateset&readPreference=primaryPreferred&authSource=$external&ssl=true mongoDBName=mydatabase

Spring boot version: 1.5.3.RELEASE

Mongo version:

```<code><dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>3.8.2</version>
</dependency>
</code>```

Here is my main Spring boot class:

```<code>@SpringBootApplication
@EnableTask
public class xxApplication { ... }
</code>```

I tried excluding (exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class}) with or without @EnableAutoConfiguration and it didn't work.

I tried adding indiviual spring properties in the properties file, and it didn't work either.

Let me know if there is anything I can do to prevent this from showing in the logs.

Body:
I have a micro batch that runs every 5 mins, it works fine, but everytime it runs it'll throw that error in the logs at the beginning and then continue without any issues:

org.mongodb.driver.cluster               : Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67)
    at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:81)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
    at java.net.Socket.connect(Socket.java:606)
    at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62)

Connection String in the properties file: mongoDBConnectionString=mongodb://svc.myserviceid:xxxxxxxxxx@server1.mycompany.com:30200,server2.mycompany.com:30200,/?authMechanism=PLAIN&replicaSet=myreplicateset&readPreference=primaryPreferred&authSource=$external&ssl=true mongoDBName=mydatabase

Spring boot version: 1.5.3.RELEASE

Mongo version:

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>3.8.2</version>
</dependency>

Here is my main Spring boot class:

@SpringBootApplication
@EnableTask
public class xxApplication { ... }

I tried excluding (exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class}) with or without @EnableAutoConfiguration and it didn't work.

I tried adding indiviual spring properties in the properties file, and it didn't work either.

Let me know if there is anything I can do to prevent this from showing in the logs.


问:
Optional parameter for prefix in Laravel
I'm trying to add an optional parameter in Laravel for group routes using prefix, but it doesn't work.

In the Laravel documentation I see:

Make sure to give the route's corresponding variable a default value

But how do I do it for prefixes? I see example only for a special route, but I need it for a group of routes.

I use Laravel 8.0.

There may or may not be space here, but it only works when there is space.

Route::middleware('api')
    ->prefix('v1/{space?}/')
    ->namespace($this->namespace)
    ->group(__DIR__ . '/../api.php');
```


问:
How to avoid unrecognised callback in Rails Class after calling skip_callback for the first time
I'm getting a error in a RoR application where there's a new feature using skip_callback method.

```<code>class Foo
    before_save: :some_callback

    def some_callback
    end
end
</code>```

When there's multiples call to the class, raise Argument error because of rails functionality created on this commit.

```<code># I using this only with the purpose of showing the error,
# I know that the block will execute without errors if calling set_callback after skip:
5.times do
   Foo.skip_callback(:save, :before, :some_callback)
end
ArgumentError (Before save callback :some_callback has not been defined)
</code>```

I know that I can avoid raise a error if I use the method like this

```<code>skip_callback(:save, :before, :some_callback, raise: false)
</code>```

But I don't really feel 100% confident of this approach, there's a better way to skip calling the callbacks without raising a error if call the class multiple times? I'm afraid another part of the code, call the same class and don't call the callback when it's needed.

Body:
I'm getting a error in a RoR application where there's a new feature using skip_callback method.

class Foo
    before_save: :some_callback

    def some_callback
    end
end

When there's multiples call to the class, raise Argument error because of rails functionality created on this commit.

# I using this only with the purpose of showing the error,
# I know that the block will execute without errors if calling set_callback after skip:
5.times do
   Foo.skip_callback(:save, :before, :some_callback)
end
ArgumentError (Before save callback :some_callback has not been defined)

I know that I can avoid raise a error if I use the method like this

skip_callback(:save, :before, :some_callback, raise: false)

But I don't really feel 100% confident of this approach, there's a better way to skip calling the callbacks without raising a error if call the class multiple times? I'm afraid another part of the code, call the same class and don't call the callback when it's needed.


问:
Is there a best practice for dropping dupes from a dataframe with many, many columns?
I am merging two dataframes with quite a few columns and the IDs are repeating in one dataframe, so I'm getting a lot of dupes in the merged dataframe. I'm wondering if there is a best way to figure out which columns are actual dupes and leverage that logic to drop dupes.

I'm doing this...

```<code>df_final = df.drop_duplicates(subset=['field1', 'field2','field3', 'field4', 'field5', 'field6'], keep='first')
</code>```

There are many more fields. If I add too few, I don't get enough records dropped and if I add too many, or the wrong ones, I get too many records dropped. How can I figure out what's a true dupe and not a dupe and drop only dupes? Finally, the first dataframe has around 31k records and the second has around 9k records. I would expect the df_final to have around 31k records.

Body:
I am merging two dataframes with quite a few columns and the IDs are repeating in one dataframe, so I'm getting a lot of dupes in the merged dataframe. I'm wondering if there is a best way to figure out which columns are actual dupes and leverage that logic to drop dupes.

I'm doing this...

df_final = df.drop_duplicates(subset=['field1', 'field2','field3', 'field4', 'field5', 'field6'], keep='first')

There are many more fields. If I add too few, I don't get enough records dropped and if I add too many, or the wrong ones, I get too many records dropped. How can I figure out what's a true dupe and not a dupe and drop only dupes? Finally, the first dataframe has around 31k records and the second has around 9k records. I would expect the df_final to have around 31k records.


问:
SuperCollider FreqScope axis values do not correspond to frequencies
I have a problem with FreqScope in SuperCollider. The signal frequency does not correspond to the frequency axis. If I start a Sinus-Ugen with
{SinOsc.ar (1000)}.play;
I get the following picture

I use SuperCollider 3.11.2 on a Debian Linux 11.5 BullsEye OS.
Any idea, why this happens and perhaps how to solve this?


问:
How do I remove the limit or keep getting data on the Radlibrary package?
I am currently using the Radlibrary package. I used the following code:

```<code>query <- adlib_build_query(ad_active_status = "ALL",
                          ad_delivery_date_max = "2022-11-08",
                          ad_delivery_date_min = "2022-06-24",
                          ad_reached_countries = "US",
                          ad_type = "POLITICAL_AND_ISSUE_ADS",
                           search_terms = "democrat",
                          publisher_platforms = "FACEBOOK",
                           fields = c('id',
                                      'ad_creation_time',
                                      'ad_creative_bodies',
                                      'ad_creative_link_captions',
                                      'ad_creative_link_descriptions',
                                      'ad_creative_link_titles',
                                      'ad_delivery_start_time',
                                      'ad_delivery_stop_time',
                                      'ad_snapshot_url',
                                      'bylines',
                                      'currency',
                                      'delivery_by_region',
                                      'estimated_audience_size',
                                      'languages',
                                      'page_id',
                                      'page_name',
                                      'spend',
                                      'publisher_platforms',
                                      'demographic_distribution',
                                      'impressions'))
response <- adlib_get(query)
data <- as_tibble(response)
</code>```

I've noticed that I only get 1000 observations at a time from that time frame? Is there an efficient way to be able to collect all the observations within the time frame? I've thought about changing the "stop time" based on the last date in the dataset, but that might take a long time if there are a lot of ads in the span of a few days. Any suggestions?

Body:
I am currently using the Radlibrary package. I used the following code:

query <- adlib_build_query(ad_active_status = "ALL",
                          ad_delivery_date_max = "2022-11-08",
                          ad_delivery_date_min = "2022-06-24",
                          ad_reached_countries = "US",
                          ad_type = "POLITICAL_AND_ISSUE_ADS",
                           search_terms = "democrat",
                          publisher_platforms = "FACEBOOK",
                           fields = c('id',
                                      'ad_creation_time',
                                      'ad_creative_bodies',
                                      'ad_creative_link_captions',
                                      'ad_creative_link_descriptions',
                                      'ad_creative_link_titles',
                                      'ad_delivery_start_time',
                                      'ad_delivery_stop_time',
                                      'ad_snapshot_url',
                                      'bylines',
                                      'currency',
                                      'delivery_by_region',
                                      'estimated_audience_size',
                                      'languages',
                                      'page_id',
                                      'page_name',
                                      'spend',
                                      'publisher_platforms',
                                      'demographic_distribution',
                                      'impressions'))
response <- adlib_get(query)
data <- as_tibble(response)

I've noticed that I only get 1000 observations at a time from that time frame? Is there an efficient way to be able to collect all the observations within the time frame? I've thought about changing the "stop time" based on the last date in the dataset, but that might take a long time if there are a lot of ads in the span of a few days. Any suggestions?


问:
Adobe Air for mobile: Why is addElement (to a view) so slow? How can I optimize this?
I am building an application for a mobile phone, using Flash Builder 4.5 and Adobe air. I use a flex mobile project. However, at certain times I need to add 10, 20 dynamic elements to a scroll list for example, these elements cannot be created in flex beforehand, seeing as I get them from a server (images and the like).

However, when I add them using addElement (to a view) it takes quite a long time. I tested it on the iPhone 3GS, and it takes about 150 to 200 miliseconds per element. This is with the most recent version of air, and packaged the best way possible. I have also experimented with cpu and gpu rendermodes, which did not seem to affect things at all.

Is there a way to speed this up? Alternatively (or even better, additionally), is there a way to cache views, so they do not need to be recreated every time I open a view? I use the ViewNavigator to navigate to views.

ContentLicense: CC BY-SA 3.0


问:
Create UnsafeMutableRawPointer from NSData
I'm converting a ObjC tutorial (Apple's Selecting Device Objects for Compute Processing tutorial, in particular) to Swift.

I am doing it in increments, so I have to interface to some code still written in ObjC. I'm getting this error:

Cannot convert value of type UnsafeRawPointer to specified type UnsafeMutableRawPointer

How can I fix this error without changing the parameter type passed into the func? My snippet of Swift code is:

  func providePositionData(_inout data: NSData) {
    // Synchronize since positions buffer will be used on another thread
    objc_sync_enter(self)

    let rawPtr: UnsafeMutableRawPointer = data.bytes
/* error here: Cannot convert value of type 'UnsafeRawPointer' to specified type 'UnsafeMutableRawPointer' */

    let positionsBuffer = device.makeBuffer(
      bytesNoCopy: rawPtr,
      length: data.count,
      options: .storageModeManaged,
      deallocator: nil)

    positionsBuffer!.label = "Provided Positions"

    positionsBuffer?.__didModifyRange(NSRange(location: 0, length: data.count))

    self.positionsBuffer = positionsBuffer
    objc_sync_exit(self)
  }
```
<p>The working ObjC code is:</p>
<pre class="lang-objectivec prettyprint-override"><code>/// Called to provide positions data to be rendered on the next frame
- (void)providePositionData:(NSData *)data
{
    // Synchronize since positions buffer will be used on another thread
    @synchronized(self)
    {
        // Cast from 'const void *' to 'void *' which is okay in this case since updateData was
        // created with -[NSData initWithBytesNoCopy:length:deallocator:] and underlying memory was
        // allocated with vm_allocate
      void *vmAllocatedAddress = (void *)data.bytes;

        // Create a MTLBuffer with out copying the data
        id<MTLBuffer> positionsBuffer = [_device newBufferWithBytesNoCopy:vmAllocatedAddress
                                                                   length:data.length
                                                                  options:MTLResourceStorageModeManaged
                                                              deallocator:nil];

        positionsBuffer.label = @"Provided Positions";

        [positionsBuffer didModifyRange:NSMakeRange(0, data.length)];

        _positionsBuffer = positionsBuffer;
    }
}
</code>```

The NSData that is sent in come from ObjC code that wraps the MTLBuffer in NSData to allow the app to perform memory management. Here is the working snippet:

// Wrap the memory allocated with vm_allocate with a NSData object which will allow the app to
// rely on ObjC ARC (or even MMR) to manage the memory's lifetime. Initialize NSData object
// with a deallocation block to free the vm_allocated memory when the object has been
// deallocated
{
  // Block to dealloc memory created with vm_allocate
  void (^deallocProvidedAddress)(void *bytes, NSUInteger length) =
  ^(void *bytes, NSUInteger length)
  {
    vm_deallocate((vm_map_t)mach_task_self(),
                  (vm_address_t)bytes,
                  length);
  };

  NSData *positionData = [[NSData alloc] initWithBytesNoCopy:positionDataAddress
                                                      length:positionDataSize
                                                 deallocator:deallocProvidedAddress];

  NSData *velocityData = [[NSData alloc] initWithBytesNoCopy:velocityDataAddress
                                                      length:velocityDataSize
                                                 deallocator:deallocProvidedAddress];

  dataProvider(positionData, velocityData, time);
}
```

Body:
I'm converting a ObjC tutorial (Apple's Selecting Device Objects for Compute Processing tutorial, in particular) to Swift.

I am doing it in increments, so I have to interface to some code still written in ObjC. I'm getting this error:

Cannot convert value of type UnsafeRawPointer to specified type UnsafeMutableRawPointer

How can I fix this error without changing the parameter type passed into the func? My snippet of Swift code is:

  func providePositionData(_inout data: NSData) {
    // Synchronize since positions buffer will be used on another thread
    objc_sync_enter(self)

    let rawPtr: UnsafeMutableRawPointer = data.bytes
/* error here: Cannot convert value of type 'UnsafeRawPointer' to specified type 'UnsafeMutableRawPointer' */

    let positionsBuffer = device.makeBuffer(
      bytesNoCopy: rawPtr,
      length: data.count,
      options: .storageModeManaged,
      deallocator: nil)

    positionsBuffer!.label = "Provided Positions"

    positionsBuffer?.__didModifyRange(NSRange(location: 0, length: data.count))

    self.positionsBuffer = positionsBuffer
    objc_sync_exit(self)
  }

The working ObjC code is:

/// Called to provide positions data to be rendered on the next frame
- (void)providePositionData:(NSData *)data
{
    // Synchronize since positions buffer will be used on another thread
    @synchronized(self)
    {
        // Cast from 'const void *' to 'void *' which is okay in this case since updateData was
        // created with -[NSData initWithBytesNoCopy:length:deallocator:] and underlying memory was
        // allocated with vm_allocate
      void *vmAllocatedAddress = (void *)data.bytes;

        // Create a MTLBuffer with out copying the data
        id<MTLBuffer> positionsBuffer = [_device newBufferWithBytesNoCopy:vmAllocatedAddress
                                                                   length:data.length
                                                                  options:MTLResourceStorageModeManaged
                                                              deallocator:nil];

        positionsBuffer.label = @"Provided Positions";

        [positionsBuffer didModifyRange:NSMakeRange(0, data.length)];

        _positionsBuffer = positionsBuffer;
    }
}

The NSData that is sent in come from ObjC code that wraps the MTLBuffer in NSData to allow the app to perform memory management. Here is the working snippet:

// Wrap the memory allocated with vm_allocate with a NSData object which will allow the app to
// rely on ObjC ARC (or even MMR) to manage the memory's lifetime. Initialize NSData object
// with a deallocation block to free the vm_allocated memory when the object has been
// deallocated
{
  // Block to dealloc memory created with vm_allocate
  void (^deallocProvidedAddress)(void *bytes, NSUInteger length) =
  ^(void *bytes, NSUInteger length)
  {
    vm_deallocate((vm_map_t)mach_task_self(),
                  (vm_address_t)bytes,
                  length);
  };

  NSData *positionData = [[NSData alloc] initWithBytesNoCopy:positionDataAddress
                                                      length:positionDataSize
                                                 deallocator:deallocProvidedAddress];

  NSData *velocityData = [[NSData alloc] initWithBytesNoCopy:velocityDataAddress
                                                      length:velocityDataSize
                                                 deallocator:deallocProvidedAddress];

  dataProvider(positionData, velocityData, time);
}


问:
How to enable "switch between automatic and tab-only IntelliSense completion" option in vs2022?
I have an interesting problem. I have the "switch between automatic and tab-only IntelliSense completion" option turned off and I don't know how to turn it on. In Tools->Options->Text Editor -> Advanced, I have automatic completion, although only tab-only works. Does anyone know how to enable this option? It is Visual Studio 2022.


问:
how to use run impala command from Airflow
I have a task to run a query on impala, from airflow .Not sure how to do that ?
I tried Impala query using Airflow but no luck .</p>


问:
Order Search Bar Woocommerce doesn't work when you do search a order
I need help to get the order search bar fixed it on our website. Short Story; We updated the woocoomerce plugin and We realiced it's was affecting other functionalities on the site. So we decided to rolled back to previously version.  From that moment the Order search bar stop working well. When I do type a order number or customer name  it doesn't find it. it throws  a list of orders but no the orders searched. How Can I fix this? I have about 4 days trying to find a solution...but it seems nothing works.</p>
```<code>// Fixing search orders
function custom_woocommerce_shop_order_search_fields( $search_fields ) {

    // error_log( 'currently searching in these order fields: ' . print_r($search_fields, true) );
    unset( $search_fields );
    $search_fields[] = 'order_id';
    $search_fields[] = 'first_name';
    $search_fields[] = 'billing_email';
    $search_fields[] = 'last_name';

    // error_log( 'now only searching in these order fields: ' . print_r($search_fields, true) );
    return $search_fields;

}
add_filter( 'woocommerce_shop_order_search_fields', 'custom_woocommerce_shop_order_search_fields' );
</code>```

Body:
I need help to get the order search bar fixed it on our website. Short Story; We updated the woocoomerce plugin and We realiced it's was affecting other functionalities on the site. So we decided to rolled back to previously version.  From that moment the Order search bar stop working well. When I do type a order number or customer name  it doesn't find it. it throws  a list of orders but no the orders searched. How Can I fix this? I have about 4 days trying to find a solution...but it seems nothing works.

// Fixing search orders
function custom_woocommerce_shop_order_search_fields( $search_fields ) {

    // error_log( 'currently searching in these order fields: ' . print_r($search_fields, true) );
    unset( $search_fields );
    $search_fields[] = 'order_id';
    $search_fields[] = 'first_name';
    $search_fields[] = 'billing_email';
    $search_fields[] = 'last_name';

    // error_log( 'now only searching in these order fields: ' . print_r($search_fields, true) );
    return $search_fields;

}
add_filter( 'woocommerce_shop_order_search_fields', 'custom_woocommerce_shop_order_search_fields' );


问:
Could not load file or assembly - when all dependency present and all sign present and assembly loading to GAC
I try to deploy COM-object to my server, I have deployed to this server a lot of objects and always all going fine, but not at this time.

Firstly, COM-object registered successfully and ProgID is present.

Secondary, all dependency is present and loading successfully.

Third point, I checked all sign and all sign is present.

Forth point I add all library to GAC.

Test is ordinary and no matter, this is simple call my COM-object.

It's look as all checkpoint done and test must be working. However, I see error

```<code>Could not load file or assembly 'HtmlRenderer.PdfSharp, Version=1.5.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
</code>```

I can not understand this trouble. What going wrong?

Body:
I try to deploy COM-object to my server, I have deployed to this server a lot of objects and always all going fine, but not at this time.

Firstly, COM-object registered successfully and ProgID is present.

Secondary, all dependency is present and loading successfully.

Third point, I checked all sign and all sign is present.

Forth point I add all library to GAC.

Test is ordinary and no matter, this is simple call my COM-object.

It's look as all checkpoint done and test must be working. However, I see error

Could not load file or assembly 'HtmlRenderer.PdfSharp, Version=1.5.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

I can not understand this trouble. What going wrong?


问:
Get TreeView item text related to current item handling WM_NOTIFY / NM_CUSTOMDRAW?
Subject says it all.  Is there a way when handling NM_CUSTOMDRAW for a tree view to get the text of the item currently being drawn?

Thanks.


问:
How to apply datetime aggregation to column in Pyspark table
I have a date column, "DayDate", that I'd like to use to create columns with varying degrees of date time aggregations. For example, whatever the date is in the column, subtract 1 year, 2, years, and 3 years in three new columns.

I am using Pyspark to create the tables using date_sub currently but I have to repeat this process quite a few times in my notebook in other tables and would prefer to create a variable or something of the like where I can apply it to other tables I'm building.

I have the following code that I've been messing with and the old version I'm using but again, I want to create the most efficient way to do this since it's repeating in multiple other tables.

Original syntax:

```<code>time_agg = (spark.read.format("delta").table("db.dates")
              .select(
date_sub("DayDate",364).alias("Last_Year"),
date_sub("DayDate",728).alias("Two_Year"),
date_sub("DayDate",1092).alias("Three_Year")
))
</code>```

What I tried doing:

```<code>lastRun = spark.read.format("delta").table("db.dates").select('DayDate').collect()[0][0]
Last_Year= lastRunDate - datetime.timedelta(days=364)
Two_Year = lastRunDate - datetime.timedelta(days=728)
Three_Year = lastRunDate - datetime.timedelta(days=1092)

time_agg = (spark.read.format("delta").table("db.dates")
              .select("DayDate")
              .withColumn("Last_Year", Last_Year(col("DayDate")))
              .withColumn("Two_Year", Two_Year(col("DayDate")))
              .withColumn("Three_Year", Three_Year(col("DayDate")))
)
</code>```

Body:
I have a date column, "DayDate", that I'd like to use to create columns with varying degrees of date time aggregations. For example, whatever the date is in the column, subtract 1 year, 2, years, and 3 years in three new columns.

I am using Pyspark to create the tables using date_sub currently but I have to repeat this process quite a few times in my notebook in other tables and would prefer to create a variable or something of the like where I can apply it to other tables I'm building.

I have the following code that I've been messing with and the old version I'm using but again, I want to create the most efficient way to do this since it's repeating in multiple other tables.

Original syntax:

time_agg = (spark.read.format("delta").table("db.dates")
              .select(
date_sub("DayDate",364).alias("Last_Year"),
date_sub("DayDate",728).alias("Two_Year"),
date_sub("DayDate",1092).alias("Three_Year")
))

What I tried doing:

lastRun = spark.read.format("delta").table("db.dates").select('DayDate').collect()[0][0]
Last_Year= lastRunDate - datetime.timedelta(days=364)
Two_Year = lastRunDate - datetime.timedelta(days=728)
Three_Year = lastRunDate - datetime.timedelta(days=1092)

time_agg = (spark.read.format("delta").table("db.dates")
              .select("DayDate")
              .withColumn("Last_Year", Last_Year(col("DayDate")))
              .withColumn("Two_Year", Two_Year(col("DayDate")))
              .withColumn("Three_Year", Three_Year(col("DayDate")))
)


问:
All Inertia requests must receive a valid Inertia response, however a plain JSON response was received
I have a problem using routes with inertia, I'm using AdonisJS + Inertia + Svelte

Everything running perfectly, but when clicking on links of routes it only returns me this problem

My Home.svelte:

My router:

```<code>Route.get('/second', 'SecondsController.index')
</code>```

Controller:

```<code>import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

export default class PostsController {
  public async index({ inertia }: HttpContextContract) {
    const mydata = {
        title: "Second Page",
        content: "Some content here.",
      };

    return inertia.render('Second', { mydata })
  }
}
</code>```

Message I receive when clicking on the link:

This message simply appears and does not go to the other page

Body:
I have a problem using routes with inertia, I'm using AdonisJS + Inertia + Svelte

Everything running perfectly, but when clicking on links of routes it only returns me this problem

My Home.svelte:

My router:

Route.get('/second', 'SecondsController.index')

Controller:

import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

export default class PostsController {
  public async index({ inertia }: HttpContextContract) {
    const mydata = {
        title: "Second Page",
        content: "Some content here.",
      };

    return inertia.render('Second', { mydata })
  }
}

Message I receive when clicking on the link:

This message simply appears and does not go to the other page


问:
Microsoft Azure, issue with open ports
Currently hosting a microsoft azure server that has a SCP: Secret laboratory game server on it.

OS: Ubuntu 20.04

After setting up the server and downloading the server files, I can't seem to connect to the server. The port that is needed for the game server is 7777 and I have the port open under NSG with UDP and TCP protocol, but after using multiple port checkers and trying to connect in game, I always got the port closed answer or was given a connection error.

I have tried using the azure's own troubleshooter, but that says the ports are open. Tried different ports like 7778 or 7779. Checked the firewall, but I dont even have it enabled.

Title: Microsoft Azure, issue with open ports