问:
.Ner core 6.0 - I'am getting "Internal Server Error" when i call certain url from Api but no error with other url
I have this Exception/Error only with e.g. https://www.exapmple.com but not with https://example1.com or https://example2.com etc.

```<code>var url = "https://www.example.com";

ExampleDTO m = new ExampleDTO();

string resp;

using (HttpResponseMessage response = await _httpClient.GetAsync(url))
{
    if (response.IsSuccessStatusCode)
    {
        resp = await response.Content.ReadAsStringAsync();
    }
    else
    {
        throw new Exception(await response.Content.ReadAsStringAsync());
    }
}
</code>```

My Program.cs

```<code>var builder = WebApplication.CreateBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("ExampleDatabase") ?? throw new NullReferenceException("No Connection string in config!");

builder.Services.AddDbContext<ExampleDbContext>(options =>
{
    options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
});

builder.Services.AddScoped<IExampleService, ExampleService>();

builder.Services.AddHttpContextAccessor();
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();

var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseWebAssemblyDebugging();
}
else
{
    app.UseExceptionHandler("/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseCors(x => x
    .SetIsOriginAllowed(_ => true)
    .AllowAnyMethod()
    .AllowAnyHeader()
    .AllowCredentials());

app.UseHttpsRedirection();

app.UseBlazorFrameworkFiles();
app.UseStaticFiles();

app.UseRouting();

app.MapRazorPages();
app.MapControllers();
app.MapFallbackToFile("index.html");

app.Run();
</code>```

I thought from the begenning  it was "XmlHttpRequest Block by CORS – No Access-Control-Allow-Origin" Problem but it was not or i could not solve it properly. maybe i have to .AllowCredentials() for https://www.exapmple.com?

Any idea? Thanks in advance!

Body:
I have this Exception/Error only with e.g. https://www.exapmple.com but not with https://example1.com or https://example2.com etc.

var url = "https://www.example.com";

ExampleDTO m = new ExampleDTO();

string resp;

using (HttpResponseMessage response = await _httpClient.GetAsync(url))
{
    if (response.IsSuccessStatusCode)
    {
        resp = await response.Content.ReadAsStringAsync();
    }
    else
    {
        throw new Exception(await response.Content.ReadAsStringAsync());
    }
}

My Program.cs

var builder = WebApplication.CreateBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("ExampleDatabase") ?? throw new NullReferenceException("No Connection string in config!");

builder.Services.AddDbContext<ExampleDbContext>(options =>
{
    options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
});

builder.Services.AddScoped<IExampleService, ExampleService>();

builder.Services.AddHttpContextAccessor();
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();

var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseWebAssemblyDebugging();
}
else
{
    app.UseExceptionHandler("/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseCors(x => x
    .SetIsOriginAllowed(_ => true)
    .AllowAnyMethod()
    .AllowAnyHeader()
    .AllowCredentials());

app.UseHttpsRedirection();

app.UseBlazorFrameworkFiles();
app.UseStaticFiles();

app.UseRouting();

app.MapRazorPages();
app.MapControllers();
app.MapFallbackToFile("index.html");

app.Run();

I thought from the begenning  it was "XmlHttpRequest Block by CORS – No Access-Control-Allow-Origin" Problem but it was not or i could not solve it properly. maybe i have to .AllowCredentials() for https://www.exapmple.com?

Any idea? Thanks in advance!


来源: stackexchange

问:
Where to file bugreports for github codespaces about prebuild action
My project has enabled github code spaces, while cleaning up the github actions in the project I noticed a depreciation warning in a job I did not recognize: Codespaces Prebuild. Obviously this is related to the code-spaces feature we use.

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/upload-artifact@v2`

The fix for above problem is trivial just change actions/upload-artifact@v2 to actions/upload-artifact@v3 but the source code for this action does not seem to be defined in my project and I assume it resides in a repo owned by github.

So the question is where is this action defined or to where can I submit a pull request/bug report?

ContentLicense: CC BY-SA 4.0


问:
Can we eliminate required additional state from a hashtable when implementing removals without tombstones?
I'm currently experimenting with different hashtable implementations (in C if it matters), and one of the implementations that I'm examining uses open-addressing, linear probing, and no tombstones.

I am using an algorithm for removals from the following stack overflow answer.

https://stackoverflow.com/a/24886657/7623056

In this algorithm, we need to check if a slot is unoccupied. This makes me think that we need additional state to determine whether slots are occupied or unoccupied. For example, we simply cannot check if all bits in the slot are zero, because it is possible to insert a valid key, value where all bits just happen to be zero, even if this is extremely unlikely.

Are there any strategies that could eliminate this additional state?

One possibility is to force the user to supply a key that will never be used, which will then be stored in all empty locations. However, this is undesirable in situations where the user cannot predict which keys could remain unused.

Another possibility that I can think of would be to store the hash with the key and develop a hash function that is guaranteed to never produce one specific value. This hash value will then be stored in all empty slots. For example, we could select the hash value 0. Then, in the real hash function, any time 0 is produced, we could just return 1. However this seems like an undesirable solution because this will remove the uniform distribution property of our hash function.

Edit: I've been thinking about this more, and I think that the second solution might be the best. Since we mod the hash value by the number of buckets, the uniform distribution property isn't as important for hashtables as it is for cryptographic applications such as an hMAC. So maybe a better question is: will this relaxation of the hash function lead to any undesirable consequences that I haven't thought of? For example, would this make it easier for an attacker to reverse engineer the hash function and perform a DOS attack? Could this be mitigated with robin-hood hashing, since it minimizes the cluster size?


问:
Assistance needed with pygame Super Mario first level re-creation want to make goombas move automatically
I am currently trying to re-create the first level off super mario bros. I am using pygame, and have one issue occurring. I make the map out of a text file, which turns into a game_map (2D array), and I loop through it every frame to make sure the  map is being updated. However, I also utilized a scrolling feature with the game. This makes it difficult to have enemies in there. I utilize a dictionary to hold all of the goombas that spawn (since we can only have one goomba, and dont want to spawn hundreds of them per frame). Here is the code, I would love some suggestions as how to make the goombas move! When I currently run the game with this code, the goombas do not move.

```<code># Import Libaries
import random
import pygame, sys, os
from pygame.locals import *

pygame.init()

#####################################SETUP##################################
clock = pygame.time.Clock()
# Creates window for the game
pygame.display.set_caption("Kamil's Trio FIRST GAME!")
WIDTH = 900
HEIGHT = 600
WINDOW = pygame.display.set_mode((WIDTH, HEIGHT))
tile_size = 50
PLAYER_WIDTH, PLAYER_HEIGHT = 40, 40

#Defining all images used and scales them to fit on WINDOW

BACKGROUND = pygame.image.load("Assets/mariobackground.jpg").convert_alpha()
BACKGROUND = pygame.transform.scale(BACKGROUND, (WIDTH, HEIGHT))

GROUND_BRICK = pygame.image.load(
    "Assets/Sprites/Blocks/ground_brick.png").convert_alpha()
GROUND_BRICK = pygame.transform.scale(GROUND_BRICK, (tile_size, tile_size))

BRICK = pygame.image.load("Assets/Sprites/Blocks/brick.png").convert_alpha()
BRICK = pygame.transform.scale(BRICK, (tile_size, tile_size))

HARD_BLOCK = pygame.image.load(
    "Assets/Sprites/Blocks/hard_block.png").convert_alpha()
HARD_BLOCK = pygame.transform.scale(HARD_BLOCK, (tile_size, tile_size))

Q_BLOCK = pygame.image.load(
    "Assets/Sprites/Blocks/question_block.gif").convert_alpha()
Q_BLOCK = pygame.transform.scale(Q_BLOCK, (tile_size, tile_size))

PIPE_TOP = pygame.image.load(
    "Assets/Sprites/Blocks/pipe_top.png").convert_alpha()
PIPE_TOP = pygame.transform.scale(PIPE_TOP, (tile_size * 2, tile_size))

PIPE_BODY = pygame.image.load(
    "Assets/Sprites/Blocks/pipe_body.png").convert_alpha()
PIPE_BODY = pygame.transform.scale(PIPE_BODY, (tile_size * 2, tile_size))

PLAYER_RIGHT = pygame.image.load(
    "Assets/Sprites/Mario/standing_still.png").convert_alpha()
PLAYER_RIGHT = pygame.transform.scale(PLAYER_RIGHT,
                                      (PLAYER_WIDTH, PLAYER_HEIGHT))

CASTLE = pygame.image.load(
    "Assets/Sprites/Blocks/bowser_castle.png").convert_alpha()
CASTLE = pygame.transform.scale(CASTLE, (tile_size * 5, tile_size * 5))

COIN = pygame.image.load("Assets/Sprites/Items/coin.png").convert_alpha()
COIN = pygame.transform.scale(COIN, (tile_size * 5, tile_size * 5))

USED_BlOCK = pygame.image.load(
    "Assets/Sprites/Blocks/used_block.png").convert_alpha()
USED_BLOCK = pygame.transform.scale(USED_BlOCK, (tile_size, tile_size))

MUSHROOM = pygame.image.load(
    "Assets/Sprites/Items/Mushroom.png").convert_alpha()
MUSHROOM = pygame.transform.scale(MUSHROOM, (tile_size, tile_size))

JUMPING_SURFACE = pygame.image.load(
    "Assets/Sprites/Mario/mario_jump.png").convert_alpha()
JUMPING_SURFACE = pygame.transform.scale(JUMPING_SURFACE,
                                         (PLAYER_WIDTH, PLAYER_HEIGHT))

PLAYER_LEFT = pygame.image.load(
    "Assets/Sprites/Mario/standing_still_left.png").convert_alpha()
PLAYER_LEFT = pygame.transform.scale(PLAYER_LEFT,
                                     (PLAYER_WIDTH, PLAYER_HEIGHT))

KOOPA = pygame.image.load("Assets/Sprites/Enemy/Koopa.png").convert_alpha()
KOOPA = pygame.transform.scale(KOOPA, (tile_size, tile_size))

GOOMBA = pygame.image.load("Assets/Sprites/Enemy/goomba.gif").convert_alpha()
GOOMBA = pygame.transform.scale(GOOMBA, (tile_size, tile_size))

STATE = PLAYER_RIGHT

GOOMBA_DICT = {}

#########################################################
def load_map(path):
    '''
    Function to load the map file and split it into list.

    Inputs
    path: the folder where the map is storedd

    Outputs:
    game_map: the map on the screen

    '''
    f = open(path + '.txt', 'r')
    data = f.read()
    f.close
    data = data.split('\n')
    game_map = []
    for row in data:
        game_map.append(list(row))
    return game_map

#Loads map file
game_map = load_map('map')

def collision_test(rect, tiles):
    '''
    Function to test if one rect collides with another.

    Inputs:
    rect: an objects rectangle that is going to be checked for collision
    tiles: a set of images used to make the map that is being checked for collison

    Outputs:
    hit_list: a list of tiles an object collides with

    '''
    hit_list = [[]]
    for list in range(1, len(tiles)):
        if rect.colliderect(tiles[list][0]):
            hit_list.append([
                tiles[list][0], tiles[list][1], tiles[list][2], tiles[list][3]
            ])
    return hit_list

def collision_test_goomba(rect, tiles):
    hit_list = []
    for list in range(1, len(tiles)):
        if rect.colliderect(tiles[list][0]):
            hit_list.append([
                tiles[list][0], tiles[list][1], tiles[list][2], tiles[list][3]
            ])
    return hit_list

def move(rect, movement, tiles):
    '''
    Function that allows characters to falling thorugh the ground.

    Inputs:
    rect: the rectangle of the player
    movement: a list of movements for the player
    tiles: a set of images used to make the map that is being checked
    for collison

    Outputs:
    rect: the rect of the player
    collision_types: what the player rect collides with

    '''

    tile_hit = []
    collision_types = {
        'top': False,
        'bottom': False,
        'right': False,
        'left': False
    }
    rect.x += movement[0]
    #Check to see collisions
    hit_list = collision_test(rect, tiles)
    for tile in range(1, len(hit_list)):
        if movement[0] > 0:
            rect.right = hit_list[tile][0].left
            collision_types['right'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]
        elif movement[0] < 0:
            rect.left = hit_list[tile][0].right
            collision_types['left'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]

    rect.y += movement[1]
    hit_list = collision_test(rect, tiles)
    for tile in range(1, len(hit_list)):
        #If we hit a block
        if movement[1] > 0:
            rect.bottom = hit_list[tile][0].top
            collision_types['bottom'] = True
        #If we hit the bottom of a block
        elif movement[1] < 0:
            rect.top = hit_list[tile][0].bottom
            collision_types['top'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]

    return rect, collision_types, tile_hit

#Presets values for player movement/jumping

def goomba_move(rect, tiles):

    #Check to see collisions
    for goomba in rect:
        hit_list = collision_test_goomba(rect[goomba][0], tiles)
        #print(collision_test_goomba)
        if (len(hit_list) != 0):
            rect[goomba][1] *= (-1)

        rect[goomba][0].x += rect[goomba][1]

    return rect

PLAYER_right = False
PLAYER_left = False
PLAYER_y_momentum = 0
PLAYER_air_timer = 0
PLAYER_HP = 1
GOOMBA_movement = 2

# Defines the rectangle for PLAYER
PLAYER_RECT = pygame.Rect(0, 300, PLAYER_WIDTH, PLAYER_HEIGHT)
# Insert code for the player rect starting position

###########################SCROLLING##########################################
scroll = 0
############################GAME LOOP#########################################

while True:

    # Pass rect and the type of block
    tile_rects = [[]]

    WINDOW.blit(BACKGROUND, (0, 0))

    #Makes map from the map.txt file
    y = 0
    for row in game_map:
        x = 0
        for tile in row:
            #APPEND COLLIDABLE BLOCKS TO TILE_RECT
            if (tile == '1' or tile == '2' or tile == '3' or tile == '4'
                    or tile == '8' or tile == '9' or tile == 'g'):
                #Tile_Rects so player does not fall off map. (Append grass block)
                tile_rects.append([
                    pygame.Rect(x * tile_size, y * tile_size, tile_size,
                                tile_size), tile, y, x
                ])
            elif (tile == '5' or tile == '6'):
                tile_rects.append([
                    pygame.Rect(x * tile_size, y * tile_size, tile_size * 2,
                                tile_size * 2), tile, y, x
                ])

            #DRAW MAP
            if tile == '1':
                WINDOW.blit(GROUND_BRICK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '2'):
                WINDOW.blit(BRICK, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '3'):
                WINDOW.blit(HARD_BLOCK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '4'):
                WINDOW.blit(Q_BLOCK, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '5'):
                WINDOW.blit(PIPE_TOP,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '6'):
                WINDOW.blit(PIPE_BODY,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '7'):
                WINDOW.blit(CASTLE, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '8'):
                WINDOW.blit(USED_BLOCK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '9'):
                #pygame.draw.rect(KOOPA,((x * tile_size) - scroll, y * tile_size))
                pass

            elif (tile == 'g'):

                #If the rectangle has not been loaded in yet.
                if ((x, y) not in GOOMBA_DICT):
                    GOOMBA_DICT[(x, y)] = [
                        pygame.Rect((x * tile_size) - scroll, y * tile_size,
                                    PLAYER_WIDTH, PLAYER_HEIGHT),
                        GOOMBA_movement
                    ]
                #If the goomba rectangle has been loaded and we reach it, we update its movement every frame.
                else:
                    if type(GOOMBA_DICT[(x, y)]) == list:
                        WINDOW.blit(
                            GOOMBA,
                            ((x * tile_size) - scroll,
                             y * tile_size))
                        #GOOMBA_DICT = goomba_move(GOOMBA_DICT,tile_rects)
                    else:
                        print(GOOMBA_DICT[(x,y).x])
                        WINDOW.blit(
                            GOOMBA,
                            ((GOOMBA_DICT[(x, y)].x * tile_size) - scroll,
                             GOOMBA_DICT[(x, y)].y * tile_size))
                        #Move ALL goombas at the same time
                        GOOMBA_DICT = goomba_move(GOOMBA_DICT, tile_rects)

            x += 1
        y += 1

# player movement & collisions (used to update players position)
    PLAYER_movement = [0, 0]
    if PLAYER_right:
        PLAYER_movement[0] += 2
        STATE = PLAYER_RIGHT
    if PLAYER_left:
        PLAYER_movement[0] -= 2
        STATE = PLAYER_LEFT
    PLAYER_movement[1] += PLAYER_y_momentum
    PLAYER_y_momentum += 0.15
    if PLAYER_y_momentum > 3:
        PLAYER_y_momentum = 3
    if PLAYER_y_momentum != 3:
        STATE = JUMPING_SURFACE

    #Change States

    #Scrolling (ONLY SCROLL RIGHT )
    if (PLAYER_RECT.x > 450):
        scroll += (PLAYER_RECT.x - scroll - 452) / 20

    #Update Players Movement
    PLAYER_RECT, PLAYER_collisions, Tile_hit = move(PLAYER_RECT,
                                                    PLAYER_movement,
                                                    tile_rects)

    #If player collided with the bottom of a block, stop them from jumping higher.
    if PLAYER_collisions['bottom']:
        # TO-DO: IMPLEMENT BLOCK COLLIDE LOGIC
        PLAYER_y_momentum = 0
        PLAYER_air_timer = 0
    #Otherwise, allow player to move.
    else:
        #print("PLAYER FALLING")
        PLAYER_air_timer += 1
    #If player is above block,  stop their y-motion.
    if PLAYER_collisions['top']:
        PLAYER_y_momentum = 0
        #If tile was a question mark block and was hit from underneath
        if (Tile_hit[1] == '4'):
            #Question block logic
            game_map[Tile_hit[2]][Tile_hit[3]] = '8'
            #ITEM = random.choice([MUSHROOM,COIN])
            #WINDOW.blit(ITEM,((Tile_hit[2]*tile_size) - scroll, (Tile_hit[3]*tile_size)))

        if (Tile_hit[1] == '2'):
            game_map[Tile_hit[2]][Tile_hit[3]] = '0'

    #Draw character once their movement has updated.

    #DRAW PLAYER AND GOOMBA

    #DRAW ENTITIES
    WINDOW.blit(STATE, (PLAYER_RECT.x - scroll, PLAYER_RECT.y))

    #Defines which keys move the characters
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.VIDEORESIZE:
            WINDOW = pygame.display.set_mode(event.size)
            #Set coorindates of this block to 0

        if event.type == KEYDOWN:
            if event.key == K_RIGHT:
                PLAYER_right = True

            if event.key == K_LEFT:
                PLAYER_left = True
                #STATE = PLAYER_LEFT

            if event.key == K_UP:
                if PLAYER_air_timer < 10:
                    PLAYER_y_momentum = -6.9
                    #STATE = JUMPING_SURFACE

        if event.type == KEYUP:
            if event.key == K_RIGHT:
                PLAYER_right = False
            if event.key == K_LEFT:
                PLAYER_left = False

    #Projects everything onto the WINDOW
    WINDOW_SIZE = (WINDOW.get_width(), WINDOW.get_height())
    pygame.display.update()
    clock.tick(60)

</code>```

I tried utilizing a dictionary for the goombas, but they just wont move.

Body:
I am currently trying to re-create the first level off super mario bros. I am using pygame, and have one issue occurring. I make the map out of a text file, which turns into a game_map (2D array), and I loop through it every frame to make sure the  map is being updated. However, I also utilized a scrolling feature with the game. This makes it difficult to have enemies in there. I utilize a dictionary to hold all of the goombas that spawn (since we can only have one goomba, and dont want to spawn hundreds of them per frame). Here is the code, I would love some suggestions as how to make the goombas move! When I currently run the game with this code, the goombas do not move.

# Import Libaries
import random
import pygame, sys, os
from pygame.locals import *

pygame.init()

#####################################SETUP##################################
clock = pygame.time.Clock()
# Creates window for the game
pygame.display.set_caption("Kamil's Trio FIRST GAME!")
WIDTH = 900
HEIGHT = 600
WINDOW = pygame.display.set_mode((WIDTH, HEIGHT))
tile_size = 50
PLAYER_WIDTH, PLAYER_HEIGHT = 40, 40

#Defining all images used and scales them to fit on WINDOW

BACKGROUND = pygame.image.load("Assets/mariobackground.jpg").convert_alpha()
BACKGROUND = pygame.transform.scale(BACKGROUND, (WIDTH, HEIGHT))

GROUND_BRICK = pygame.image.load(
    "Assets/Sprites/Blocks/ground_brick.png").convert_alpha()
GROUND_BRICK = pygame.transform.scale(GROUND_BRICK, (tile_size, tile_size))

BRICK = pygame.image.load("Assets/Sprites/Blocks/brick.png").convert_alpha()
BRICK = pygame.transform.scale(BRICK, (tile_size, tile_size))

HARD_BLOCK = pygame.image.load(
    "Assets/Sprites/Blocks/hard_block.png").convert_alpha()
HARD_BLOCK = pygame.transform.scale(HARD_BLOCK, (tile_size, tile_size))

Q_BLOCK = pygame.image.load(
    "Assets/Sprites/Blocks/question_block.gif").convert_alpha()
Q_BLOCK = pygame.transform.scale(Q_BLOCK, (tile_size, tile_size))

PIPE_TOP = pygame.image.load(
    "Assets/Sprites/Blocks/pipe_top.png").convert_alpha()
PIPE_TOP = pygame.transform.scale(PIPE_TOP, (tile_size * 2, tile_size))

PIPE_BODY = pygame.image.load(
    "Assets/Sprites/Blocks/pipe_body.png").convert_alpha()
PIPE_BODY = pygame.transform.scale(PIPE_BODY, (tile_size * 2, tile_size))

PLAYER_RIGHT = pygame.image.load(
    "Assets/Sprites/Mario/standing_still.png").convert_alpha()
PLAYER_RIGHT = pygame.transform.scale(PLAYER_RIGHT,
                                      (PLAYER_WIDTH, PLAYER_HEIGHT))

CASTLE = pygame.image.load(
    "Assets/Sprites/Blocks/bowser_castle.png").convert_alpha()
CASTLE = pygame.transform.scale(CASTLE, (tile_size * 5, tile_size * 5))

COIN = pygame.image.load("Assets/Sprites/Items/coin.png").convert_alpha()
COIN = pygame.transform.scale(COIN, (tile_size * 5, tile_size * 5))

USED_BlOCK = pygame.image.load(
    "Assets/Sprites/Blocks/used_block.png").convert_alpha()
USED_BLOCK = pygame.transform.scale(USED_BlOCK, (tile_size, tile_size))

MUSHROOM = pygame.image.load(
    "Assets/Sprites/Items/Mushroom.png").convert_alpha()
MUSHROOM = pygame.transform.scale(MUSHROOM, (tile_size, tile_size))

JUMPING_SURFACE = pygame.image.load(
    "Assets/Sprites/Mario/mario_jump.png").convert_alpha()
JUMPING_SURFACE = pygame.transform.scale(JUMPING_SURFACE,
                                         (PLAYER_WIDTH, PLAYER_HEIGHT))

PLAYER_LEFT = pygame.image.load(
    "Assets/Sprites/Mario/standing_still_left.png").convert_alpha()
PLAYER_LEFT = pygame.transform.scale(PLAYER_LEFT,
                                     (PLAYER_WIDTH, PLAYER_HEIGHT))

KOOPA = pygame.image.load("Assets/Sprites/Enemy/Koopa.png").convert_alpha()
KOOPA = pygame.transform.scale(KOOPA, (tile_size, tile_size))

GOOMBA = pygame.image.load("Assets/Sprites/Enemy/goomba.gif").convert_alpha()
GOOMBA = pygame.transform.scale(GOOMBA, (tile_size, tile_size))

STATE = PLAYER_RIGHT

GOOMBA_DICT = {}

#########################################################
def load_map(path):
    '''
    Function to load the map file and split it into list.

    Inputs
    path: the folder where the map is storedd

    Outputs:
    game_map: the map on the screen

    '''
    f = open(path + '.txt', 'r')
    data = f.read()
    f.close
    data = data.split('\n')
    game_map = []
    for row in data:
        game_map.append(list(row))
    return game_map

#Loads map file
game_map = load_map('map')

def collision_test(rect, tiles):
    '''
    Function to test if one rect collides with another.

    Inputs:
    rect: an objects rectangle that is going to be checked for collision
    tiles: a set of images used to make the map that is being checked for collison

    Outputs:
    hit_list: a list of tiles an object collides with

    '''
    hit_list = [[]]
    for list in range(1, len(tiles)):
        if rect.colliderect(tiles[list][0]):
            hit_list.append([
                tiles[list][0], tiles[list][1], tiles[list][2], tiles[list][3]
            ])
    return hit_list

def collision_test_goomba(rect, tiles):
    hit_list = []
    for list in range(1, len(tiles)):
        if rect.colliderect(tiles[list][0]):
            hit_list.append([
                tiles[list][0], tiles[list][1], tiles[list][2], tiles[list][3]
            ])
    return hit_list

def move(rect, movement, tiles):
    '''
    Function that allows characters to falling thorugh the ground.

    Inputs:
    rect: the rectangle of the player
    movement: a list of movements for the player
    tiles: a set of images used to make the map that is being checked
    for collison

    Outputs:
    rect: the rect of the player
    collision_types: what the player rect collides with

    '''

    tile_hit = []
    collision_types = {
        'top': False,
        'bottom': False,
        'right': False,
        'left': False
    }
    rect.x += movement[0]
    #Check to see collisions
    hit_list = collision_test(rect, tiles)
    for tile in range(1, len(hit_list)):
        if movement[0] > 0:
            rect.right = hit_list[tile][0].left
            collision_types['right'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]
        elif movement[0] < 0:
            rect.left = hit_list[tile][0].right
            collision_types['left'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]

    rect.y += movement[1]
    hit_list = collision_test(rect, tiles)
    for tile in range(1, len(hit_list)):
        #If we hit a block
        if movement[1] > 0:
            rect.bottom = hit_list[tile][0].top
            collision_types['bottom'] = True
        #If we hit the bottom of a block
        elif movement[1] < 0:
            rect.top = hit_list[tile][0].bottom
            collision_types['top'] = True
            tile_hit = [
                hit_list[tile][0], hit_list[tile][1], hit_list[tile][2],
                hit_list[tile][3]
            ]

    return rect, collision_types, tile_hit

#Presets values for player movement/jumping

def goomba_move(rect, tiles):

    #Check to see collisions
    for goomba in rect:
        hit_list = collision_test_goomba(rect[goomba][0], tiles)
        #print(collision_test_goomba)
        if (len(hit_list) != 0):
            rect[goomba][1] *= (-1)

        rect[goomba][0].x += rect[goomba][1]

    return rect

PLAYER_right = False
PLAYER_left = False
PLAYER_y_momentum = 0
PLAYER_air_timer = 0
PLAYER_HP = 1
GOOMBA_movement = 2

# Defines the rectangle for PLAYER
PLAYER_RECT = pygame.Rect(0, 300, PLAYER_WIDTH, PLAYER_HEIGHT)
# Insert code for the player rect starting position

###########################SCROLLING##########################################
scroll = 0
############################GAME LOOP#########################################

while True:

    # Pass rect and the type of block
    tile_rects = [[]]

    WINDOW.blit(BACKGROUND, (0, 0))

    #Makes map from the map.txt file
    y = 0
    for row in game_map:
        x = 0
        for tile in row:
            #APPEND COLLIDABLE BLOCKS TO TILE_RECT
            if (tile == '1' or tile == '2' or tile == '3' or tile == '4'
                    or tile == '8' or tile == '9' or tile == 'g'):
                #Tile_Rects so player does not fall off map. (Append grass block)
                tile_rects.append([
                    pygame.Rect(x * tile_size, y * tile_size, tile_size,
                                tile_size), tile, y, x
                ])
            elif (tile == '5' or tile == '6'):
                tile_rects.append([
                    pygame.Rect(x * tile_size, y * tile_size, tile_size * 2,
                                tile_size * 2), tile, y, x
                ])

            #DRAW MAP
            if tile == '1':
                WINDOW.blit(GROUND_BRICK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '2'):
                WINDOW.blit(BRICK, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '3'):
                WINDOW.blit(HARD_BLOCK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '4'):
                WINDOW.blit(Q_BLOCK, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '5'):
                WINDOW.blit(PIPE_TOP,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '6'):
                WINDOW.blit(PIPE_BODY,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '7'):
                WINDOW.blit(CASTLE, ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '8'):
                WINDOW.blit(USED_BLOCK,
                            ((x * tile_size) - scroll, y * tile_size))

            elif (tile == '9'):
                #pygame.draw.rect(KOOPA,((x * tile_size) - scroll, y * tile_size))
                pass

            elif (tile == 'g'):

                #If the rectangle has not been loaded in yet.
                if ((x, y) not in GOOMBA_DICT):
                    GOOMBA_DICT[(x, y)] = [
                        pygame.Rect((x * tile_size) - scroll, y * tile_size,
                                    PLAYER_WIDTH, PLAYER_HEIGHT),
                        GOOMBA_movement
                    ]
                #If the goomba rectangle has been loaded and we reach it, we update its movement every frame.
                else:
                    if type(GOOMBA_DICT[(x, y)]) == list:
                        WINDOW.blit(
                            GOOMBA,
                            ((x * tile_size) - scroll,
                             y * tile_size))
                        #GOOMBA_DICT = goomba_move(GOOMBA_DICT,tile_rects)
                    else:
                        print(GOOMBA_DICT[(x,y).x])
                        WINDOW.blit(
                            GOOMBA,
                            ((GOOMBA_DICT[(x, y)].x * tile_size) - scroll,
                             GOOMBA_DICT[(x, y)].y * tile_size))
                        #Move ALL goombas at the same time
                        GOOMBA_DICT = goomba_move(GOOMBA_DICT, tile_rects)

            x += 1
        y += 1

# player movement & collisions (used to update players position)
    PLAYER_movement = [0, 0]
    if PLAYER_right:
        PLAYER_movement[0] += 2
        STATE = PLAYER_RIGHT
    if PLAYER_left:
        PLAYER_movement[0] -= 2
        STATE = PLAYER_LEFT
    PLAYER_movement[1] += PLAYER_y_momentum
    PLAYER_y_momentum += 0.15
    if PLAYER_y_momentum > 3:
        PLAYER_y_momentum = 3
    if PLAYER_y_momentum != 3:
        STATE = JUMPING_SURFACE

    #Change States

    #Scrolling (ONLY SCROLL RIGHT )
    if (PLAYER_RECT.x > 450):
        scroll += (PLAYER_RECT.x - scroll - 452) / 20

    #Update Players Movement
    PLAYER_RECT, PLAYER_collisions, Tile_hit = move(PLAYER_RECT,
                                                    PLAYER_movement,
                                                    tile_rects)

    #If player collided with the bottom of a block, stop them from jumping higher.
    if PLAYER_collisions['bottom']:
        # TO-DO: IMPLEMENT BLOCK COLLIDE LOGIC
        PLAYER_y_momentum = 0
        PLAYER_air_timer = 0
    #Otherwise, allow player to move.
    else:
        #print("PLAYER FALLING")
        PLAYER_air_timer += 1
    #If player is above block,  stop their y-motion.
    if PLAYER_collisions['top']:
        PLAYER_y_momentum = 0
        #If tile was a question mark block and was hit from underneath
        if (Tile_hit[1] == '4'):
            #Question block logic
            game_map[Tile_hit[2]][Tile_hit[3]] = '8'
            #ITEM = random.choice([MUSHROOM,COIN])
            #WINDOW.blit(ITEM,((Tile_hit[2]*tile_size) - scroll, (Tile_hit[3]*tile_size)))

        if (Tile_hit[1] == '2'):
            game_map[Tile_hit[2]][Tile_hit[3]] = '0'

    #Draw character once their movement has updated.

    #DRAW PLAYER AND GOOMBA

    #DRAW ENTITIES
    WINDOW.blit(STATE, (PLAYER_RECT.x - scroll, PLAYER_RECT.y))

    #Defines which keys move the characters
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.VIDEORESIZE:
            WINDOW = pygame.display.set_mode(event.size)
            #Set coorindates of this block to 0

        if event.type == KEYDOWN:
            if event.key == K_RIGHT:
                PLAYER_right = True

            if event.key == K_LEFT:
                PLAYER_left = True
                #STATE = PLAYER_LEFT

            if event.key == K_UP:
                if PLAYER_air_timer < 10:
                    PLAYER_y_momentum = -6.9
                    #STATE = JUMPING_SURFACE

        if event.type == KEYUP:
            if event.key == K_RIGHT:
                PLAYER_right = False
            if event.key == K_LEFT:
                PLAYER_left = False

    #Projects everything onto the WINDOW
    WINDOW_SIZE = (WINDOW.get_width(), WINDOW.get_height())
    pygame.display.update()
    clock.tick(60)

I tried utilizing a dictionary for the goombas, but they just wont move.


问:
How can I get rid of the text field when using jQuery.terminal with Next JS?
I am trying to use jquery.terminal within a Next.js app.

This is my terminal component:

```<code>    import React, { useEffect } from 'react';

    import $ from 'jquery';
    import 'jquery.terminal';

    function Terminal() {
      useEffect(() => {
        $('#terminal').terminal(function(command, terminal) {
          // your code here
        }, );
      }, []);

      return (
        <div>
          <div id="terminal"></div>
        </div>
      );
    }

    export default Terminal;
</code>```

And this is how it looks like:

My question is how can I get rid of this text area and have the input direct at the ">"?

Body:
I am trying to use jquery.terminal within a Next.js app.

This is my terminal component:

    import React, { useEffect } from 'react';

    import $ from 'jquery';
    import 'jquery.terminal';

    function Terminal() {
      useEffect(() => {
        $('#terminal').terminal(function(command, terminal) {
          // your code here
        }, );
      }, []);

      return (

      );
    }

    export default Terminal;

And this is how it looks like:

My question is how can I get rid of this text area and have the input direct at the ">"?


问:
Returning Nested JSON Objects from getStaticProps in Next JS
Apologies for the dumb question but I am getting stuck on something that in theory is very simple. Basically I am unable render subfields on a JSON response, even though the fields are appearing in the console. I am only able to render the first layer of the object in the map method, when placing nested objects within the return statement the page renders with the correct content for a split second but then shows the error "TypeError: Cannot read properties of undefined (reading 'name' (or any other of the nested fields))" I have tried using a sub map method to return these fields but that also does not work as it is not a array but a nested object? I have also tried using Object.keys on the sub object but no dice. Is this to do with it being an async api call? I would assume it is not as the page is statically generated and I would assume that means all of the async data fetching would be completed before the page renders. If anyone has run into a similar issue I would highly appreciate the help. Thanks again, probably a really stupid mistake that I am just not seeing coding while sleep deprived is not a good idea probably.

Please see the code and JSON below.

Fetch util function

```<code>`export async function fetcher(url, options = {}) {
  let response;
  if (!options) {
    response = await fetch(url);
  } else {
    response = await fetch(url, options);
  }
  const data = await response.json();
  return data;
}`

static props function

</code>```

export async function getStaticProps() { const artsResponse = await fetcher( ${process.env.NEXT_HOME_STRAPI_URL}/artworks?populate=*`
);

return {
props: {
artworks: artsResponse,
},
};
}`

```<code>

return fields into DOM, only first layer object is being accessed. sub fields are undefined
used italic in where the error is occurring - TypeError: Cannot convert undefined or null to object

`
  `return (
    <>
      <ul className="list-none space-y-4 text-4xl font-bold mb-3">
        {artworks &&
          artworks.data.map((artwork) => {
            return (
              <li key={artwork.id}>
                <Link href={`artwork/` + artwork.slug}>{artwork.Title}</Link>
                <p className="text-base my-5 mx-2">{artwork.Date_Created}</p>
                <p className="text-lg my-5">{artwork.artist.name}</p>
                <p className="text-base my-5">{artwork.artist.description}</p>
               * {Object.keys(artwork.artists).map((artist) => {
                  <div key={artist.id}>
                    <p className="text-lg my-5">{artwork.artist.name}</p>
                    <p className="text-base my-5">
                      {artwork.artist.description}
                    </p>
                  </div>;
                })}*
              </li>
            );
          })}
      </ul>
    </>
  );
};`
`

//

JSON response - though it is appearing in the console only items in bold can be accessed.
</code>```
```<code>   ` **"data": [
        {
            "id": 1,
            "createdAt": "2022-12-21T20:05:53.299Z",
            "updatedAt": "2022-12-22T22:22:49.462Z",
            "publishedAt": "2022-12-21T20:11:33.405Z",
            "Description": "Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test ",
            "Date_Created": "1822-12-18",
            "Title": "Garden of Earthly Delights",
            "slug": "garden-of-earthly-delights",
            "creation_date": "1776",**
            "artist": {
                "id": 2,
                "name": "Hieronymus Bosch",
                "description": "He is one of the most notable representatives of the Early Netherlandish painting school. His work, generally oil on oak wood, mainly contains fantastic illustrations of religious concepts and narratives.[6] Within his lifetime his work was collected in the Netherlands, Austria, and Spain, and widely copied, especially his macabre and nightmarish depictions of hell.\n\nLittle is known of Bosch's life, though there are some records. He spent most of it in the town of 's-Hertogenbosch, where he was born in his grandfather's house. The roots of his forefathers are in Nijmegen and Aachen (which is visible in his surname: Van Aken). His pessimistic fantastical style cast a wide influence on northern art of the 16th century, with Pieter Bruegel the Elder being his best-known follower. Today, Bosch is seen as a hugely individualistic painter with deep insight into humanity's desires and deepest fears. Attribution has been especially difficult; today only about 25 paintings are confidently given to his hand[7] along with eight drawings. About another half-dozen paintings are confidently attributed to his workshop. His most acclaimed works consist of a few triptych altarpieces, including The Garden of Earthly Delights.",
                "createdAt": "2022-12-21T16:12:40.901Z",
                "updatedAt": "2022-12-22T21:47:26.873Z",
                "publishedAt": "2022-12-21T16:18:34.062Z",
                "slug": "hieronymus-bosch",
                "quote": "I like painting little critters."
            },
            "categories": [],
            "Artwork_Images": [
                {
                    "id": 4,
                    "name": "earthlydelights.webp",
                    "alternativeText": null,
                    "caption": null,
                    "width": 1200,
                    "height": 630,
                    "formats": {
                        "thumbnail": {
                            "name": "thumbnail_earthlydelights.webp",
                            "hash": "thumbnail_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 245,
                            "height": 129,
                            "size": 11.66,
                            "url": "/uploads/thumbnail_earthlydelights_a730f74f7a.webp"
                        },
                        "small": {
                            "name": "small_earthlydelights.webp",
                            "hash": "small_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 500,
                            "height": 262,
                            "size": 39.57,
                            "url": "/uploads/small_earthlydelights_a730f74f7a.webp"
                        },
                        "large": {
                            "name": "large_earthlydelights.webp",
                            "hash": "large_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 1000,
                            "height": 525,
                            "size": 116.24,
                            "url": "/uploads/large_earthlydelights_a730f74f7a.webp"
                        },
                        "medium": {
                            "name": "medium_earthlydelights.webp",
                            "hash": "medium_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 750,
                            "height": 394,
                            "size": 76.04,
                            "url": "/uploads/medium_earthlydelights_a730f74f7a.webp"
                        }
                    },
                    "hash": "earthlydelights_a730f74f7a",
                    "ext": ".webp",
                    "mime": "image/webp",
                    "size": 187.32,
                    "url": "/uploads/earthlydelights_a730f74f7a.webp",
                    "previewUrl": null,
                    "provider": "local",
                    "provider_metadata": null,
                    "createdAt": "2022-12-21T22:17:34.687Z",
                    "updatedAt": "2022-12-21T22:17:34.687Z"
                }
            ]
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}`

This should be very simple I just can't see what I am doing incorrectly?

I have tried using a sub map method to return these fields but that also does not work as it is not an array but a nested object? I have also tried using Object.keys on the sub object but no dice. I am expecting the values of the fields to be able to be returned in the DOM.
</code>```

Body:
Apologies for the dumb question but I am getting stuck on something that in theory is very simple. Basically I am unable render subfields on a JSON response, even though the fields are appearing in the console. I am only able to render the first layer of the object in the map method, when placing nested objects within the return statement the page renders with the correct content for a split second but then shows the error "TypeError: Cannot read properties of undefined (reading 'name' (or any other of the nested fields))" I have tried using a sub map method to return these fields but that also does not work as it is not a array but a nested object? I have also tried using Object.keys on the sub object but no dice. Is this to do with it being an async api call? I would assume it is not as the page is statically generated and I would assume that means all of the async data fetching would be completed before the page renders. If anyone has run into a similar issue I would highly appreciate the help. Thanks again, probably a really stupid mistake that I am just not seeing coding while sleep deprived is not a good idea probably.

Please see the code and JSON below.

Fetch util function

`export async function fetcher(url, options = {}) {
  let response;
  if (!options) {
    response = await fetch(url);
  } else {
    response = await fetch(url, options);
  }
  const data = await response.json();
  return data;
}`

static props function

export async function getStaticProps() { const artsResponse = await fetcher( ${process.env.NEXT_HOME_STRAPI_URL}/artworks?populate=*`
);

return {
props: {
artworks: artsResponse,
},
};
}`

return fields into DOM, only first layer object is being accessed. sub fields are undefined
used italic in where the error is occurring - TypeError: Cannot convert undefined or null to object

`
  `return (
    <>

        {artworks &&
          artworks.data.map((artwork) => {
            return (

                <Link href={`artwork/` + artwork.slug}>{artwork.Title}</Link>

{artwork.Date_Created}

{artwork.artist.name}

{artwork.artist.description}

               * {Object.keys(artwork.artists).map((artist) => {

{artwork.artist.name}

                      {artwork.artist.description}

;
                })}*

            );
          })}

    </>
  );
};`
`

//

JSON response - though it is appearing in the console only items in bold can be accessed.

   ` **"data": [
        {
            "id": 1,
            "createdAt": "2022-12-21T20:05:53.299Z",
            "updatedAt": "2022-12-22T22:22:49.462Z",
            "publishedAt": "2022-12-21T20:11:33.405Z",
            "Description": "Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test Demo Test ",
            "Date_Created": "1822-12-18",
            "Title": "Garden of Earthly Delights",
            "slug": "garden-of-earthly-delights",
            "creation_date": "1776",**
            "artist": {
                "id": 2,
                "name": "Hieronymus Bosch",
                "description": "He is one of the most notable representatives of the Early Netherlandish painting school. His work, generally oil on oak wood, mainly contains fantastic illustrations of religious concepts and narratives.[6] Within his lifetime his work was collected in the Netherlands, Austria, and Spain, and widely copied, especially his macabre and nightmarish depictions of hell.\n\nLittle is known of Bosch's life, though there are some records. He spent most of it in the town of 's-Hertogenbosch, where he was born in his grandfather's house. The roots of his forefathers are in Nijmegen and Aachen (which is visible in his surname: Van Aken). His pessimistic fantastical style cast a wide influence on northern art of the 16th century, with Pieter Bruegel the Elder being his best-known follower. Today, Bosch is seen as a hugely individualistic painter with deep insight into humanity's desires and deepest fears. Attribution has been especially difficult; today only about 25 paintings are confidently given to his hand[7] along with eight drawings. About another half-dozen paintings are confidently attributed to his workshop. His most acclaimed works consist of a few triptych altarpieces, including The Garden of Earthly Delights.",
                "createdAt": "2022-12-21T16:12:40.901Z",
                "updatedAt": "2022-12-22T21:47:26.873Z",
                "publishedAt": "2022-12-21T16:18:34.062Z",
                "slug": "hieronymus-bosch",
                "quote": "I like painting little critters."
            },
            "categories": [],
            "Artwork_Images": [
                {
                    "id": 4,
                    "name": "earthlydelights.webp",
                    "alternativeText": null,
                    "caption": null,
                    "width": 1200,
                    "height": 630,
                    "formats": {
                        "thumbnail": {
                            "name": "thumbnail_earthlydelights.webp",
                            "hash": "thumbnail_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 245,
                            "height": 129,
                            "size": 11.66,
                            "url": "/uploads/thumbnail_earthlydelights_a730f74f7a.webp"
                        },
                        "small": {
                            "name": "small_earthlydelights.webp",
                            "hash": "small_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 500,
                            "height": 262,
                            "size": 39.57,
                            "url": "/uploads/small_earthlydelights_a730f74f7a.webp"
                        },
                        "large": {
                            "name": "large_earthlydelights.webp",
                            "hash": "large_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 1000,
                            "height": 525,
                            "size": 116.24,
                            "url": "/uploads/large_earthlydelights_a730f74f7a.webp"
                        },
                        "medium": {
                            "name": "medium_earthlydelights.webp",
                            "hash": "medium_earthlydelights_a730f74f7a",
                            "ext": ".webp",
                            "mime": "image/webp",
                            "path": null,
                            "width": 750,
                            "height": 394,
                            "size": 76.04,
                            "url": "/uploads/medium_earthlydelights_a730f74f7a.webp"
                        }
                    },
                    "hash": "earthlydelights_a730f74f7a",
                    "ext": ".webp",
                    "mime": "image/webp",
                    "size": 187.32,
                    "url": "/uploads/earthlydelights_a730f74f7a.webp",
                    "previewUrl": null,
                    "provider": "local",
                    "provider_metadata": null,
                    "createdAt": "2022-12-21T22:17:34.687Z",
                    "updatedAt": "2022-12-21T22:17:34.687Z"
                }
            ]
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}`

This should be very simple I just can't see what I am doing incorrectly?

I have tried using a sub map method to return these fields but that also does not work as it is not an array but a nested object? I have also tried using Object.keys on the sub object but no dice. I am expecting the values of the fields to be able to be returned in the DOM.


问:
How to include Pinvoked shared libraries in a single file publish app?
Our C# app currently has a native C shared library from which we call a couple of functions using the Pinvoke "DLLImport". The issue is, we haven't found a way to include the shared library with the single file publish option.

This means that we'd have to give the app executable and a platform specific library file to the users, which is not ideal.

Added context: The library was already compiled for Linux (.so), macOS (.dylib) and Windows (.dll). The Pinvoke in this case handles choosing the correct one during dev and debug, and the publish config handles choosing which one to include based on the platform target. The library was compiled as an independent shared library for all three operating systems as well, without external dependencies. Runtime version is dotnet 7.

Is it possible to include this library file together with the single file executable?

We've tried the "Include native libraries for self extract" option, but it didn't include the library with it. As soon as the app reaches a library function it can't find the dll.


问:
d3.js element-wise difference between two slightly different data sets
I'm new to d3 and am trying to learn.

Let's say I have a first, reference, data set:

```<code>    data_ref = { "name": "root", "size": 25, "children": [
        { "name": "child 1", "size": 8, "children": [
            { "name": "grand child 1", "size": 4, "children": [] },
            { "name": "grand child 2", "size": 2, "children": [
                { "name": "great grand child 1", "size": 1, "children": [] },
            ]},
        ]},
        { "name": "child 2", "size": 7, "children": [
            { "name": "grand child 3", "size": 2, "children": [] },
            { "name": "grand child 4", "size": 3, "children": [] },
        ]},
    ]}
</code>```

Let's also say I have a second data set, that can have some subtle differences, either in terms of the values, or even in terms of hierarchy:

```<code>    data_other = { "name": "root", "size": 24, "children": [
        { "name": "child 1", "size": 7, "children": [
            { "name": "grand child 1", "size": 4, "children": [] },
        ]},
        { "name": "child 2", "size": 9, "children": [
            { "name": "grand child 5, "size": 1, "children": [] },
            { "name": "grand child 4", "size": 3, "children": [
                { "name": "great grand child 1", "size": 1, "children": [] },
            ]},
        ]},
    ]}
</code>```

My goal is to diff the two data sets. In effect I want the result to have the very same hierarchical structure as the reference data set, with an indicator for every element as to whether a counterpart exists in the 'other' data set, and if so, with a new field that indicates the difference in size.
Essentially, my expectation is that the result looks like this:

```<code>data_diff = { "name": "root", "size": 25, "orphan": false, "size_diff": -1, "children": [
    { "name": "child 1", "size": 8, "orphan": false, "size_diff": -1, "children": [
        { "name": "grand child 1", "size": 4, "orphan": false, "size_diff": 0, "children": [] },
        { "name": "grand child 2", "size": 2, "orphan":true, "children": [
            { "name": "great grand child 1", "size": 1, "orphan":true, "children": [] },
        ]},
    ]},
    { "name": "child 2", "size": 7, "children": [
        { "name": "grand child 3", "size": 2, "orphan":true, "children": [] },
        { "name": "grand child 4", "size": 3, "orphan":false, "size_diff": 0, "children": [] },
    ]},
]}
</code>```

In other words, this can be thought of as the difference between two folders on your hard drive, that have almost but quite the same structure.

Until now I was using some python code to diff the two data sets.
How can this be done in d3 directly ? I'm hoping there is a simple and elegant solution, but I couldn't quite figure it out given my limited skills at the moment...

Body:
I'm new to d3 and am trying to learn.

Let's say I have a first, reference, data set:

    data_ref = { "name": "root", "size": 25, "children": [
        { "name": "child 1", "size": 8, "children": [
            { "name": "grand child 1", "size": 4, "children": [] },
            { "name": "grand child 2", "size": 2, "children": [
                { "name": "great grand child 1", "size": 1, "children": [] },
            ]},
        ]},
        { "name": "child 2", "size": 7, "children": [
            { "name": "grand child 3", "size": 2, "children": [] },
            { "name": "grand child 4", "size": 3, "children": [] },
        ]},
    ]}

Let's also say I have a second data set, that can have some subtle differences, either in terms of the values, or even in terms of hierarchy:

    data_other = { "name": "root", "size": 24, "children": [
        { "name": "child 1", "size": 7, "children": [
            { "name": "grand child 1", "size": 4, "children": [] },
        ]},
        { "name": "child 2", "size": 9, "children": [
            { "name": "grand child 5, "size": 1, "children": [] },
            { "name": "grand child 4", "size": 3, "children": [
                { "name": "great grand child 1", "size": 1, "children": [] },
            ]},
        ]},
    ]}

My goal is to diff the two data sets. In effect I want the result to have the very same hierarchical structure as the reference data set, with an indicator for every element as to whether a counterpart exists in the 'other' data set, and if so, with a new field that indicates the difference in size.
Essentially, my expectation is that the result looks like this:

data_diff = { "name": "root", "size": 25, "orphan": false, "size_diff": -1, "children": [
    { "name": "child 1", "size": 8, "orphan": false, "size_diff": -1, "children": [
        { "name": "grand child 1", "size": 4, "orphan": false, "size_diff": 0, "children": [] },
        { "name": "grand child 2", "size": 2, "orphan":true, "children": [
            { "name": "great grand child 1", "size": 1, "orphan":true, "children": [] },
        ]},
    ]},
    { "name": "child 2", "size": 7, "children": [
        { "name": "grand child 3", "size": 2, "orphan":true, "children": [] },
        { "name": "grand child 4", "size": 3, "orphan":false, "size_diff": 0, "children": [] },
    ]},
]}

In other words, this can be thought of as the difference between two folders on your hard drive, that have almost but quite the same structure.

Until now I was using some python code to diff the two data sets.
How can this be done in d3 directly ? I'm hoping there is a simple and elegant solution, but I couldn't quite figure it out given my limited skills at the moment...


问:
Unable to unmarshall XML message from MQ manager using Spring Boot
I have a quite simple Spring Boot application that its own purpose (for now) is to listen to an IBM MQ queue and saves part of the incoming data into a persistent storage.

I've configured everything to be able to "listen" to the queue, but I'm unable to convert the received (XML) messages into the corresponding POJO.

This is (an excerpt of) what I'm receiving:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    http://domain.tld/IMessage/MqMessage
    MQ_REQUEST@S03&connectionFactory=binding(client)connectQueueManager(QM_03)clientConnection(s03.domain.tld(1416))clientChannel(QM_03.QUEUE)&initialContextFactory=com.ibm.mq.jms.Nojndi
  </s:Header>
  <s:Body>
    <ProcessMqMessage xmlns="http://domain.tld/segment">
      <msg>
        <?xml version="1.0" encoding="utf-16"?>
        <MessageEnvelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://domain.tld/IGateway">
          <MessageHeader>
            <MessageID>some-uuid</MessageID>
            <MessageType>MessageType</MessageType>
            <MessageVersionNumber>1.4.5</MessageVersionNumber>
            <MessageCreationDateTime>2022-06-01T13:39:30.195798</MessageCreationDateTime>
            <MessageSentDateTime>2022-06-01T13:39:35.8629222Z</MessageSentDateTime>
            <TimeZoneOffset>-PT4H</TimeZoneOffset>
          </MessageHeader>
          <MessageContent>
            <MessageType>
              <Reading>Scan</Reading>
              <IdentifierData>
                <ID xsi:type="xsd:string">some string value</ID>
              </IdentifierData>
              ...
```
<p>Basically, I'm receiving messages like that one, but as strings, using a <code>JmsListener</code>:</p>
<pre class="lang-java prettyprint-override"><code>@JmsListener(destination = "dest")
// public void processMessage(@Payload final TypeMessage msg) {
public void processMessage(final Message<String> msg) {
  try {
    final var context = JAXBContext.newInstance(TypeMessage.class);
    final var marshaller = context.createUnmarshaller();
    final var result = marshaller.unmarshal(new StringReader(msg.getPayload()));
  } catch (final Exception e) { }
}
</code>```

...and I'm trying to find a way to unmarshal that string into a POJO (initially only with these two fields just for testing):

@Getter
@Setter
@NoArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "MessageContent")
public class MessageContent {
  @XmlElement(name = "MessageType")
  private MessageType;

  @Getter
  @Setter
  @NoArgsConstructor
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement(name = "MessageType")
  public static class MessageType {
    @XmlElement(name = "Reading")
    private String reading;
  }
}
```
<p>In the end, looks like there is something wrong with the <code>JAXB</code> configuration or the annotations in the POJO, because I'm always getting this:</p>
<pre class="lang-bash prettyprint-override"><code>12-22-2022 20:28:11.387 |-  WARN in MessageManager:32 [org.springframework.jms.JmsListenerEndpointContainer#0-1] - Something happened here. This was the reason:
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2003/05/soap-envelope", local:"Envelope"). Expected elements are <{}MessageType>,<{}MessageContent>
</code>```

I can roughly infer that JAXB want me to map all the properties, but since this XML is massive I'm trying to map only the fields/tags that I'm interested. Also some of the tags in the XML can be present or not between messages.

Ideally I would like to receive a message using the MessageContent type in the JMS listener by using some underlying conversion triggered automatically by Spring, but not sure if that's possible.

I don't have a single bean configured. All the configuration is done inside application.yaml, along with the @EnableJms annotation.

Body:
I have a quite simple Spring Boot application that its own purpose (for now) is to listen to an IBM MQ queue and saves part of the incoming data into a persistent storage.

I've configured everything to be able to "listen" to the queue, but I'm unable to convert the received (XML) messages into the corresponding POJO.

This is (an excerpt of) what I'm receiving:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    http://domain.tld/IMessage/MqMessage
    MQ_REQUEST@S03&amp;connectionFactory=binding(client)connectQueueManager(QM_03)clientConnection(s03.domain.tld(1416))clientChannel(QM_03.QUEUE)&amp;initialContextFactory=com.ibm.mq.jms.Nojndi
  </s:Header>
  <s:Body>
    <ProcessMqMessage xmlns="http://domain.tld/segment">
      <msg>
        <?xml version="1.0" encoding="utf-16"?>
        <MessageEnvelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://domain.tld/IGateway">
          <MessageHeader>
            <MessageID>some-uuid</MessageID>
            <MessageType>MessageType</MessageType>
            <MessageVersionNumber>1.4.5</MessageVersionNumber>
            <MessageCreationDateTime>2022-06-01T13:39:30.195798</MessageCreationDateTime>
            <MessageSentDateTime>2022-06-01T13:39:35.8629222Z</MessageSentDateTime>
            <TimeZoneOffset>-PT4H</TimeZoneOffset>
          </MessageHeader>
          <MessageContent>
            <MessageType>
              <Reading>Scan</Reading>
              <IdentifierData>
                <ID xsi:type="xsd:string">some string value</ID>
              </IdentifierData>
              ...

Basically, I'm receiving messages like that one, but as strings, using a JmsListener:

@JmsListener(destination = "dest")
// public void processMessage(@Payload final TypeMessage msg) {
public void processMessage(final Message<String> msg) {
  try {
    final var context = JAXBContext.newInstance(TypeMessage.class);
    final var marshaller = context.createUnmarshaller();
    final var result = marshaller.unmarshal(new StringReader(msg.getPayload()));
  } catch (final Exception e) { }
}

...and I'm trying to find a way to unmarshal that string into a POJO (initially only with these two fields just for testing):

@Getter
@Setter
@NoArgsConstructor
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "MessageContent")
public class MessageContent {
  @XmlElement(name = "MessageType")
  private MessageType;

  @Getter
  @Setter
  @NoArgsConstructor
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement(name = "MessageType")
  public static class MessageType {
    @XmlElement(name = "Reading")
    private String reading;
  }
}

In the end, looks like there is something wrong with the JAXB configuration or the annotations in the POJO, because I'm always getting this:

12-22-2022 20:28:11.387 |-  WARN in MessageManager:32 [org.springframework.jms.JmsListenerEndpointContainer#0-1] - Something happened here. This was the reason:
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2003/05/soap-envelope", local:"Envelope"). Expected elements are <{}MessageType>,<{}MessageContent>

I can roughly infer that JAXB want me to map all the properties, but since this XML is massive I'm trying to map only the fields/tags that I'm interested. Also some of the tags in the XML can be present or not between messages.

Ideally I would like to receive a message using the MessageContent type in the JMS listener by using some underlying conversion triggered automatically by Spring, but not sure if that's possible.

I don't have a single bean configured. All the configuration is done inside application.yaml, along with the @EnableJms annotation.


问:
why adb logcat can't show d/w/v logs but only e logs is working
My adb log was working before. But today it just got messed up and only shows error logs. The d/v/w logs from other system/ other libs are also working. only my normal logs stopped working.

```<code>    Log.e("xxx", "onKeyDown")
    Log.d("xxx", "onKeyDown")
    Log.v("xxx", "onKeyDown")
</code>```

here is the screenshot of adb logcat | grep xxx

Body:
My adb log was working before. But today it just got messed up and only shows error logs. The d/v/w logs from other system/ other libs are also working. only my normal logs stopped working.

    Log.e("xxx", "onKeyDown")
    Log.d("xxx", "onKeyDown")
    Log.v("xxx", "onKeyDown")

here is the screenshot of adb logcat | grep xxx


问:
Why are results of madauni from R mada package differ from meta or metafor package?
For univariate analysis, the Mantel-Haenszel method gave different results.
meta and metafor were the same but different from mada.
how to get the same result of mada from meta or metafor?

```<code>require('mada')
require("meta")
require("metafor")
data(AuditC)
dat<-AuditC
fit.DOR.MH_1 <- madauni(dat, method="MH", correction = 0.5, correction.control = "all")
fit.DOR.MH_2 <- metabin(TP, TP+FN, FP, FP+TN, data = dat, backtransf = FALSE,
                       allincr = TRUE,
                       incr = 0.5,
                       method = "MH",
                       sm = "OR", common =TRUE, random = FALSE)
fit.DOR.MH_3 <-rma.mh(measure="OR", ai=TP, bi=FN, ci=FP, di=TN,
       add=c(1/2,1/2),
       to=c("all","all"),
       drop00=c(FALSE,FALSE),
       data=dat, level=95, digits = 3)
</code>```

Results:

```<code>print(summary(fit.DOR.MH_1))
...
Estimates:
      MH estimate  2.5 % 97.5 %
DOR        17.933 15.194 21.166
lnDOR       2.887  2.721  3.052

Cochran's Q: 4177.192 (13 df, p = 0)

print(summary(fit.DOR.MH_2))
...
                     logOR           95%-CI     z p-value
Common effect model 3.3490 [3.1813; 3.5167] 39.14       0
...
Details on meta-analytical method:
- Mantel-Haenszel method
- Restricted maximum-likelihood estimator for tau^2
- Q-Profile method for confidence interval of tau^2 and tau
- Continuity correction of 0.5 in all studies

print(summary(fit.DOR.MH_3))
...
Model Results (log scale):
estimate     se    zval   pval  ci.lb  ci.ub
   3.349  0.086  39.139  <.001  3.181  3.517
Model Results (OR scale):
estimate   ci.lb   ci.ub
  28.473  24.077  33.672
Cochran-Mantel-Haenszel Test:    CMH = 2592.801, df = 1,  p-val < 0.001
Tarone's Test for Heterogeneity: X^2 =  102.818, df = 13, p-val < 0.001

</code>```

Body:
For univariate analysis, the Mantel-Haenszel method gave different results.
meta and metafor were the same but different from mada.
how to get the same result of mada from meta or metafor?

require('mada')
require("meta")
require("metafor")
data(AuditC)
dat<-AuditC
fit.DOR.MH_1 <- madauni(dat, method="MH", correction = 0.5, correction.control = "all")
fit.DOR.MH_2 <- metabin(TP, TP+FN, FP, FP+TN, data = dat, backtransf = FALSE,
                       allincr = TRUE,
                       incr = 0.5,
                       method = "MH",
                       sm = "OR", common =TRUE, random = FALSE)
fit.DOR.MH_3 <-rma.mh(measure="OR", ai=TP, bi=FN, ci=FP, di=TN,
       add=c(1/2,1/2),
       to=c("all","all"),
       drop00=c(FALSE,FALSE),
       data=dat, level=95, digits = 3)

Results:

print(summary(fit.DOR.MH_1))
...
Estimates:
      MH estimate  2.5 % 97.5 %
DOR        17.933 15.194 21.166
lnDOR       2.887  2.721  3.052

Cochran's Q: 4177.192 (13 df, p = 0)

print(summary(fit.DOR.MH_2))
...
                     logOR           95%-CI     z p-value
Common effect model 3.3490 [3.1813; 3.5167] 39.14       0
...
Details on meta-analytical method:
- Mantel-Haenszel method
- Restricted maximum-likelihood estimator for tau^2
- Q-Profile method for confidence interval of tau^2 and tau
- Continuity correction of 0.5 in all studies

print(summary(fit.DOR.MH_3))
...
Model Results (log scale):
estimate     se    zval   pval  ci.lb  ci.ub
   3.349  0.086  39.139  <.001  3.181  3.517
Model Results (OR scale):
estimate   ci.lb   ci.ub
  28.473  24.077  33.672
Cochran-Mantel-Haenszel Test:    CMH = 2592.801, df = 1,  p-val < 0.001
Tarone's Test for Heterogeneity: X^2 =  102.818, df = 13, p-val < 0.001


问:
How do I remove a merge in the middle of my git log?
I have a log of 40 commits in a branch and am trying to delete a 2 merges that are in the middle of the git history.
(e.g

commit 1
commit 2
merge develop into branch
commit 4
commit 5
merge develop into branch
commit 6
)

I have tried git rebase -i <commit id> but merges don't seem to show up. Is there a better way to approach this than reseting the head and branching off and adding newer commits? I feel as though this would be super tedious!


问:
I want to create a FIFO but it isn't being created
I want to create a simple FIFO using C.  However, the function is returning -1. I don't know what I am doing wrong.
Here is the code:</p>
```<code>#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char * argv[]){

    if(mkfifo("test",0666) == -1)
    {
        printf("Something went wrong\n");
    }
    return 0;
}
</code>```

Body:
I want to create a simple FIFO using C.  However, the function is returning -1. I don't know what I am doing wrong.
Here is the code:

#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char * argv[]){

    if(mkfifo("test",0666) == -1)
    {
        printf("Something went wrong\n");
    }
    return 0;
}


问:
Join data collection MongoDB inside an array and two element result to on array
I retrieve template collection by _id and by RevisionNum value.

Data collection in Template table are as below.

```<code>{
_id: ObjectId('613f16eda156d84fd428510f'),
Templates: [
{
RevisionNum: "210719",
EffectiveDate: 2021-07-19T17:43:06.693+00:00,
HardwareVer: "A",
SoftwareVer: "1.0",
WorkTasks: ["ObjectId('abce16eda156d84fd428510f')"],
HasTraveller: true
},
{
 RevisionNum: "210908",
 EffectiveDate: 2021-07-19T17:43:06.693+00:00,
 HardwareVer: "AA",
 SoftwareVer: "11.0",
 WorkTasks: [ "ObjectId('wdfe16eda156d84fd428510f')",],
 HasTraveller: true
 },
 ]
 }
</code>```

data collection in WorkTasks Table

```<code>  {
  _id: ObjectId('abce16eda156d84fd428510f'),
   Name: "Box Assembly",
   CanPerform: [ "Benjamin", "Shirley" ],
   InstructionFiles: [
   {
   Name: "Assembly.pdf",
   MimeType: "application/pdf",
   Path: "path_to_the_file",
   },
   ]
   }
</code>```

Want to result out after Mongodb join data collection inside worksTasks array and then also combine in one array from two RevisionNum element Template table

```<code>{
 "TemplateDetails": {
 "HardwareVer": "A",
 "SoftwareVer": "1.0",
 "RevisionNum": "210719",
 "EffectiveDate": 2021-07-19T17:43:06.693+00:00,
 "HasTraveller": true,
 "WorkTasks": [
    {
        Name: "Box Assembly",
        CanPerform: [ "Benjamin", "Shirley" ],
       "InstructionFiles": [
        {
            "Name": "Assembly.pdf",
            "MimeType": "application/pdf",
            "Path": "path_to_the_file"
        },
       ]
      },..//other workTask
    ] },
   "RevisionNums": [ "210719", "210908" ]
   }
</code>```

Body:
I retrieve template collection by _id and by RevisionNum value.

Data collection in Template table are as below.

{
_id: ObjectId('613f16eda156d84fd428510f'),
Templates: [
{
RevisionNum: "210719",
EffectiveDate: 2021-07-19T17:43:06.693+00:00,
HardwareVer: "A",
SoftwareVer: "1.0",
WorkTasks: ["ObjectId('abce16eda156d84fd428510f')"],
HasTraveller: true
},
{
 RevisionNum: "210908",
 EffectiveDate: 2021-07-19T17:43:06.693+00:00,
 HardwareVer: "AA",
 SoftwareVer: "11.0",
 WorkTasks: [ "ObjectId('wdfe16eda156d84fd428510f')",],
 HasTraveller: true
 },
 ]
 }

data collection in WorkTasks Table

  {
  _id: ObjectId('abce16eda156d84fd428510f'),
   Name: "Box Assembly",
   CanPerform: [ "Benjamin", "Shirley" ],
   InstructionFiles: [
   {
   Name: "Assembly.pdf",
   MimeType: "application/pdf",
   Path: "path_to_the_file",
   },
   ]
   }

Want to result out after Mongodb join data collection inside worksTasks array and then also combine in one array from two RevisionNum element Template table

{
 "TemplateDetails": {
 "HardwareVer": "A",
 "SoftwareVer": "1.0",
 "RevisionNum": "210719",
 "EffectiveDate": 2021-07-19T17:43:06.693+00:00,
 "HasTraveller": true,
 "WorkTasks": [
    {
        Name: "Box Assembly",
        CanPerform: [ "Benjamin", "Shirley" ],
       "InstructionFiles": [
        {
            "Name": "Assembly.pdf",
            "MimeType": "application/pdf",
            "Path": "path_to_the_file"
        },
       ]
      },..//other workTask
    ] },
   "RevisionNums": [ "210719", "210908" ]
   }


问:
Skip SSL Certificate validation for SSRS report viewer control
I am implementing a report viewer control embedded in an asp.net mvc 4 application.
The issue is that the SSRS report server that has the reports to be rendered in the report viewer uses https. |

I get the error the remote certificate is invalid according to the validation procedure.

Is there a way to skip the ssl certificate validation for the report viewer.

Below is the code that I have so far.

```<code>
            Microsoft.Reporting.WebForms.ReportViewer _reportViewer = new Microsoft.Reporting.WebForms.ReportViewer();

            _reportViewer.ServerReport.ReportServerCredentials = irsc;
            _reportViewer.ProcessingMode = ProcessingMode.Remote;
            _reportViewer.ServerReport.ReportServerUrl = new Uri(AppConfiguration.SSRSReportServerURL);
            _reportViewer.ServerReport.ReportPath = reportPath;
            _reportViewer.ServerReport.SetParameters(reportParameters);
            _reportViewer.SizeToReportContent = true;
            _reportViewer.ShowParameterPrompts = false;
            _reportViewer.AsyncRendering = true;`
</code>```

Body:
I am implementing a report viewer control embedded in an asp.net mvc 4 application.
The issue is that the SSRS report server that has the reports to be rendered in the report viewer uses https. |

I get the error the remote certificate is invalid according to the validation procedure.

Is there a way to skip the ssl certificate validation for the report viewer.

Below is the code that I have so far.

            Microsoft.Reporting.WebForms.ReportViewer _reportViewer = new Microsoft.Reporting.WebForms.ReportViewer();

            _reportViewer.ServerReport.ReportServerCredentials = irsc;
            _reportViewer.ProcessingMode = ProcessingMode.Remote;
            _reportViewer.ServerReport.ReportServerUrl = new Uri(AppConfiguration.SSRSReportServerURL);
            _reportViewer.ServerReport.ReportPath = reportPath;
            _reportViewer.ServerReport.SetParameters(reportParameters);
            _reportViewer.SizeToReportContent = true;
            _reportViewer.ShowParameterPrompts = false;
            _reportViewer.AsyncRendering = true;`


问:
Add interactivity to POIs from different tilesets
I'm working on Mapbox Studio Tutorial and practicing adding interactivity on POIs on map.
https://docs.mapbox.com/help/tutorials/add-points-pt-3/

```<code>map.on('click', (event) => {
  // If the user clicked on one of your markers, get its information.
  const features = map.queryRenderedFeatures(event.point, {
    layers: ['layer1',"layer2","layer3"]
  });
  if (!features.length) {
    return;
  }
  const feature = features[0];

/*
    Create a popup, specify its options
    and properties, and add it to the map.
  */
  const popup = new mapboxgl.Popup({ offset: [0, -15] })
  .setLngLat(feature.geometry.coordinates)
  .setHTML(
    `<h3>${feature.properties.title}</h3><p>${feature.properties.description}</p>`
  )
  .addTo(map);

});
</code>```

The error I get is that the title of POIs from layer2 and layer3 is shown as "undefined" while layer1's title can be shown when clicking it on the map.

I think "undefined" comes because the title is not stored in the feature property but have no clear idea how to do that correctly.

I tried some codes I got from the internet such as below:

```<code>  if (features.length > 0) {
    // Loop feature and concatenate property as HTML strings
    let propertiesHTML = '';
    features.forEach(feature => {
      Object.entries(feature.properties).forEach(([key, value]) => {
        propertiesHTML += `<p><strong>${key}:</strong> ${value}</p>`;
      });
    });

    // Create and add a popup
    const popup = new mapboxgl.Popup({ offset: [0, -15] })
      .setLngLat(features[0].geometry.coordinates)
      .setHTML(propertiesHTML)
      .addTo(map);
</code>```

With code at least map is shown, but there is no interactive popup shown when I click it.

Body:
I'm working on Mapbox Studio Tutorial and practicing adding interactivity on POIs on map.
https://docs.mapbox.com/help/tutorials/add-points-pt-3/

map.on('click', (event) => {
  // If the user clicked on one of your markers, get its information.
  const features = map.queryRenderedFeatures(event.point, {
    layers: ['layer1',"layer2","layer3"]
  });
  if (!features.length) {
    return;
  }
  const feature = features[0];

/*
    Create a popup, specify its options
    and properties, and add it to the map.
  */
  const popup = new mapboxgl.Popup({ offset: [0, -15] })
  .setLngLat(feature.geometry.coordinates)
  .setHTML(
    `<h3>${feature.properties.title}</h3><p>${feature.properties.description}</p>`
  )
  .addTo(map);

});

The error I get is that the title of POIs from layer2 and layer3 is shown as "undefined" while layer1's title can be shown when clicking it on the map.

I think "undefined" comes because the title is not stored in the feature property but have no clear idea how to do that correctly.

I tried some codes I got from the internet such as below:

  if (features.length > 0) {
    // Loop feature and concatenate property as HTML strings
    let propertiesHTML = '';
    features.forEach(feature => {
      Object.entries(feature.properties).forEach(([key, value]) => {
        propertiesHTML += `<p><strong>${key}:</strong> ${value}</p>`;
      });
    });

    // Create and add a popup
    const popup = new mapboxgl.Popup({ offset: [0, -15] })
      .setLngLat(features[0].geometry.coordinates)
      .setHTML(propertiesHTML)
      .addTo(map);

With code at least map is shown, but there is no interactive popup shown when I click it.


问:
Is there any way to customize telerik radmenuitem header in wpf?
I'm trying to customize a header in radmenuitem to have header and infoicon in leftside of header, but I couldn't achieve it because text binding is not working.
Also I have an icon at left which is like
consider this for ref which I want ---  "icon  header   infoicon"

I tried this code

```<code> <telerik:RadMenuItem
      Command="{Binding }"
      CommandParameter="{Binding}"
     <telerik:RadMenuItem.IconTemplate>
          <DataTemplate>
           <image/>
            </DataTemplate>
     </telerik:RadMenuItem.IconTemplate>
     <telerik:RadMenuItem.HeaderTemplate>
          <DataTemplate>
           <stackpanel>
          <textblock text="{binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}                                               ,path=datacontext.text ,updatsourcetrigger=propertychanged,mode=twoway/>
           <image/
         </DataTemplate>
         </stackpanel
      </telerik:RadMenuItem.HeaderTemplate>
      <telerik:RadMenuItem.Style>
         <Style TargetType="{x:Type telerik:RadMenuItem}"/>
      </<telerik:RadMenuItem.Style>
</telerik:RadMenuItem>`
</code>```

expected to happen
(icon  header  infoicon)

I'm getting like this
(icon infoicon) header is missing

Body:
I'm trying to customize a header in radmenuitem to have header and infoicon in leftside of header, but I couldn't achieve it because text binding is not working.
Also I have an icon at left which is like
consider this for ref which I want ---  "icon  header   infoicon"

I tried this code

 <telerik:RadMenuItem
      Command="{Binding }"
      CommandParameter="{Binding}"
     <telerik:RadMenuItem.IconTemplate>
          <DataTemplate>
           <image/>
            </DataTemplate>
     </telerik:RadMenuItem.IconTemplate>
     <telerik:RadMenuItem.HeaderTemplate>
          <DataTemplate>
           <stackpanel>
          <textblock text="{binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}                                               ,path=datacontext.text ,updatsourcetrigger=propertychanged,mode=twoway/>
           <image/
         </DataTemplate>
         </stackpanel
      </telerik:RadMenuItem.HeaderTemplate>
      <telerik:RadMenuItem.Style>


问:
How to save spinner state on device rotation using a ViewModel?
How do you restore the Spinners selected item index a view model?

Right now I have a setup where you set a selectedIndex property on the ViewModel within the spinners OnItemSelectedListener.

The problem I'm running into is that every time the Fragment recreates, the selected listener gets re-assigned to the spinner, and the OnItemSelectedListener get fired for index 0, overriding whatever is stored in the ViewModel.

I feel like I'm missing something super simple here.

```<code>    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        // Set the spinners onItemSelectedListener
        binding.spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
            override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
                viewModel.setSelectedItem(p2)
            }

            override fun onNothingSelected(p0: AdapterView<*>?) {
                TODO("Not yet implemented")
            }
        }

        // Restore spinner to previously selected state
        viewModel.getSelectedCompanyIndex().let {
            binding.spinner.setSelection(it)
        }

        // Observe the spinner data.
        viewModel.spinnerData.observe(this) { spinnerArray ->
            ArrayAdapter(
                requireContext(),
                R.layout.simple_spinner_dropdown_item,
                spinnerArray
            ).also {
                binding.spinner.adapter = it
            }
    }
</code>```

Body:
How do you restore the Spinners selected item index a view model?

Right now I have a setup where you set a selectedIndex property on the ViewModel within the spinners OnItemSelectedListener.

The problem I'm running into is that every time the Fragment recreates, the selected listener gets re-assigned to the spinner, and the OnItemSelectedListener get fired for index 0, overriding whatever is stored in the ViewModel.

I feel like I'm missing something super simple here.

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        // Set the spinners onItemSelectedListener
        binding.spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
            override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
                viewModel.setSelectedItem(p2)
            }

            override fun onNothingSelected(p0: AdapterView<*>?) {
                TODO("Not yet implemented")
            }
        }

        // Restore spinner to previously selected state
        viewModel.getSelectedCompanyIndex().let {
            binding.spinner.setSelection(it)
        }

        // Observe the spinner data.
        viewModel.spinnerData.observe(this) { spinnerArray ->
            ArrayAdapter(
                requireContext(),
                R.layout.simple_spinner_dropdown_item,
                spinnerArray
            ).also {
                binding.spinner.adapter = it
            }
    }


问:
React Cropper misconfigured when viewport height changes
On this StackBlitz: https://stackblitz.com/edit/rodal-cropper?file=src%2FApp.js

I have the following code:

```<code>import React, { useRef, useState } from 'react';
import Rodal from 'rodal';
import 'rodal/lib/rodal.css';
import Cropper from "react-cropper";
import "cropperjs/dist/cropper.css";
import './style.css';

export default function App() {

  const [isModalVisible, setIsModalVisible] = useState(false);
  const [image, setImage] = useState(null);

  const openModal = () => {
    setIsModalVisible(true);
  };

  const closeModal = () => {
    setIsModalVisible(false);
  };

  const cropperRef = useRef(null);

  return (
    <div>
      <h1>Hello StackBlitz!</h1>
      <p>Start editing to see some magic happen :)</p>
      <button onClick={openModal}>Open Modal</button>
      <Rodal
        visible={isModalVisible}
        onClose={closeModal}
        closeOnEsc
        customStyles={{
          width: '100%',
          height: '100%',
          maxWidth: '620px',
          maxHeight: '600px',
        }}
        customMaskStyles={{ backgroundColor: 'rgba(0, 0, 0, 0.8)' }}
      >
        <br />
        <button onClick={() => setImage('https://i.ibb.co/jZBdmCk/image.png')}>Set Image</button>{' '}
        <button onClick={() => closeModal()}>Close Modal</button>
        <br />
        <br />
        <Cropper
          src={image}
          style={{ height: 400, width: '100%', backgroundColor: '#d1d1d1' }}
          aspectRatio={1}
          viewMode={1}
          minCropBoxHeight={10}
          minCropBoxWidth={10}
          background={false}
          responsive={true}
          autoCropArea={1}
          guides={true}
          ref={cropperRef}
        />
      </Rodal>
    </div>
  );
}
</code>```

My problem is: When the viewport changes the height the react-cropper gets misconfigured.

Reproduce Steps:

Go to: https://stackblitz.com/edit/rodal-cropper?file=src%2FApp.js

Open StackBlitz built-in Console (small height is enough)

Click button: Open Modal

Click button: Set Image → Image and cropper properly displayed

Click button: Close Modal

Click button: Open Modal → Image and cropper properly displayed

Click button: Close Modal

Resize (height) just a bit the StackBlitz built-in Console

Click button: Open Modal → Image and cropper NOT properly displayed

before...

after...

What could I change on the code to fix that issue?

Body:
On this StackBlitz: https://stackblitz.com/edit/rodal-cropper?file=src%2FApp.js

I have the following code:

import React, { useRef, useState } from 'react';
import Rodal from 'rodal';
import 'rodal/lib/rodal.css';
import Cropper from "react-cropper";
import "cropperjs/dist/cropper.css";
import './style.css';

export default function App() {

  const [isModalVisible, setIsModalVisible] = useState(false);
  const [image, setImage] = useState(null);

  const openModal = () => {
    setIsModalVisible(true);
  };

  const closeModal = () => {
    setIsModalVisible(false);
  };

  const cropperRef = useRef(null);

  return (

Hello StackBlitz!

Start editing to see some magic happen :)

      <button onClick={openModal}>Open Modal</button>
      <Rodal
        visible={isModalVisible}
        onClose={closeModal}
        closeOnEsc
        customStyles={{
          width: '100%',
          height: '100%',
          maxWidth: '620px',
          maxHeight: '600px',
        }}
        customMaskStyles={{ backgroundColor: 'rgba(0, 0, 0, 0.8)' }}
      >

        <button onClick={() => setImage('https://i.ibb.co/jZBdmCk/image.png')}>Set Image</button>{' '}
        <button onClick={() => closeModal()}>Close Modal</button>

        <Cropper
          src={image}
          style={{ height: 400, width: '100%', backgroundColor: '#d1d1d1' }}
          aspectRatio={1}
          viewMode={1}
          minCropBoxHeight={10}
          minCropBoxWidth={10}
          background={false}
          responsive={true}
          autoCropArea={1}
          guides={true}
          ref={cropperRef}
        />
      </Rodal>

  );
}

My problem is: When the viewport changes the height the react-cropper gets misconfigured.

Reproduce Steps:

Go to: https://stackblitz.com/edit/rodal-cropper?file=src%2FApp.js

Open StackBlitz built-in Console (small height is enough)

Click button: Open Modal

Click button: Set Image → Image and cropper properly displayed

Click button: Close Modal

Click button: Open Modal → Image and cropper properly displayed

Click button: Close Modal

Resize (height) just a bit the StackBlitz built-in Console

Click button: Open Modal → Image and cropper NOT properly displayed

before...

after...

What could I change on the code to fix that issue?