问:
connect_kwargs not attribute of open
I wanted to connect to a server, but it gave me an error that I need a method of SSH athentication, so I simply made a key-value pair with "open()" and "connect_kwargs".

As I specified earlier this is my code:

```<code>from fabric import Connection
import socket
uinaaaa = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
uinaaaa.connect(("8.8.8.8", 80))
xin = uinaaaa.getsockname()[0]
PERSONA = Connection(f"user@{xin}")
PERSONA.open(connect_kwargs={'password': "LOSER"})
print("Ok, now you will learn all the server's commands!")
YUIA = PERSONA.run("help")
print(YUIA.standout)
print("If you want to learn more, type man, after that, a space, and then the command to learn more!")
</code>```

but I got:

```<code>Traceback (most recent call last):
  File "main.py", line 7, in <module>
    PERSONA.open(connect_kwargs={'password': "LOSER"})
TypeError: open() got an unexpected keyword argument 'connect_kwargs'
</code>```

I don't know how to fix this. Is it an entirely differnet function then "open()" or just a different argument than connect_kwargs? Please help!

Title: connect_kwargs not attribute of open

Body:
I wanted to connect to a server, but it gave me an error that I need a method of SSH athentication, so I simply made a key-value pair with "open()" and "connect_kwargs".

As I specified earlier this is my code:

from fabric import Connection
import socket
uinaaaa = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
uinaaaa.connect(("8.8.8.8", 80))
xin = uinaaaa.getsockname()[0]
PERSONA = Connection(f"user@{xin}")
PERSONA.open(connect_kwargs={'password': "LOSER"})
print("Ok, now you will learn all the server's commands!")
YUIA = PERSONA.run("help")
print(YUIA.standout)
print("If you want to learn more, type man, after that, a space, and then the command to learn more!")

but I got:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    PERSONA.open(connect_kwargs={'password': "LOSER"})
TypeError: open() got an unexpected keyword argument 'connect_kwargs'

I don't know how to fix this. Is it an entirely differnet function then "open()" or just a different argument than connect_kwargs? Please help!


来源: stackexchange

问:
Disable complete brackets on function suggestions VScode Golang
How to disable auto completion brackets on function suggestions?
Like typescript.suggest.completeFunctionCalls

I didn't find this setting in Go extension

ContentLicense: CC BY-SA 4.0


问:
C++ cannot find overloaded function when argument has namespace
I am implementing serialization that's supposed to work by recursive overloading until serializing data breaks down to primitive types. Here it's relevant code at serialization.hpp:

```<code>#pragma once
#include <fstream>
#include <ranges>
#include <concepts>
using namespace std;

void write( fstream & f, const integral auto & data );
void write( fstream & f, const pair<auto,auto> & p );
void write( fstream & f, const ranges::range auto & data );

void write( fstream & f, const integral auto & data ) {
    f.write( (const char*)&data, sizeof( data ) );
}
void write( fstream & f, const pair<auto,auto> & p ) {
    write( f, p.first );
    write( f, p.second );
}
void write( fstream & f, const ranges::range auto & data ) {
    const uint64_t size = ranges::size( data );
    write( f, size );
    for ( const auto & i : data ) {
        write( f, i );
    }
}
</code>```

And it works well for most types providing serialization for free even for std::map, std::list, etc. If user needs to serialize any custom type then it's needed to just provide a void write( fstream & f, const CustomType & t ) { ... } function and it supposed to get serialized even inside any data structure. And it works well until CustomData gets wrapped into a namespace. main.cpp:

```<code>#include "serialization.hpp"
#include <fstream>
#include <map>
using namespace std;

struct MyData {
    int custom_data[ 666 ];
};
void write( fstream & f, const MyData & d ) {
    write( f, d.custom_data[ 123 ] );
}

namespace my_namespace {
    struct NamespacedData {
        int custom_data[ 777 ];
    };
}//namespace my_namespace
void write( fstream & f, const my_namespace::NamespacedData & d ) {
    write( f, d.custom_data[ 7 ] );
}

int main() {
    auto f = fstream( "my_data.binary", ios::out | ios::binary );
    f.exceptions( fstream::badbit | fstream::failbit | fstream::eofbit );

    map< int, MyData > my_map;
    //DOES work:
    write( f, my_map );

    map< int, my_namespace::NamespacedData > namespaced_map;
    //does NOT work:
    write( f, namespaced_map );
}
</code>```

Compilation fails with error: serialization.hpp:16:10: error: no matching function for call to ‘write(std::fstream&, const my_namespace::NamespacedData&)’ ...

How function argument's full name matters here? Isn't it's irrelevant when compiler should try to match any type when looking for fitting overloaded function? Or it's just gcc bug?

Command: g++ main.cpp -std=gnu++20 -fconcepts

g++ version 11.3.0

Body:
I am implementing serialization that's supposed to work by recursive overloading until serializing data breaks down to primitive types. Here it's relevant code at serialization.hpp:

#pragma once
#include <fstream>
#include <ranges>
#include <concepts>
using namespace std;

void write( fstream & f, const integral auto & data );
void write( fstream & f, const pair<auto,auto> & p );
void write( fstream & f, const ranges::range auto & data );

void write( fstream & f, const integral auto & data ) {
    f.write( (const char*)&data, sizeof( data ) );
}
void write( fstream & f, const pair<auto,auto> & p ) {
    write( f, p.first );
    write( f, p.second );
}
void write( fstream & f, const ranges::range auto & data ) {
    const uint64_t size = ranges::size( data );
    write( f, size );
    for ( const auto & i : data ) {
        write( f, i );
    }
}

And it works well for most types providing serialization for free even for std::map, std::list, etc. If user needs to serialize any custom type then it's needed to just provide a void write( fstream & f, const CustomType & t ) { ... } function and it supposed to get serialized even inside any data structure. And it works well until CustomData gets wrapped into a namespace. main.cpp:

#include "serialization.hpp"
#include <fstream>
#include <map>
using namespace std;

struct MyData {
    int custom_data[ 666 ];
};
void write( fstream & f, const MyData & d ) {
    write( f, d.custom_data[ 123 ] );
}

namespace my_namespace {
    struct NamespacedData {
        int custom_data[ 777 ];
    };
}//namespace my_namespace
void write( fstream & f, const my_namespace::NamespacedData & d ) {
    write( f, d.custom_data[ 7 ] );
}

int main() {
    auto f = fstream( "my_data.binary", ios::out | ios::binary );
    f.exceptions( fstream::badbit | fstream::failbit | fstream::eofbit );

    map< int, MyData > my_map;
    //DOES work:
    write( f, my_map );

    map< int, my_namespace::NamespacedData > namespaced_map;
    //does NOT work:
    write( f, namespaced_map );
}

Compilation fails with error: serialization.hpp:16:10: error: no matching function for call to ‘write(std::fstream&, const my_namespace::NamespacedData&)’ ...

How function argument's full name matters here? Isn't it's irrelevant when compiler should try to match any type when looking for fitting overloaded function? Or it's just gcc bug?

Command: g++ main.cpp -std=gnu++20 -fconcepts

g++ version 11.3.0


问:
Japanese characters are garbled when connecting to mysql from python using docker
I created python and mysql containers using docker, connected to mysql from python, and tried to display tables using fetchall, but the Japanese characters were garbled.

I entered the mysql container and tried to display the file directly, but it may or may not be garbled depending on the character encoding setting.
Due to the data handled, it seems to display correctly when read in latin1.

Does anyone know how to display this data from python, or is it not possible to display the data in latin1?

[In case of garbled characters↓]

```<code>+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
</code>```

[If the characters are not garbled↓]

```<code>+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
</code>```

Due to the data being handled, it seems to display correctly when read in latin1.

So I changed the character encoding from the python code and tried again while displaying the settings, but the characters were garbled when read from python even though the character encoding settings were the same. I've tried charset, changing charset (all to utf8mb4 or utf8, etc.), and various other things, but the characters are garbled.

[test.py]

```<code># coding: latin1
import mysql.connector

#Connect to mysql from python
cnx = mysql.connector.connect(
host='',
port='3306',
user='user',
password='pass',
database='test_database',
charset='latin1'
    )
cursor_=cnx.cursor()

cursor_.execute("use test_database;")

#Change character encoding and get status of settings
query1 = "SET CHARACTER SET latin1;"
cursor_.execute(query1)

cursor_.execute("show variables like 'chara%';")
rows = cursor_.fetchall()
for row in rows:
  print (row)

cursor_.execute("select * from test;")
rows = cursor_.fetchall()
for row in rows:
  print (row)
</code>```
```<code>('character_set_client', 'latin1')
('character_set_connection', 'utf8mb4')
('character_set_database', 'utf8mb4')
('character_set_filesystem', 'binary')
('character_set_results', 'latin1')
('character_set_server', 'utf8mb4')
('character_set_system', 'utf8')
('character_sets_dir', '/usr/share/mysql/charsets/')
</code>```

Also, attempts to attach cording to print failed because it was a tuple type. The solution to this is also unknown.

```<code>for row in rows:
  print (row.cording(utf8やlatin1))
</code>```
```<code>'tuple' object has no attribute 'encord'
</code>```

Body:
I created python and mysql containers using docker, connected to mysql from python, and tried to display tables using fetchall, but the Japanese characters were garbled.

I entered the mysql container and tried to display the file directly, but it may or may not be garbled depending on the character encoding setting.
Due to the data handled, it seems to display correctly when read in latin1.

Does anyone know how to display this data from python, or is it not possible to display the data in latin1?

[In case of garbled characters↓]

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

[If the characters are not garbled↓]

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

Due to the data being handled, it seems to display correctly when read in latin1.

So I changed the character encoding from the python code and tried again while displaying the settings, but the characters were garbled when read from python even though the character encoding settings were the same. I've tried charset, changing charset (all to utf8mb4 or utf8, etc.), and various other things, but the characters are garbled.

[test.py]

# coding: latin1
import mysql.connector

#Connect to mysql from python
cnx = mysql.connector.connect(
host='',
port='3306',
user='user',
password='pass',
database='test_database',
charset='latin1'
    )
cursor_=cnx.cursor()

cursor_.execute("use test_database;")

#Change character encoding and get status of settings
query1 = "SET CHARACTER SET latin1;"
cursor_.execute(query1)

cursor_.execute("show variables like 'chara%';")
rows = cursor_.fetchall()
for row in rows:
  print (row)

cursor_.execute("select * from test;")
rows = cursor_.fetchall()
for row in rows:
  print (row)

('character_set_client', 'latin1')
('character_set_connection', 'utf8mb4')
('character_set_database', 'utf8mb4')
('character_set_filesystem', 'binary')
('character_set_results', 'latin1')
('character_set_server', 'utf8mb4')
('character_set_system', 'utf8')
('character_sets_dir', '/usr/share/mysql/charsets/')

Also, attempts to attach cording to print failed because it was a tuple type. The solution to this is also unknown.

for row in rows:
  print (row.cording(utf8やlatin1))

'tuple' object has no attribute 'encord'


问:
How to add elevation to the textInputLayout in android?
I try to add elevation to my TextInputLayout but android:elevation="10dp doesn't work!
How can I do this?</p>
```<code>  <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputLayout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:elevation="10dp>

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusableInTouchMode="true"
            />

    </com.google.android.material.textfield.TextInputLayout>
</code>```

Body:
I try to add elevation to my TextInputLayout but android:elevation="10dp doesn't work!
How can I do this?

  <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputLayout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:elevation="10dp>

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusableInTouchMode="true"
            />

    </com.google.android.material.textfield.TextInputLayout>


问:
CSS transition not working when changing react state
I want to see animation when I change width of my sidebar. Material UI is used here (AppBar). I think it's because React just re-renders component quickly. How you would do it? I think it would work if i just changed class or added class.

Also it' necessary to understand that content of StyledAppBar will depend on whether it's opened. So I will need re-render so that the content change

Additional question - do you know how to make AppBar render as  tag instead oh  tag? :)

```<code>const Header = () => {
  const [open, setOpen] = useState(true);

  const StyledAppBar = styled(AppBar)`
    background-color: red;
    height: 100vh;
    width: ${open ? '240px' : '50px'};
    transition: width 1s ease-in-out;
    position: fixed;
    left: 0;
  `;

  return (
    <StyledAppBar>
      <Toolbar>
        <Typography>MUI SHOP</Typography>
        <ShoppingBasket onClick={() => setOpen(prev => !prev)}/>
      </Toolbar>
    </StyledAppBar>
  );
};
</code>```

Body:
I want to see animation when I change width of my sidebar. Material UI is used here (AppBar). I think it's because React just re-renders component quickly. How you would do it? I think it would work if i just changed class or added class.

Also it' necessary to understand that content of StyledAppBar will depend on whether it's opened. So I will need re-render so that the content change

Additional question - do you know how to make AppBar render as  tag instead oh  tag? :)

const Header = () => {
  const [open, setOpen] = useState(true);

  const StyledAppBar = styled(AppBar)`
    background-color: red;
    height: 100vh;
    width: ${open ? '240px' : '50px'};
    transition: width 1s ease-in-out;
    position: fixed;
    left: 0;
  `;

  return (

  );
};


问:
jest spyOn mockimplementation on callback as argument not working
Here I'm trying to mock a function whose args is a callback function which setState inside. but I'm not able to cover this piece of code in code coverage.
Is this the right way to mock this function?</p>
```<code>const func =()={
//some other logic
window.__promos.holiday.event('gift',(data)=>{
setState(data)
})
}
</code>```
```<code> test('window.__promo calls the callback function with the correct data', () => {
  // Spy on the callback function and provide a mock implementation
  jest.spyOn(window.__promo.holiday, 'event').mockImplementation(('gift', cb) => {
    cb('data');
  });
});
</code>```

Body:
Here I'm trying to mock a function whose args is a callback function which setState inside. but I'm not able to cover this piece of code in code coverage.
Is this the right way to mock this function?

const func =()={
//some other logic
window.__promos.holiday.event('gift',(data)=>{
setState(data)
})
}

 test('window.__promo calls the callback function with the correct data', () => {
  // Spy on the callback function and provide a mock implementation
  jest.spyOn(window.__promo.holiday, 'event').mockImplementation(('gift', cb) => {
    cb('data');
  });
});


问:
ERROR 117 on nvim when i press "tab" in insert mode

I'm installing some plugins and mapping some shortcuts on my init.vim file, the thing is that when I press the "tab" button on my keyboard in insert mode the program shows me this, in insert mode the tab doesn't work but in normal mode tab works correctly, I'm new using this text editor and I have no idea on how to solve this.

this is my init.vim script

```<code>":::instalacion de plugins:::

call plug#begin('~/.config/nvim/plugged')   "directorio donde se van a instalar los plugins

"plugins
Plug 'joshdick/onedark.vim'         "tema
Plug 'Yggdroot/indentLine'      "indentacion
Plug 'mattn/emmet-vim'          "emmet para diseño web
Plug 'vim-airline/vim-airline'      "diseño de la barra en la cual se muestran los modos, la linea, etc.
Plug 'vim-airline/vim-airline-themes'   "temas para el vim-airline
Plug 'preservim/nerdtree'       "gestor de archivos en forma de arbol.
Plug 'christoomey/vim-tmux-navigator'   "poder navegar entre archivos abiertos
Plug 'jiangmiao/auto-pairs'     "autocompletado de llaves, corchetes, etc.
Plug 'neoclide/coc.nvim', {'branch': 'release'} "autocompletado inteligente

call plug#end()             "cerramos el llamado de los plugins

"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"CONFIGURACIONES BASICAS
set number              "muestra los numeros de cada linea en la parte izquierda
set relativenumber          "la distribucion de los numeros en lineas de manera relativa
set mouse=a                 "permite la interaccion con el mouse
set noshowmode              "me deja de mostrar el modo en el que estamos 'normal, insert, visual, etc'
syntax enable               "activa el coloreado de sintaxis en algunos tipos de archivos como html, c, c++
set encoding=utf-8          "permite setear la codificación de archivos para aceptar caracteres especiales
set sw=4                "la indentación genera 4 espacios
set nowrap              "el texto en una linea no baja a la siguiente, solo continua en la misma hasta el infinito.
"set noswapfile             "para evitar el mensaje que sale al abrir algunos archivos sobre swap.
set clipboard=unnamed           "para poder utilizar el portapapeles del sistema operativo 'esto permite poder copiar y pegar desde cualquier parte a nvim y viceversa.

"configuracion del tema
set termguicolors           "activa el true color en la terminal
colorscheme onedark             "activar el tema onedark

"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"configuracion de emmet-vim
let mapleader=' '
let g:user_emmet_leader_key=','     "mapeando la tecla lider por una coma, con esto se completa los tag con doble coma.
nmap <Leader>w :w<CR>
nmap <Leader>q :q<CR>

"configuracion de vim-airline
let g:airline#extensions#tabline#enabled = 1    "muestra la linea de pestaña en la que estamos buffer
let g:airline#extensions#tabline#formatter = 'unique_tail'  "muestra solo el nombre del archivo que estamos modificando
let g:airline_theme='onedark'   "el tema de airline

"configuracion de nerdtree
"mapeando el abrir y cerrar de nerdtree con nerdtreetoggle vemos los archivos en el arbol y podemos cerrarlo a la vez, map es la C mayuscula representa el
"control y -n la tecla n lo que indica que realizará la siguiente funcion de excribir el comando NERDTreeToggle y CR significa ENTER.
map <C-n> :NERDTreeToggle<CR>

"configuracion por defecto de coc
" TextEdit might fail if hidden is not set.
set hidden

" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup

" Give more space for displaying messages.
set cmdheight=2

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300

" Don't pass messages to |ins-completion-menu|.
set shortmess+=c

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
  " Recently vim can merge signcolumn and number column into one
  set signcolumn=number
else
  set signcolumn=yes
endif

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  elseif (coc#rpc#ready())
    call CocActionAsync('doHover')
  else
    execute '!' . &keywordprg . " " . expand('<cword>')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)

" Formatting selected code.
xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s).
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder.
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac  <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

" Remap <C-f> and <C-b> for scroll float windows/popups.
" Note coc#float#scroll works on neovim >= 0.4.0 or vim >= 8.2.0750
nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"

" NeoVim-only mapping for visual mode scroll
" Useful on signatureHelp after jump placeholder of snippet expansion
if has('nvim')
  vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
  vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
endif

" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)

" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')

" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call     CocAction('fold', <f-args>)

" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR   :call     CocAction('runCommand', 'editor.action.organizeImport')

" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>

</code>```

i was trying to install some plugins and also mapping some new shortcuts

Body:
I'm installing some plugins and mapping some shortcuts on my init.vim file, the thing is that when I press the "tab" button on my keyboard in insert mode the program shows me this, in insert mode the tab doesn't work but in normal mode tab works correctly, I'm new using this text editor and I have no idea on how to solve this.

this is my init.vim script

":::instalacion de plugins:::

call plug#begin('~/.config/nvim/plugged')   "directorio donde se van a instalar los plugins

"plugins
Plug 'joshdick/onedark.vim'         "tema
Plug 'Yggdroot/indentLine'      "indentacion
Plug 'mattn/emmet-vim'          "emmet para diseño web
Plug 'vim-airline/vim-airline'      "diseño de la barra en la cual se muestran los modos, la linea, etc.
Plug 'vim-airline/vim-airline-themes'   "temas para el vim-airline
Plug 'preservim/nerdtree'       "gestor de archivos en forma de arbol.
Plug 'christoomey/vim-tmux-navigator'   "poder navegar entre archivos abiertos
Plug 'jiangmiao/auto-pairs'     "autocompletado de llaves, corchetes, etc.
Plug 'neoclide/coc.nvim', {'branch': 'release'} "autocompletado inteligente

call plug#end()             "cerramos el llamado de los plugins

"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"CONFIGURACIONES BASICAS
set number              "muestra los numeros de cada linea en la parte izquierda
set relativenumber          "la distribucion de los numeros en lineas de manera relativa
set mouse=a                 "permite la interaccion con el mouse
set noshowmode              "me deja de mostrar el modo en el que estamos 'normal, insert, visual, etc'
syntax enable               "activa el coloreado de sintaxis en algunos tipos de archivos como html, c, c++
set encoding=utf-8          "permite setear la codificación de archivos para aceptar caracteres especiales
set sw=4                "la indentación genera 4 espacios
set nowrap              "el texto en una linea no baja a la siguiente, solo continua en la misma hasta el infinito.
"set noswapfile             "para evitar el mensaje que sale al abrir algunos archivos sobre swap.
set clipboard=unnamed           "para poder utilizar el portapapeles del sistema operativo 'esto permite poder copiar y pegar desde cualquier parte a nvim y viceversa.

"configuracion del tema
set termguicolors           "activa el true color en la terminal
colorscheme onedark             "activar el tema onedark

"::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"configuracion de emmet-vim
let mapleader=' '
let g:user_emmet_leader_key=','     "mapeando la tecla lider por una coma, con esto se completa los tag con doble coma.
nmap <Leader>w :w<CR>
nmap <Leader>q :q<CR>

"configuracion de vim-airline
let g:airline#extensions#tabline#enabled = 1    "muestra la linea de pestaña en la que estamos buffer
let g:airline#extensions#tabline#formatter = 'unique_tail'  "muestra solo el nombre del archivo que estamos modificando
let g:airline_theme='onedark'   "el tema de airline

"configuracion de nerdtree
"mapeando el abrir y cerrar de nerdtree con nerdtreetoggle vemos los archivos en el arbol y podemos cerrarlo a la vez, map es la C mayuscula representa el
"control y -n la tecla n lo que indica que realizará la siguiente funcion de excribir el comando NERDTreeToggle y CR significa ENTER.
map <C-n> :NERDTreeToggle<CR>

"configuracion por defecto de coc
" TextEdit might fail if hidden is not set.
set hidden

" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup

" Give more space for displaying messages.
set cmdheight=2

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300

" Don't pass messages to |ins-completion-menu|.
set shortmess+=c

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
  " Recently vim can merge signcolumn and number column into one
  set signcolumn=number
else
  set signcolumn=yes
endif

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  elseif (coc#rpc#ready())
    call CocActionAsync('doHover')
  else
    execute '!' . &keywordprg . " " . expand('<cword>')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)

" Formatting selected code.
xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s).
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder.
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac  <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

" Remap <C-f> and <C-b> for scroll float windows/popups.
" Note coc#float#scroll works on neovim >= 0.4.0 or vim >= 8.2.0750
nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"

" NeoVim-only mapping for visual mode scroll
" Useful on signatureHelp after jump placeholder of snippet expansion
if has('nvim')
  vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
  vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
endif

" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)

" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')

" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call     CocAction('fold', <f-args>)

" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR   :call     CocAction('runCommand', 'editor.action.organizeImport')

" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>

i was trying to install some plugins and also mapping some new shortcuts


问:
How to make neo4j to read non english path?
```<code>023-01-07 15:59:41.406+0000 WARN  Config file
[C:\Users\u0410\u0434\u043C\u0438\u043D\.Neo4jDesktop\relate-data\dbmss\dbms-28f8b421-
de24-438e-a795-13870c97715a\conf\neo4j.conf] does not exist.
2023-01-07 15:59:41.407+0000 INFO  Neo4j Server shutdown initiated by request
2023-01-07 15:59:41.407+0000 INFO  Stopped.
</code>```

I guess the problem is in the path because my actual path is

```<code>C:\Users\Админ\.Neo4jDesktop\relate-data\dbmss\dbms-28f8b421-de24-438e-a795-
13870c97715a\conf\neo4j.conf
</code>```

The config file exists. Is there any options to change the folder or to make neo4j parse the word properly not in unicode?

Body:
023-01-07 15:59:41.406+0000 WARN  Config file
[C:\Users\u0410\u0434\u043C\u0438\u043D\.Neo4jDesktop\relate-data\dbmss\dbms-28f8b421-
de24-438e-a795-13870c97715a\conf\neo4j.conf] does not exist.
2023-01-07 15:59:41.407+0000 INFO  Neo4j Server shutdown initiated by request
2023-01-07 15:59:41.407+0000 INFO  Stopped.

I guess the problem is in the path because my actual path is

C:\Users\Админ\.Neo4jDesktop\relate-data\dbmss\dbms-28f8b421-de24-438e-a795-
13870c97715a\conf\neo4j.conf

The config file exists. Is there any options to change the folder or to make neo4j parse the word properly not in unicode?


问:
Why can't my editor understand characters like é, è, à
I have been working on college project(C language), and i am stuck in the part where I need to read a file, the issue is that the compiler can't display nor read properly the characters such as é,à, ç...
Here's the original txt file:
<titre>Des chercheurs parviennent à régénérer les muscles de souris myopathes</titre>

and here's what the code reads from it:
<titre>Des chercheurs parviennent Î± rÎgÎnÎrer les muscles de souris myopathes</titre>

And therefore I can't even work on them properly, for example if i try to find the word "régénérer" in the string, it gives me false.
Do you have any idea what can I do to properly get the content of the file as a string?


问:
how to select specific element id from dynamic element ids and pass it as function arguments - javascript?
Upon onclick function other variables pass to another function perfectly but when checking the val() of specific Input field value it gives undefined. I might be wrong it following way

maybe I am  not getting the input text field id correctly

No proper way of making the input element id dynamic

element id is not escaping properly

Here is my code

```<code>`function addVariable(data, index) {

        var datavar = {

            itemname : data[index].name,
            itemprice : data[index].price,
            itemtotal : data[index].price,
            itemcounter :  data[index].id,
          };

        addRow(datavar);  // creates table and display data + input field

       }`

function addRow(datavar){

            var inputvalue= 'inputid'+ datavar.itemcounter;
            var btn ="<input type='button' onclick='addbill("+datavar.itemprice+","+datavar.itemcounter+",\""+inputvalue+"\");'  value='add item' />";

         var $table =$('#product_list tbody');
         var $row  =
                    $(
                      " <tr id='parent "+datavar.itemcounter + " '>" +
                      "<td id='price "+datavar.itemcounter + " '>" + datavar.itemname +    "</td>" +
                        "<td>" + datavar.itemprice +    "</td>" +
                        "<td >  <input type='text' id='"+inputvalue+" '   name='"+inputvalue+"'     min='1'  >     </td>" +

                        "<td>" + btn + "</td>" +

                        "</tr>"
                    );

                    $row.data("itemname",datavar.itemname);
                    $row.data("itemnprice",datavar.itemprice);
                    $row.data("itemntotal",datavar.itemtotal);
                    $row.data("itemntotal",datavar.itemcounter);
                    $row.data("quantity",inputy);

                  total += Number(datavar.itemprice );
                  $('#finaltotal').val(total);

                  $table.append($row);

                }

`function addbill(itemprice,itemid,inputvalue){

              var t =   document.getElementById(inputvalue).value; // gives undefined in console.log

             //  var t  = $('#' + inputvalue).val();  // same issue as above

             //  var t  =  $('#product_list tbody').find('input').val(); // gets first row input value
}
</code>```

`

upon checking directly as console.log(inputvalue) it gives dynamic id such as inputvalue1 ,inputvalue2, as their respective loop value but I am not able to get the value of input field upon using val() or value

Body:
Upon onclick function other variables pass to another function perfectly but when checking the val() of specific Input field value it gives undefined. I might be wrong it following way

maybe I am  not getting the input text field id correctly

No proper way of making the input element id dynamic

element id is not escaping properly

Here is my code

`function addVariable(data, index) {

        var datavar = {

            itemname : data[index].name,
            itemprice : data[index].price,
            itemtotal : data[index].price,
            itemcounter :  data[index].id,
          };

        addRow(datavar);  // creates table and display data + input field

       }`

function addRow(datavar){

            var inputvalue= 'inputid'+ datavar.itemcounter;
            var btn ="<input type='button' onclick='addbill("+datavar.itemprice+","+datavar.itemcounter+",\""+inputvalue+"\");'  value='add item' />";

         var $table =$('#product_list tbody');
         var $row  =
                    $(
                      "
" +
                      "" + datavar.itemname +    "	" +
                        "" + datavar.itemprice +    "	" +
                        "  <input type='text' id='"+inputvalue+" '   name='"+inputvalue+"'     min='1'  >     	" +

                        "" + btn + "	" +

                        "
"
                    );

                    $row.data("itemname",datavar.itemname);
                    $row.data("itemnprice",datavar.itemprice);
                    $row.data("itemntotal",datavar.itemtotal);
                    $row.data("itemntotal",datavar.itemcounter);
                    $row.data("quantity",inputy);

                  total += Number(datavar.itemprice );
                  $('#finaltotal').val(total);

                  $table.append($row);

                }

`function addbill(itemprice,itemid,inputvalue){

              var t =   document.getElementById(inputvalue).value; // gives undefined in console.log

             //  var t  = $('#' + inputvalue).val();  // same issue as above

             //  var t  =  $('#product_list tbody').find('input').val(); // gets first row input value
}

`

upon checking directly as console.log(inputvalue) it gives dynamic id such as inputvalue1 ,inputvalue2, as their respective loop value but I am not able to get the value of input field upon using val() or value


问:
ASP.NET Identity - Can't add users to roles (RoleId may be null)
I am following kudvenkat tutorial on YouTube to do a project he's using MVC but I am using Razor Pages. I have created a Role and I have also created Users. These are stored in the Identity tables AspNetRoles and AspNetUsers respectively. However, I want to add Users to the Role(s), but when I try to do this I run into an error that hints that I am trying to add to a role that does not exist.

Meaning that my roleId in the OnPostAsync method in the UserRole.cshtml.cs is returning null.

Here is the Model I used to create a Role: I am able to create Roles CreateRoleViewModel.cs

```<code>using System;
using System.ComponentModel.DataAnnotations;

namespace AdvisementApp.Pages.ViewModels
{
public class CreateRoleViewModel
{
    public string Id { get; set; }
    [Required]
    public string RoleName { get; set; }
}
}
</code>```

Model for the Users: UserRole.cs

```<code>using System;
namespace AdvisementApp.Pages.ViewModels
{
public class UserRole
{
    public string UserId { get; set; }
    //public string RoleId { get; set; }
    public string UserName { get; set; }
    public bool isSelected { get; set; }
}
}
</code>```

Page Model that is created to Edit the roles: EditRole.cshtml.cs

```<code>namespace AdvisementApp.Pages.Account
{
public class EditRoleModel : PageModel
{
    private readonly RoleManager<IdentityRole> roleManager;
    private readonly UserManager<ApplicationUser> userManager;
    private readonly SchoolContext _context;

    public EditRoleModel(RoleManager<IdentityRole> roleManager,
        UserManager<ApplicationUser> userManager,
        SchoolContext context)
    {
        this.roleManager = roleManager;
        this.userManager = userManager;
        this._context = context;
    }

    public EditRole EditRole { get; set; }

    public async Task<IActionResult> OnGetAsync(string id)
    {
        EditRole = new EditRole();
        var role = await roleManager.FindByIdAsync(id);
        if(role == null)
        {
            return Redirect("/PageNotFound/NotFound");
        }

        EditRole = new EditRole
        {
            Id = role.Id,
            RoleName = role.Name
        };

        foreach (var user in _context.Users)
        {
            if (await userManager.IsInRoleAsync(user, role.Name))
            {
                //model.Users.Add(user.UserName);
                EditRole.Users.Add(user.UserName);
            }
        }

        return Page();
    }

    public async Task<IActionResult> OnPostAsync(EditRole model)
    {
        EditRole = new EditRole();
        var role = await roleManager.FindByIdAsync(model.Id);
        if (role == null)
        {
            return Redirect("/PageNotFound/NotFound");
        }
        else
        {
            role.Name = model.RoleName;
            var result = await roleManager.UpdateAsync(role);
            if (result.Succeeded)
            {
                return Redirect("ListRoles");
            }
            foreach(var error in result.Errors)
            {
                ModelState.AddModelError("", error.Description);
            }
            return Page();
        }

    }
}
}
</code>```

EditRole.cshtml

```<code>@page
@model AdvisementApp.Pages.Account.EditRoleModel
@{
 }

<h1>Edit Role</h1>
<form method="post" class="mt-3">
<div class="form-group row">
    <label asp-for="EditRole.Id" class="col-sm-2 col-form-label"></label>
    <div class="col-sm-10">
        <input asp-for="EditRole.Id" disabled class="form-control" />
    </div>
</div>
<div class="form-group row">
    <label asp-for="EditRole.RoleName" class="col-sm-2 col-form-label"></label>
    <div class="col-sm-10">
        <input asp-for="EditRole.RoleName" class="form-control" />
        <span asp-validation-for="EditRole.RoleName" class="text-danger"></span>
    </div>
</div>
<div asp-validation-summary="All" class="text-danger"></div>

<div class="form-group row">
    <div class="col-sm-10">
        <button type="submit" class="btn btn-primary">Update</button>
        <a asp-page="ListRole" class="btn btn-primary">Cancel</a>
    </div>
</div>

<div class="card">
    <div class="card-header">
        <h3>Users in this role</h3>
    </div>
    <div class="card-body">
        @if (Model.EditRole.Users.Any())
        {
            foreach (var user in Model.EditRole.Users)
            {
                <h5 class="card-title">@user</h5>
            }
        }
        else
        {
                <h5 class="card-title">None at the moment</h5>

        }
    </div>
    <div class="card-footer">
        <a asp-page="UserRole" class="btn btn-primary" asp-route-RoleId="@Model.EditRole.Id"
           style="width:auto">Add or Remove Users</a>
    </div>
</div>
</code>```

This is the Page Model that I am using to add the Users to the Roles: UserRole.cshtml.cs

```<code>namespace AdvisementApp.Pages.Account
{
public class UserRoleModel : PageModel
{
    private readonly RoleManager<IdentityRole> roleManager;
    private readonly UserManager<ApplicationUser> userManager;
    private readonly SchoolContext _context;

    public UserRoleModel(RoleManager<IdentityRole> roleManager,
        UserManager<ApplicationUser> userManager,
        SchoolContext context)
    {
        this.roleManager = roleManager;
        this.userManager = userManager;
        this._context = context;
    }

    public UserRole UserRole { get; set; }
    public EditRole EditRole { get; set; }
    //public List<UserRole> UserRoles { get; set; }
    public List<UserRole> UserRoles { get; set; } = new List<UserRole>();
    public async Task<IActionResult> OnGetAsync(string roleId)//This method is created to find all the created users (from the AspNetUser table created by adding the Identity framework) to a list.
    {
        var role = await roleManager.FindByIdAsync(roleId);
        if(role == null)
        {
            ViewData["ErrorMessage"] = $"Role with Id = {roleId} cannot be found";
            return Redirect("/PageNotFound/NotFound");
        }

        //var model = new List<UserRole>();

        foreach(var user in userManager.Users)
        {
            var userRole = new UserRole
            {
                UserId = user.Id,
                UserName = user.UserName
            };

            if (await userManager.IsInRoleAsync(user, role.Name))
            {
                userRole.isSelected = true;
            }
            else
            {
                userRole.isSelected = false;
            }

            UserRoles.Add(userRole);
        }
        return Page();
    }

    public async Task<IActionResult> OnPostAsync(List<UserRole>model, string roleId)
    {
        //UserRole = new UserRole();
        //UserRole.UserId = roleId;
        EditRole = new EditRole();
        EditRole.Id = roleId;
        var role = await roleManager.FindByIdAsync(roleId);
        if (role == null)//I believe that this is where I am getting the error - roleId is null and I get redirected to my NotFound page.
        {
            ViewData["Message"] = "No roles or users found";
            return Redirect("/PageNotFound/NotFound");
        }

        for(int i = 0; i < model.Count; i++)
        {
            var user = await userManager.FindByIdAsync(model[i].UserId);

            IdentityResult result = null;

            if (model[i].isSelected && !(await userManager.IsInRoleAsync(user, role.Name)))
            {
                 result = await userManager.AddToRoleAsync(user, role.Name);
            }
            else if (!model[i].isSelected && await userManager.IsInRoleAsync(user, role.Name))
            {
                result = await userManager.RemoveFromRoleAsync(user, role.Name);
            }
            else
            {
                continue;
            }

            if (result.Succeeded)
            {
                if (i < (model.Count - 1))
                    continue;
                else
                    return Redirect("EditRole");
            }
        }

        return Redirect("EditRole");
    }
}
}
</code>```

UserRole.cshtml

```<code>@page
@model AdvisementApp.Pages.Account.UserRoleModel
@{}

<h1>Users in Role</h1>

<form method="post">
<div class="card">
    <div class="card-header">
        <h2>Add or remove users from role</h2>
    </div>
    <div class="card-body">
        @if (Model.UserRoles != null)
        {
            for (int i = 0; i < Model.UserRoles.Count(); i++)
            {
                <div class="form-check m-1">
                    <input asp-for="@Model.UserRoles[i].isSelected" class="form-check-input" />
                    <label class="form-check-label" asp-for="@Model.UserRoles[i].isSelected">
                        @Model.UserRoles[i].UserName
                    </label>
                </div>
            }
        }
    </div>
    <div class="card-footer">
</code>```

//The input below is supposed to add users to the role using the OnPostAsync method in the UserRole.cshtml.cs

@@

I know it is a lot of code but I stuck and need expert eyes. I more context is needed please let me know.

Body:
I am following kudvenkat tutorial on YouTube to do a project he's using MVC but I am using Razor Pages. I have created a Role and I have also created Users. These are stored in the Identity tables AspNetRoles and AspNetUsers respectively. However, I want to add Users to the Role(s), but when I try to do this I run into an error that hints that I am trying to add to a role that does not exist.

Meaning that my roleId in the OnPostAsync method in the UserRole.cshtml.cs is returning null.

Here is the Model I used to create a Role: I am able to create Roles CreateRoleViewModel.cs

using System;
using System.ComponentModel.DataAnnotations;

namespace AdvisementApp.Pages.ViewModels
{
public class CreateRoleViewModel
{
    public string Id { get; set; }
    [Required]
    public string RoleName { get; set; }
}
}

Model for the Users: UserRole.cs

using System;
namespace AdvisementApp.Pages.ViewModels
{
public class UserRole
{
    public string UserId { get; set; }
    //public string RoleId { get; set; }
    public string UserName { get; set; }
    public bool isSelected { get; set; }
}
}

Page Model that is created to Edit the roles: EditRole.cshtml.cs

namespace AdvisementApp.Pages.Account
{
public class EditRoleModel : PageModel
{
    private readonly RoleManager<IdentityRole> roleManager;
    private readonly UserManager<ApplicationUser> userManager;
    private readonly SchoolContext _context;

    public EditRoleModel(RoleManager<IdentityRole> roleManager,
        UserManager<ApplicationUser> userManager,
        SchoolContext context)
    {
        this.roleManager = roleManager;
        this.userManager = userManager;
        this._context = context;
    }

    public EditRole EditRole { get; set; }

    public async Task<IActionResult> OnGetAsync(string id)
    {
        EditRole = new EditRole();
        var role = await roleManager.FindByIdAsync(id);
        if(role == null)
        {
            return Redirect("/PageNotFound/NotFound");
        }

        EditRole = new EditRole
        {
            Id = role.Id,
            RoleName = role.Name
        };

        foreach (var user in _context.Users)
        {
            if (await userManager.IsInRoleAsync(user, role.Name))
            {
                //model.Users.Add(user.UserName);
                EditRole.Users.Add(user.UserName);
            }
        }

        return Page();
    }

    public async Task<IActionResult> OnPostAsync(EditRole model)
    {
        EditRole = new EditRole();
        var role = await roleManager.FindByIdAsync(model.Id);
        if (role == null)
        {
            return Redirect("/PageNotFound/NotFound");
        }
        else
        {
            role.Name = model.RoleName;
            var result = await roleManager.UpdateAsync(role);
            if (result.Succeeded)
            {
                return Redirect("ListRoles");
            }
            foreach(var error in result.Errors)
            {
                ModelState.AddModelError("", error.Description);
            }
            return Page();
        }

    }
}
}

EditRole.cshtml

@page
@model AdvisementApp.Pages.Account.EditRoleModel
@{
 }

Edit Role

<form method="post" class="mt-3">

        <input asp-for="EditRole.Id" disabled class="form-control" />

        <input asp-for="EditRole.RoleName" class="form-control" />

        <button type="submit" class="btn btn-primary">Update</button>
        Cancel

Users in this role

        @if (Model.EditRole.Users.Any())
        {
            foreach (var user in Model.EditRole.Users)
            {

@user

            }
        }
        else
        {

None at the moment

        }

        Add or Remove Users

This is the Page Model that I am using to add the Users to the Roles: UserRole.cshtml.cs

namespace AdvisementApp.Pages.Account
{
public class UserRoleModel : PageModel
{
    private readonly RoleManager<IdentityRole> roleManager;
    private readonly UserManager<ApplicationUser> userManager;
    private readonly SchoolContext _context;

    public UserRoleModel(RoleManager<IdentityRole> roleManager,
        UserManager<ApplicationUser> userManager,
        SchoolContext context)
    {
        this.roleManager = roleManager;
        this.userManager = userManager;
        this._context = context;
    }

    public UserRole UserRole { get; set; }
    public EditRole EditRole { get; set; }
    //public List<UserRole> UserRoles { get; set; }
    public List<UserRole> UserRoles { get; set; } = new List<UserRole>();
    public async Task<IActionResult> OnGetAsync(string roleId)//This method is created to find all the created users (from the AspNetUser table created by adding the Identity framework) to a list.
    {
        var role = await roleManager.FindByIdAsync(roleId);
        if(role == null)
        {
            ViewData["ErrorMessage"] = $"Role with Id = {roleId} cannot be found";
            return Redirect("/PageNotFound/NotFound");
        }

        //var model = new List<UserRole>();

        foreach(var user in userManager.Users)
        {
            var userRole = new UserRole
            {
                UserId = user.Id,
                UserName = user.UserName
            };

            if (await userManager.IsInRoleAsync(user, role.Name))
            {
                userRole.isSelected = true;
            }
            else
            {
                userRole.isSelected = false;
            }

            UserRoles.Add(userRole);
        }
        return Page();
    }

    public async Task<IActionResult> OnPostAsync(List<UserRole>model, string roleId)
    {
        //UserRole = new UserRole();
        //UserRole.UserId = roleId;
        EditRole = new EditRole();
        EditRole.Id = roleId;
        var role = await roleManager.FindByIdAsync(roleId);
        if (role == null)//I believe that this is where I am getting the error - roleId is null and I get redirected to my NotFound page.
        {
            ViewData["Message"] = "No roles or users found";
            return Redirect("/PageNotFound/NotFound");
        }

        for(int i = 0; i < model.Count; i++)
        {
            var user = await userManager.FindByIdAsync(model[i].UserId);

            IdentityResult result = null;

            if (model[i].isSelected && !(await userManager.IsInRoleAsync(user, role.Name)))
            {
                 result = await userManager.AddToRoleAsync(user, role.Name);
            }
            else if (!model[i].isSelected && await userManager.IsInRoleAsync(user, role.Name))
            {
                result = await userManager.RemoveFromRoleAsync(user, role.Name);
            }
            else
            {
                continue;
            }

            if (result.Succeeded)
            {
                if (i < (model.Count - 1))
                    continue;
                else
                    return Redirect("EditRole");
            }
        }

        return Redirect("EditRole");
    }
}
}

UserRole.cshtml

@page
@model AdvisementApp.Pages.Account.UserRoleModel
@{}

Users in Role

<form method="post">

Add or remove users from role

        @if (Model.UserRoles != null)
        {
            for (int i = 0; i < Model.UserRoles.Count(); i++)
            {

                    <input asp-for="@Model.UserRoles[i].isSelected" class="form-check-input" />

                        @Model.UserRoles[i].UserName

            }
        }

//The input below is supposed to add users to the role using the OnPostAsync method in the UserRole.cshtml.cs

@@

I know it is a lot of code but I stuck and need expert eyes. I more context is needed please let me know.


问:
Require wp-load.php breaks website - possible Multisite issue
I'm trying to write some code to access the WordPress database.
Everything tells me to load wp-load.php to do this.
However I just get critical errors when I do.
This used to work a couple of months back, not sure when it stopped working, so might be a recent WordPress update that has stopped this working. Currently on WordPress 6.1.1

```<code><?php

ini_set( 'display_errors', '1' );
ini_set( 'display_startup_errors', '1' );
error_reporting( E_ALL );

global $_SERVER;
$_SERVER['HTTP_HOST']   = 'www.mydomain.com';
$_SERVER['REQUEST_URI'] = '/';

$file_require = $_SERVER["DOCUMENT_ROOT"] . '/wp-load.php';
include $file_require;

if (file_exists( $file_require )) {
    echo 'FILE EXISTS: file_require: ' . $file_require . '<br>';
} else {
    echo 'FILE NOT FOUND: file_require: ' . $file_require . '<br>';
}

echo 'Successfully Loaded wp-load.php<br>';
</code>```

The code after the include nevers gets executed.
Just get a "There has been a critical error on this website."

The site is a MULTISITE and some articles and similar questions do suggest that this may be teh cuase. But this used to work just fine and this has always been a multisite. As I say, this has stopped working during the last few weeks.

Any help would be gratefully received.

Body:
I'm trying to write some code to access the WordPress database.
Everything tells me to load wp-load.php to do this.
However I just get critical errors when I do.
This used to work a couple of months back, not sure when it stopped working, so might be a recent WordPress update that has stopped this working. Currently on WordPress 6.1.1

<?php

ini_set( 'display_errors', '1' );
ini_set( 'display_startup_errors', '1' );
error_reporting( E_ALL );

global $_SERVER;
$_SERVER['HTTP_HOST']   = 'www.mydomain.com';
$_SERVER['REQUEST_URI'] = '/';

$file_require = $_SERVER["DOCUMENT_ROOT"] . '/wp-load.php';
include $file_require;

if (file_exists( $file_require )) {
    echo 'FILE EXISTS: file_require: ' . $file_require . '
';
} else {
    echo 'FILE NOT FOUND: file_require: ' . $file_require . '
';
}

echo 'Successfully Loaded wp-load.php
';

The code after the include nevers gets executed.
Just get a "There has been a critical error on this website."

The site is a MULTISITE and some articles and similar questions do suggest that this may be teh cuase. But this used to work just fine and this has always been a multisite. As I say, this has stopped working during the last few weeks.

Any help would be gratefully received.


问:
How to filter nested list of list of objects with JSON field in django
I have a Model named Ad and it has a JSONfield named location_details.

while fetching the list of objects from Ad Model, I am applying filter for the location_details field

http://127.0.0.1:8000/ad-list/?limit=10&offset=0&ordering=-start_date&location_category=bus_station%2Chospital

While creating an ad, I compute the nearby places and store it as a JSON field as shown below

```<code>[ { name: "transit", label: "Transit", sub_categories: [ { name: "bus_station", label: "Bus Stop", values: [{name: 'A'}, {name: 'B'}], }, { name: "airport", label: "Airport", values: [], }, { name: "train_station", label: "Train Station", values: [], }, ], }, { name: "essentials", label: "Essentials", sub_categories: [ { name: "hospital", label: "Hospital", values: [{name: 'te'}], }, { name: "school", label: "Schools", values: [{name: 'B'}], }, { name: "atm", label: "ATMs", values: [], }, { name: "gas_station", label: "Gas Stations", values: [{name: 'C'}], }, { name: "university", label: "Universities", values: [], }, ], }, { name: "utility", label: "Utility", sub_categories: [ { name: "movie_theater", label: "Movie Theater", values: [], }, { name: "shopping_mall", label: "Shopping Mall", values: [], }, ], }, ];
</code>```

I want to filter the ad list with multiple location_categories with the above JSON object, only if the location category has some data in it.

I don't know how to start with it, this is how my code looks like now

```<code>location_category = django_filters.CharFilter(method="filter_location_category")

def filter_location_category(self, queryset, name, value):
    return queryset.filter(location_details__sub_categories__name__in=value.split(","))
</code>```

For example, with the below request

http://127.0.0.1:8000/ad-list/?limit=10&offset=0&ordering=-start_date&location_category=bus_station%2Chospital

I want to get all the ads where bus_station and hospital have some data in it (inside the values key) and want to ignore it if the values list is empty in the JSON.

Any help would be highly appreciated. Thank you so much for your attention and participation.

Body:
I have a Model named Ad and it has a JSONfield named location_details.

while fetching the list of objects from Ad Model, I am applying filter for the location_details field

http://127.0.0.1:8000/ad-list/?limit=10&offset=0&ordering=-start_date&location_category=bus_station%2Chospital

While creating an ad, I compute the nearby places and store it as a JSON field as shown below

[ { name: "transit", label: "Transit", sub_categories: [ { name: "bus_station", label: "Bus Stop", values: [{name: 'A'}, {name: 'B'}], }, { name: "airport", label: "Airport", values: [], }, { name: "train_station", label: "Train Station", values: [], }, ], }, { name: "essentials", label: "Essentials", sub_categories: [ { name: "hospital", label: "Hospital", values: [{name: 'te'}], }, { name: "school", label: "Schools", values: [{name: 'B'}], }, { name: "atm", label: "ATMs", values: [], }, { name: "gas_station", label: "Gas Stations", values: [{name: 'C'}], }, { name: "university", label: "Universities", values: [], }, ], }, { name: "utility", label: "Utility", sub_categories: [ { name: "movie_theater", label: "Movie Theater", values: [], }, { name: "shopping_mall", label: "Shopping Mall", values: [], }, ], }, ];

I want to filter the ad list with multiple location_categories with the above JSON object, only if the location category has some data in it.

I don't know how to start with it, this is how my code looks like now

location_category = django_filters.CharFilter(method="filter_location_category")

def filter_location_category(self, queryset, name, value):
    return queryset.filter(location_details__sub_categories__name__in=value.split(","))

For example, with the below request

http://127.0.0.1:8000/ad-list/?limit=10&offset=0&ordering=-start_date&location_category=bus_station%2Chospital

I want to get all the ads where bus_station and hospital have some data in it (inside the values key) and want to ignore it if the values list is empty in the JSON.

Any help would be highly appreciated. Thank you so much for your attention and participation.


问:
Screen freezes and does not recover when starting video recording with cameraX
I want to make a button that records video as long as it is pressed, but when starting video recording with cameraX, the screen freezes and does not recover. What do you think could be the reason?

I followed the official pages and followed the process below from many different sources.

```<code>binding.takeVideo.setOnTouchListener { _, event ->

            provider.unbindAll()

            val preview = Preview.Builder().build().apply {
                setSurfaceProvider(binding.preview.surfaceProvider)
            }

            val quality = QualitySelector.fromOrderedList(
                listOf(
                    Quality.UHD,
                    Quality.FHD,
                    Quality.HD,
                    Quality.SD
                ),
                FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
            )

            val recorder = Recorder.Builder().apply {
                setExecutor(ContextCompat.getMainExecutor(this@CameraFragment.requireContext()))
                setQualitySelector(quality)
            }

            val file = File(requireContext().getExternalFilesDir(Environment.DIRECTORY_MOVIES)
                .toString() + File.separator + System.currentTimeMillis().toString())
            if (!file.exists()) {
                file.mkdir()
            }

            val outputFile = File.createTempFile("SOME_NAME", ".mp4", file)
            val output = FileOutputOptions.Builder(outputFile).build()

            val video = VideoCapture.withOutput(recorder.build())
            var record: Recording? = null

            when (event.action) {

                MotionEvent.ACTION_DOWN -> {

                    if (turn) {

                        val selector = CameraSelector.Builder()
                            .requireLensFacing(CameraSelector.LENS_FACING_BACK).build()

                        if (flash) {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(true)
                        } else {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(false)
                        }

                        record = video.output.prepareRecording(this@CameraFragment.requireContext(),
                            output).apply {

                            if (checkSelfPermission(this@CameraFragment.requireContext(),
                                    Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
                            ) {

                                withAudioEnabled()
                            }

                        }
                            .start(ContextCompat.getMainExecutor(this@CameraFragment.requireContext())) { event ->

                                when (event) {

                                    is VideoRecordEvent.Start -> toast("Video Başladı")

                                    is VideoRecordEvent.Finalize -> {
                                        if (event.hasError()) {
                                            record?.close()
                                            record = null
                                        } else {
                                            toast("Video Bitti")
                                            binding.lastPicture.setPicture(event.outputResults.outputUri.path.toString())
                                        }
                                    }
                                }
                            }

                    } else {

                        val selector = CameraSelector.Builder()
                            .requireLensFacing(CameraSelector.LENS_FACING_FRONT).build()

                        if (flash) {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(true)
                        } else {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(false)
                        }

                        record = video.output.prepareRecording(this@CameraFragment.requireContext(),
                            output).apply {

                            if (checkSelfPermission(this@CameraFragment.requireContext(),
                                    Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
                            ) {

                                withAudioEnabled()
                            }

                        }
                            .start(ContextCompat.getMainExecutor(this@CameraFragment.requireContext())) { event ->

                                when (event) {
                                    is VideoRecordEvent.Start -> {
                                        toast("Video Başladı")
                                    }
                                    is VideoRecordEvent.Finalize -> {
                                        if (event.hasError()) {
                                            record?.close()
                                            record = null
                                        } else {
                                            toast("Video Bitti")
                                            binding.lastPicture.setPicture(event.outputResults.outputUri)
                                        }
                                    }
                                }
                            }

                    }
                }

                MotionEvent.ACTION_UP -> record?.stop()
            }

            true
        }
</code>```

I couldn't find the solution even though I checked many times.

Body:
I want to make a button that records video as long as it is pressed, but when starting video recording with cameraX, the screen freezes and does not recover. What do you think could be the reason?

I followed the official pages and followed the process below from many different sources.

binding.takeVideo.setOnTouchListener { _, event ->

            provider.unbindAll()

            val preview = Preview.Builder().build().apply {
                setSurfaceProvider(binding.preview.surfaceProvider)
            }

            val quality = QualitySelector.fromOrderedList(
                listOf(
                    Quality.UHD,
                    Quality.FHD,
                    Quality.HD,
                    Quality.SD
                ),
                FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
            )

            val recorder = Recorder.Builder().apply {
                setExecutor(ContextCompat.getMainExecutor(this@CameraFragment.requireContext()))
                setQualitySelector(quality)
            }

            val file = File(requireContext().getExternalFilesDir(Environment.DIRECTORY_MOVIES)
                .toString() + File.separator + System.currentTimeMillis().toString())
            if (!file.exists()) {
                file.mkdir()
            }

            val outputFile = File.createTempFile("SOME_NAME", ".mp4", file)
            val output = FileOutputOptions.Builder(outputFile).build()

            val video = VideoCapture.withOutput(recorder.build())
            var record: Recording? = null

            when (event.action) {

                MotionEvent.ACTION_DOWN -> {

                    if (turn) {

                        val selector = CameraSelector.Builder()
                            .requireLensFacing(CameraSelector.LENS_FACING_BACK).build()

                        if (flash) {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(true)
                        } else {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(false)
                        }

                        record = video.output.prepareRecording(this@CameraFragment.requireContext(),
                            output).apply {

                            if (checkSelfPermission(this@CameraFragment.requireContext(),
                                    Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
                            ) {

                                withAudioEnabled()
                            }

                        }
                            .start(ContextCompat.getMainExecutor(this@CameraFragment.requireContext())) { event ->

                                when (event) {

                                    is VideoRecordEvent.Start -> toast("Video Başladı")

                                    is VideoRecordEvent.Finalize -> {
                                        if (event.hasError()) {
                                            record?.close()
                                            record = null
                                        } else {
                                            toast("Video Bitti")
                                            binding.lastPicture.setPicture(event.outputResults.outputUri.path.toString())
                                        }
                                    }
                                }
                            }

                    } else {

                        val selector = CameraSelector.Builder()
                            .requireLensFacing(CameraSelector.LENS_FACING_FRONT).build()

                        if (flash) {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(true)
                        } else {
                            provider.bindToLifecycle(viewLifecycleOwner,
                                selector,
                                preview,
                                video).cameraControl.enableTorch(false)
                        }

                        record = video.output.prepareRecording(this@CameraFragment.requireContext(),
                            output).apply {

                            if (checkSelfPermission(this@CameraFragment.requireContext(),
                                    Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
                            ) {

                                withAudioEnabled()
                            }

                        }
                            .start(ContextCompat.getMainExecutor(this@CameraFragment.requireContext())) { event ->

                                when (event) {
                                    is VideoRecordEvent.Start -> {
                                        toast("Video Başladı")
                                    }
                                    is VideoRecordEvent.Finalize -> {
                                        if (event.hasError()) {
                                            record?.close()
                                            record = null
                                        } else {
                                            toast("Video Bitti")
                                            binding.lastPicture.setPicture(event.outputResults.outputUri)
                                        }
                                    }
                                }
                            }

                    }
                }

                MotionEvent.ACTION_UP -> record?.stop()
            }

            true
        }

I couldn't find the solution even though I checked many times.


问:
Deploying React App to GitHub Pages only showing README.md file
I've been trying to deploy a React App to Github Pages, and have followed a few tutorials, however I can't seem to find the gh-pages branch that the site gets built from, only the master branch shows up.

When I deploy the app, only the README.md file shows up, or I get a 404 error. My package.json looks like this:

```<code>{
  "name": "portfolio",
  "homepage": "https://samarqureshii.github.io/",
  "version": "2.0.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.6.2",
    "@mui/material": "^5.6.3",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^13.1.9",
    "ajv": "^8.11.0",
    "classnames": "^2.2.6",
    "moment": "^2.29.4",
    "node-forge": ">=1.3.0",
    "object-path": "^0.11.8",
    "postcss": "^8.4.14",
    "postcss-normalize": "^10.0.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.1",
    "sass": "^1.54.5",
    "typescript": "^4.7.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "gh-pages": "^4.0.0"
  }
}

</code>```

Body:
I've been trying to deploy a React App to Github Pages, and have followed a few tutorials, however I can't seem to find the gh-pages branch that the site gets built from, only the master branch shows up.

When I deploy the app, only the README.md file shows up, or I get a 404 error. My package.json looks like this:

{
  "name": "portfolio",
  "homepage": "https://samarqureshii.github.io/",
  "version": "2.0.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.6.2",
    "@mui/material": "^5.6.3",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^13.1.9",
    "ajv": "^8.11.0",
    "classnames": "^2.2.6",
    "moment": "^2.29.4",
    "node-forge": ">=1.3.0",
    "object-path": "^0.11.8",
    "postcss": "^8.4.14",
    "postcss-normalize": "^10.0.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^6.3.0",
    "react-scripts": "^5.0.1",
    "sass": "^1.54.5",
    "typescript": "^4.7.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "gh-pages": "^4.0.0"
  }
}


问:
How to add reference to external file for environment variables in serverless.template file
This is how we reference external file using ${file(filename.extension): variable} in serverless.yaml

```<code>environment:
    RUNTIME: lambda
    ENVIRONMENT: ${opt:stage, self:provider.stage, 'unknown'}
    REGION_NAME: ${self:provider.region}
    ACCESS_KEY_ID: ${file(config.yaml):aws.accessKeyId}
    SECRET_ACCESS_KEY: ${file(config.yaml):aws.secretAccessKey}
    RESOURCE_NAME: ${self:custom.resourceName}
</code>```

I want to do similar in serverless.template which is used to deploy .Net Core 6 serverless application from the Visual Studio.

I tried doing it the following way

```<code> "Environment": {
        "Variables": {
            "ACCESS_KEY_ID":  ${file(config.yaml):aws.accessKeyId},
        }
    },
</code>```

But I am getting parse error. How can I use the file variable references?

Body:
This is how we reference external file using ${file(filename.extension): variable} in serverless.yaml

environment:
    RUNTIME: lambda
    ENVIRONMENT: ${opt:stage, self:provider.stage, 'unknown'}
    REGION_NAME: ${self:provider.region}
    ACCESS_KEY_ID: ${file(config.yaml):aws.accessKeyId}
    SECRET_ACCESS_KEY: ${file(config.yaml):aws.secretAccessKey}
    RESOURCE_NAME: ${self:custom.resourceName}

I want to do similar in serverless.template which is used to deploy .Net Core 6 serverless application from the Visual Studio.

I tried doing it the following way

 "Environment": {
        "Variables": {
            "ACCESS_KEY_ID":  ${file(config.yaml):aws.accessKeyId},
        }
    },

But I am getting parse error. How can I use the file variable references?


问:
Getting Null exception , base controller throwing null exception when executing test cases Put_IsUnlockUser_ReturnsTrue
```<code>public class AccountController : BaseController
{
    public ResponseTransferObject Put(AccountPutRequest request)
    {
        if (!string.IsNullOrEmpty(request.UnlockUser))
        {
            if (!Session.RoleName.Equals("Administrator", StringComparison.InvariantCultureIgnoreCase))
            {
                return object
            }
}

public void Put_IsUnlockUser_ReturnsTrue()
{
    AccountController accountController = new AccountController();
    ResponseTransferObject responseTransferObject = new ResponseTransferObject();
    //AccountPutRequest ar = new AccountPutRequest();
    try
    {
        responseTransferObject = accountController.Put(new AccountPutRequest { UnlockUser = "Wind" });
        Assert.IsNotEmpty(responseTransferObject.ToString());
    }
    catch
    {
        Assert.IsTrue(false);
    }
}

public class BaseController : ApiController
{
    public SessionUser Session { get; set; }

    public BaseController()
    {
        Session = HttpContext.Current.Session["MyUser"] as SessionUser;
    }
}
</code>```


问:
Unexpected segmentation fault while using double pointers in C
I'm learning C. I'm messing around with pointers to understand how they work, but I can't really understand why I'm getting the errors that I explain ahead.

The code is:

```<code>#include <stdio.h>

#define MAT_COLS 13
#define MAT_ROWS 12

void test(char **, size_t, size_t);

int main(void)
{
    char *matrix[MAT_ROWS] = {"############", "############", "############", "############", "############", "############", "############", "############", "############", "############", "############", "############"};
    test(matrix, MAT_ROWS, MAT_COLS);
}

void test(char **Mat, size_t mat_rows, size_t mat_cols)
{
    printf("\n%s", Mat[3]);
    printf("\n%c", Mat[3][5]);
    printf("\n%s", (Mat + 3)); //strange output
    printf("\n%c", *(*(Mat + 3) + 5));
    fflush(stdout);
    Mat[3][5] = 46; //seg. fault
}
</code>```

The output is:

```<code>############
#
`UUUU
#
</code>```

I got two unexpected behavior:

The strange output of the line printf("\n%s", (Mat + 3));: `UUUU

The last line of the function test Mat[3][5] = 46; give me segmentation fault.

I used the debugger and Mat+3 is the address of a string of matrix, but it outputs that strange string.

What is the problem?

Body:
I'm learning C. I'm messing around with pointers to understand how they work, but I can't really understand why I'm getting the errors that I explain ahead.

The code is:

#include <stdio.h>

#define MAT_COLS 13
#define MAT_ROWS 12

void test(char **, size_t, size_t);

int main(void)
{
    char *matrix[MAT_ROWS] = {"############", "############", "############", "############", "############", "############", "############", "############", "############", "############", "############", "############"};
    test(matrix, MAT_ROWS, MAT_COLS);
}

void test(char **Mat, size_t mat_rows, size_t mat_cols)
{
    printf("\n%s", Mat[3]);
    printf("\n%c", Mat[3][5]);
    printf("\n%s", (Mat + 3)); //strange output
    printf("\n%c", *(*(Mat + 3) + 5));
    fflush(stdout);
    Mat[3][5] = 46; //seg. fault
}

The output is:

############
#
`UUUU
#

I got two unexpected behavior:

The strange output of the line printf("\n%s", (Mat + 3));: `UUUU

The last line of the function test Mat[3][5] = 46; give me segmentation fault.

I used the debugger and Mat+3 is the address of a string of matrix, but it outputs that strange string.

What is the problem?


问:
Flet loading icon not showing if port is specified
Follow-up question to: How to change the default loading icon in a Python flet app?

Using the example app from the repo: https://github.com/flet-dev/examples/tree/main/python/apps/custom-loading-image

For some reason it does not work when I add port to my flet.app arguments. Any solutions?

```<code>flet.app(port=8080, target=main, assets_dir="assets", view=flet.WEB_BROWSER)
</code>```

Body:
Follow-up question to: How to change the default loading icon in a Python flet app?

Using the example app from the repo: https://github.com/flet-dev/examples/tree/main/python/apps/custom-loading-image

For some reason it does not work when I add port to my flet.app arguments. Any solutions?

flet.app(port=8080, target=main, assets_dir="assets", view=flet.WEB_BROWSER)


问:
Angular Whild ssr build - window is not defined
Am getting this error while run ng run {pname}:prerender
× Prerendering routes to \mfssr\dist\starmf\browser failed.
window is not defined</p>


问:
Import "pybit" could not be resolved
When I run pip3 install pybit in the terminal I get:

```<code>Requirement already satisfied: pybit in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2.4.1)
</code>```

But in my project:

```<code>#API imports
from pybit import HTTP
</code>```

I get Import "pybit" could not be resolved.

How do I fix my environment?

Title: Import "pybit" could not be resolved

Body:
When I run pip3 install pybit in the terminal I get:

Requirement already satisfied: pybit in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2.4.1)

But in my project:

#API imports
from pybit import HTTP

I get Import "pybit" could not be resolved.

How do I fix my environment?


问:
How to select a certain number of random values with odi 12 c?
How can I make the following query work in odi 12c?

I need your support on which components I need to use and how.

```<code>SELECT *
FROM (
    SELECT *
    FROM table name
    ORDER BY DBMS_RANDOM.RANDOM)
WHERE  rownum <= n;
</code>```

I used sort component but it gives me the warning in this image.

Body:
How can I make the following query work in odi 12c?

I need your support on which components I need to use and how.

SELECT *
FROM (
    SELECT *
    FROM table name
    ORDER BY DBMS_RANDOM.RANDOM)
WHERE  rownum <= n;

I used sort component but it gives me the warning in this image.


问:
Upload r project to kaggle
I am working on my first R project, and I want to upload it to Kaggle but couldn't do it. This is my third day trying. I created a new notebook from a Kaggle page where the original data set exists called Bellabet. Apparently, I successfully downloaded the dataset. But when I use the command read.csv I get an error

"No such file or directory” Error in file(file, "rt"): cannot open the connection"

When I run the code to download the data, it runs without errors but I can't see the data even when I write view(). When I use read.csv I get an error.  I am attaching two screenshots below. What could be the problem?

I tried to change the directory. I tried to upload the project using Rmarkdown after watching and reading many sources and followed the steps very carefully but also to no success.

Title: Upload r project to kaggle


问:
Testing Servlets with Jmockit
i am new to Servlets and testing. I have to get the Code Coverage up for my University Project but it seems like i cant get an idea of how and where to start. Our Prof. gave us Code we need to Cover with tests,  can anybody give me a hint where to start ?

```<code>public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        String cmd = request.getParameter("cmd");
        System.out.println( cmd + " requested: " + request.getQueryString());
        switch ( cmd ){
            case "config":
                // Overwrite Parkhaus config parameters
                // Max, open_from, open_to, delay, simulation_speed
                out.println( config() );
                break;
            case "sum":
                // ToDo: insert algorithm for calculating sum here
                out.println( "sum = server side calculated sum" );
                break;
            case "avg":
                // ToDo
                break;
            case "min":
                // ToDo: insert algorithm for calculating min here
                out.println( "min = server side calculated min" );
                break;
            case "max":
                // ToDo: insert algorithm for calculating max here
                out.println( "max = server side calculated max" );
                break;
            case "cars":
                // TODO: Send list of cars stored on the server to the client.
                // Cars are separated by comma.
                // Values of a single car are separated by slash.
                // Format: Nr, timer begin, duration, price, Ticket, color, space, client category, vehicle type, license (PKW Kennzeichen)
                // For example:
                // TODO replace by real list of cars
                // out.println("1/1648465400000/_/_/Ticket1/#0d1e0a/2/any/PKW/1,2/1648465499999/_/_/Ticket2/#dd10aa/3/any/PKW/2");
                break;
            case "chart":
                // TODO send chart infos as JSON object to client
                break;
            default:
                System.out.println("Invalid Command: " + request.getQueryString());
        }

</code>```

I tried different things with Jmockit but didn't get really far

Title: Testing Servlets with Jmockit

Body:
i am new to Servlets and testing. I have to get the Code Coverage up for my University Project but it seems like i cant get an idea of how and where to start. Our Prof. gave us Code we need to Cover with tests,  can anybody give me a hint where to start ?

public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        String cmd = request.getParameter("cmd");
        System.out.println( cmd + " requested: " + request.getQueryString());
        switch ( cmd ){
            case "config":
                // Overwrite Parkhaus config parameters
                // Max, open_from, open_to, delay, simulation_speed
                out.println( config() );
                break;
            case "sum":
                // ToDo: insert algorithm for calculating sum here
                out.println( "sum = server side calculated sum" );
                break;
            case "avg":
                // ToDo
                break;
            case "min":
                // ToDo: insert algorithm for calculating min here
                out.println( "min = server side calculated min" );
                break;
            case "max":
                // ToDo: insert algorithm for calculating max here
                out.println( "max = server side calculated max" );
                break;
            case "cars":
                // TODO: Send list of cars stored on the server to the client.
                // Cars are separated by comma.
                // Values of a single car are separated by slash.
                // Format: Nr, timer begin, duration, price, Ticket, color, space, client category, vehicle type, license (PKW Kennzeichen)
                // For example:
                // TODO replace by real list of cars
                // out.println("1/1648465400000/_/_/Ticket1/#0d1e0a/2/any/PKW/1,2/1648465499999/_/_/Ticket2/#dd10aa/3/any/PKW/2");
                break;
            case "chart":
                // TODO send chart infos as JSON object to client
                break;
            default:
                System.out.println("Invalid Command: " + request.getQueryString());
        }

I tried different things with Jmockit but didn't get really far


问:
Why can't I build my app on the build server after adding the "CodeScanner Library" extension?
I am using Netbeans 12 with Maven

Image 1.
a. Create the "Test" application.
b. I clean and build (just to ensure it works - it shows me temporary signature message).
c. I install the extension
d. I solve problems of the project on the common folder.

Image #2.
I clean and build the project.

Image #3
Note that the "BUILD SUCCES" message appears in the console, but the window asking me if I authorize the use of a temporary signature does not appear.

Note: The app runs perfectly in the simulator.