问:
Typeorm SQL one to one relation using same user ID in both tables
I wanted to create one to one relation in typeorm (NestJS). Just like in the picture below.
I wanted then to signup user with email and password and create row in custom_auth and user_profile table.

relations

I cant find solution to create that type of relation. I was only able to create typical relation using foreign key (solution in typeorm docs)

```<code>export class CustomAuth {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ unique: true })
  email: string

  @Column()
  password: string

  @OneToOne(() => UserProfile, (userProfile) => userProfile.customAuth, {
    cascade: true,
  })
  userProfile: UserProfile
}
</code>```
```<code>export class UserProfile {
  @PrimaryGeneratedColumn()
  userId: number

  @Column()
  name: string

  @Column({ nullable: true })
  address: string

  @OneToOne(() => CustomAuth, (customAuth) => customAuth.userProfile, {})
  @JoinColumn()
  customAuth: CustomAuth
}

</code>```

Body:
I wanted to create one to one relation in typeorm (NestJS). Just like in the picture below.
I wanted then to signup user with email and password and create row in custom_auth and user_profile table.

relations

I cant find solution to create that type of relation. I was only able to create typical relation using foreign key (solution in typeorm docs)

export class CustomAuth {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ unique: true })
  email: string

  @Column()
  password: string

  @OneToOne(() => UserProfile, (userProfile) => userProfile.customAuth, {
    cascade: true,
  })
  userProfile: UserProfile
}

export class UserProfile {
  @PrimaryGeneratedColumn()
  userId: number

  @Column()
  name: string

  @Column({ nullable: true })
  address: string

  @OneToOne(() => CustomAuth, (customAuth) => customAuth.userProfile, {})
  @JoinColumn()
  customAuth: CustomAuth
}


来源: stackexchange

问:
Retrieving data from supabase Postgresql in the form using vue 3
I am trying to fetch the stored data from Profiles table in the postgresql database in supabase, however I seem to fail during the process as the form appear to be blank without any data in the form although the getData() method was called onMounted.Any help would be appreciated. Below are the codes i am using to fetch data from supabase:</p>
```<code>       <q-dialog v-model="inception">
      <q-card class="my-profi">
        <q-form>
        <q-card-section>
          <div class="text-h6">Profile</div>
        </q-card-section>

        <q-card-section class="q-pt-none">

          <div v-if="data">
         <q-input :v-model="name"  disable>
          <template v-slot:prepend>
            <q-icon name="person"/>
            {{ data.name }}
          </template>
         </q-input>

         <q-input :v-model="reg"  disable>
          <template v-slot:prepend>
            <q-icon name="laptop"/>
            {{ data.reg }}
          </template>
         </q-input>

         <q-input :v-model="course" disable>
          <template v-slot:prepend>
            <q-icon name="book"/>
            {{ data.course }}
          </template>
         </q-input>

         <q-input :v-model="phone" disable>
          <template v-slot:prepend>
            <q-icon name="call"/>
            {{ data.phone }}
          </template>
         </q-input>
         </div>

        </q-card-section>

        <q-card-actions align="right" class="text-primary">
          <q-btn flat label="Edit Profile" @click="profile = true" />
          <q-btn color="red" flat label="Close" v-close-popup />
        </q-card-actions>
        </q-form>
      </q-card>
    </q-dialog>

      </q-card-section>
    </q-card>

        </q-page>
      </q-page-container>
    </q-layout>
  </div>
</template>

<script>
import {  ref,computed,onMounted,toRefs,defineProps } from 'vue'
import lb from '../assets/download.jpeg'
import bg from '../assets/logo.svg'
import { useRouter } from 'vue-router'
import store from '@/store/index'
import supabase from '@/supabase'

export default {
  setup () {

    const user = computed(()=> store.state.user)
const props = defineProps(['session'])
const {session} = toRefs(props)
     const name = ref('')
    const reg = ref('')
    const phone = ref('')
    const course = ref('')
    const picture = ref('')
     const statusMsg = ref(null)

    const router = useRouter()
    // const route = useRouter()

    // const currentId = route.params.dashId
    onMounted(()=>{
      getData()
    })
   const getData = async() =>{
          try{
            const {user} = session.value
            const{ data, error} = await supabase.from("profiles").select('name','reg','phone','course').eq('id', user.id).single()
            if (error) throw error
            if(data){
              name.value = data.name
              reg.value = data.reg
           phone.value  = data.phone
           course.value = data.course
            }
          }catch(error){
              error.value = error.message
             setTimeout(() => {
              error.value = false
              }, 5000);

          }
        }

 const addTodo= async()=>{
  try{
      const {error}= await supabase.from("Profiles").insert([
      {
      name:name.value,
      reg:reg.value,
      phone:phone.value,
      course:course.value,}
      ])
     if(error) throw error
     statusMsg.value = "Saved successfully"
     name.value = null,
     reg.value =null,
     phone.value= null,
     course.value = null,
     setTimeout(() => {
        statusMsg.value = false
      }, 5000);
 }
   catch (error){
      error.value = `Error ${error.message}`
      setTimeout(() => {
        error.message = false
      }, 5000);
    }
 }

    const handleClick= async()=>{
      await supabase.auth.signOut()
      router.push('/')
    }

    return {
      drawer: ref(false),
      miniState: ref(true),
      bg:bg,
      lb:lb,
      name,
      reg,
      phone,
      course,
      picture,
      inception: ref(false),
      secondDialog: ref(false),
      profile: ref(false),
      handleClick,
      user,
      addTodo,

    }
  }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to fetch the stored data from Profiles table in the postgresql database in supabase, however I seem to fail during the process as the form appear to be blank without any data in the form although the getData() method was called onMounted.Any help would be appreciated. Below are the codes i am using to fetch data from supabase:

       <q-dialog v-model="inception">
      <q-card class="my-profi">
        <q-form>
        <q-card-section>

Profile

        </q-card-section>

        <q-card-section class="q-pt-none">

         <q-input :v-model="name"  disable>
          <template v-slot:prepend>
            <q-icon name="person"/>
            {{ data.name }}
          </template>
         </q-input>

         <q-input :v-model="reg"  disable>
          <template v-slot:prepend>
            <q-icon name="laptop"/>
            {{ data.reg }}
          </template>
         </q-input>

         <q-input :v-model="course" disable>
          <template v-slot:prepend>
            <q-icon name="book"/>
            {{ data.course }}
          </template>
         </q-input>

         <q-input :v-model="phone" disable>
          <template v-slot:prepend>
            <q-icon name="call"/>
            {{ data.phone }}
          </template>
         </q-input>

        </q-card-section>

        <q-card-actions align="right" class="text-primary">
          <q-btn flat label="Edit Profile" @click="profile = true" />
          <q-btn color="red" flat label="Close" v-close-popup />
        </q-card-actions>
        </q-form>
      </q-card>
    </q-dialog>

      </q-card-section>
    </q-card>

        </q-page>
      </q-page-container>
    </q-layout>

</template>


问:
Magento admin sidebar
Does anyone know how to make a sidebar in the backend of Magento?

I'm talking about the navigation at the side as seen when editing a product. Google fails me when searching for "Magento admin sidebar", "Magento admin left navigation", "Magento admin left column", etc...

ContentLicense: CC BY-SA 3.0

Title: Magento admin sidebar


问:
Unnecessary permission is found in app content on play store
I have updated my application and removed below permission from my update bundle but still it is showing on play store console in app content  sensitive permission.

```<code>4 previously declared permissions
android.permission.READ_CALL_LOG
android.permission.SEND_SMS
android.permission.WRITE_CALL_LOG
android.permission.PROCESS_OUTGOING_CALLS
</code>```

Body:
I have updated my application and removed below permission from my update bundle but still it is showing on play store console in app content  sensitive permission.

4 previously declared permissions
android.permission.READ_CALL_LOG
android.permission.SEND_SMS
android.permission.WRITE_CALL_LOG
android.permission.PROCESS_OUTGOING_CALLS


问:
How to reshape matrix in MathNet?
I have 1x4 Matrix
[1, 2, 3, 4]
And I want to get 2x2 Matrix
[[1, 2], [3, 4]]. How can achieve this in Math.Net?

I found Resize method, which does not what I need.

```<code>Vector<double> vector = Vector<double>.Build.DenseOfArray(new double[] { 1, 2, 3, 4 });
var matrix1x4 = vector1x4.ToRowMatrix();
var matrix2x2 = matrix1x4.Resize(2, 2);
</code>```

Resize method does not reshape, it copies part "common" part for those two matrices and discards the rest

```<code>[[1, 0], [2, 0]]
</code>```

Title: How to reshape matrix in MathNet?

Body:
I have 1x4 Matrix
[1, 2, 3, 4]
And I want to get 2x2 Matrix
[[1, 2], [3, 4]]. How can achieve this in Math.Net?

I found Resize method, which does not what I need.

Vector<double> vector = Vector<double>.Build.DenseOfArray(new double[] { 1, 2, 3, 4 });
var matrix1x4 = vector1x4.ToRowMatrix();
var matrix2x2 = matrix1x4.Resize(2, 2);

Resize method does not reshape, it copies part "common" part for those two matrices and discards the rest

[[1, 0], [2, 0]]


问:
Mean and Standard deviation of all the RGB channel of CUB_200 dataset
Does anyone know the statistics of cub_200? I need mean and std of each channel and I want to make a shortcut and not calculate it myself :D
I got the mean from a repo which is (0.407, 0.457, 0.485) but it didn't have the std.</p>


问:
Having trouble displaying the Ionic app icon on Samsung One UI

All app icons are round but but why is the pointed icon square? I don't have any solution please give me some suggestions.

Model name: Galaxy S9

Model number: SM-G960U

One UI version: 2.5

Android: 10

```<code>Ionic:

   Ionic CLI                     : 6.19.0 (C:\Users\Avirup Ghosh\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.9.4
   @angular-devkit/build-angular : 0.901.15
   @angular-devkit/schematics    : 9.1.15
   @angular/cli                  : 9.1.15
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0 (cordova-lib@10.1.0)
   Cordova Platforms : android 10.1.2
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 22 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 1.7.1) : 1.5.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\Avirup Ghosh\AppData\Local\Android\Sdk)
   NodeJS            : v16.14.2 (C:\Program Files\nodejs\node.exe)
   npm               : 6.14.16
   OS                : Windows 10

</code>```

Body:
All app icons are round but but why is the pointed icon square? I don't have any solution please give me some suggestions.

Model name: Galaxy S9

Model number: SM-G960U

One UI version: 2.5

Android: 10

Ionic:

   Ionic CLI                     : 6.19.0 (C:\Users\Avirup Ghosh\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.9.4
   @angular-devkit/build-angular : 0.901.15
   @angular-devkit/schematics    : 9.1.15
   @angular/cli                  : 9.1.15
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0 (cordova-lib@10.1.0)
   Cordova Platforms : android 10.1.2
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 22 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 1.7.1) : 1.5.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\Avirup Ghosh\AppData\Local\Android\Sdk)
   NodeJS            : v16.14.2 (C:\Program Files\nodejs\node.exe)
   npm               : 6.14.16
   OS                : Windows 10


问:
Plot is not displayed in Pycharm
Im writing a program as part of a larger project which supposed to show the course of certain cryptocurrencies compared to the USD. When I try to graph the data from the table I created it wont do so. The process is just finsihed with no errors and no plot.

```<code>def getminutedata(symbol, interval, lookback):
    frame = pd.DataFrame(client.get_historical_klines(symbol, interval, lookback + "min ago UTC+2"))
    frame = frame.iloc[:,:6]
    frame.columns = ["Time","Open","High","Low","Close","Volume"]
    frame = frame.set_index("Time")
    frame.index = pd.to_datetime(frame.index, unit = "ms")
    frame = frame.astype(float)
    return frame
test = getminutedata("BTCUSDT","1m","30")
test.Open.plot()

</code>```

I think it has to do with the test.Open.plot() not functioning properly but honestly im out of ideas. Anyone have a clue on how to fix this?

Tried to use some other functions from mathplotlib like test.show but nothing has worked until now. Hoping someone can point out the flaw in my code so the graphs will be plotted and displayed to me.

Title: Plot is not displayed in Pycharm

Body:
Im writing a program as part of a larger project which supposed to show the course of certain cryptocurrencies compared to the USD. When I try to graph the data from the table I created it wont do so. The process is just finsihed with no errors and no plot.

def getminutedata(symbol, interval, lookback):
    frame = pd.DataFrame(client.get_historical_klines(symbol, interval, lookback + "min ago UTC+2"))
    frame = frame.iloc[:,:6]
    frame.columns = ["Time","Open","High","Low","Close","Volume"]
    frame = frame.set_index("Time")
    frame.index = pd.to_datetime(frame.index, unit = "ms")
    frame = frame.astype(float)
    return frame
test = getminutedata("BTCUSDT","1m","30")
test.Open.plot()

I think it has to do with the test.Open.plot() not functioning properly but honestly im out of ideas. Anyone have a clue on how to fix this?

Tried to use some other functions from mathplotlib like test.show but nothing has worked until now. Hoping someone can point out the flaw in my code so the graphs will be plotted and displayed to me.


问:
Where In Identity files can I find how data is inserted into a database?
I was wondering if it is possible to track in Identity files where my data goes after registering or loging in. I'm asking this because I want to know if I should just create a query and open connection to database to get what I want or if there is a better approach. I'm new to using Identity so some links would be helpful.</p>


问:
Parallelizing DO loop with nvfortran on gpu
I am tring to parallelize a do loop in Fortran. Using OMP parallel do (and converted to standard do loop) it works nicely (using both gfortran and nvfortran), but when compiling it with nvfortran -stdpar=gpu it compiles, but running it, it crashes with:

0 Current file:     xxx/pi.f90
function: pi
line:     15 This file was compiled: -acc=gpu -gpu=cc35 -gpu=cc50 -gpu=cc60 -gpu=cc60 -gpu=cc70 -gpu=cc75 -gpu=cc80 -

Here is the code:

```<code>program pi
  implicit none
  integer :: count, n, i
  real :: r
  real, dimension(10000) :: x,y
  logical , dimension(10000) :: c
  c = .false.
  n=size(x,1)
  print*,count(c)
  call RANDOM_SEED
  call random_number(x)
  call random_number(y)

  do concurrent (i = 1: n)
    if (x(i)**2 + y(i)**2 <1.0) c(i)=.true.
  end do

  r = 4 * real(count(c))/n
  print *, r
end program pi
</code>```

Body:
I am tring to parallelize a do loop in Fortran. Using OMP parallel do (and converted to standard do loop) it works nicely (using both gfortran and nvfortran), but when compiling it with nvfortran -stdpar=gpu it compiles, but running it, it crashes with:

0 Current file:     xxx/pi.f90
function: pi
line:     15 This file was compiled: -acc=gpu -gpu=cc35 -gpu=cc50 -gpu=cc60 -gpu=cc60 -gpu=cc70 -gpu=cc75 -gpu=cc80 -

Here is the code:

program pi
  implicit none
  integer :: count, n, i
  real :: r
  real, dimension(10000) :: x,y
  logical , dimension(10000) :: c
  c = .false.
  n=size(x,1)
  print*,count(c)
  call RANDOM_SEED
  call random_number(x)
  call random_number(y)

  do concurrent (i = 1: n)
    if (x(i)**2 + y(i)**2 <1.0) c(i)=.true.
  end do

  r = 4 * real(count(c))/n
  print *, r
end program pi


问:
How to apply function to each column and row of dataframe pandas
I have two dataframes.
df1 has an index list made of strings like (row1,row2,..,rown) and a column list made of strings like (col1,col2,..,colm) while df2 has k rows and 3 columns (char_1,char_2,value). char_1 contains strings like df1 indexes while char_2 contains strings like df1 columns. I only want to assign the df2 value to df1 in the right position. For example if the first row of df2 reads ['row3','col1','value2'] I want to assign value2 to df1 in the position ([2,0]) (third row and first column).

I tried to use two functions to slide rows and columns of df1:

```<code>def func1(val):
    # first I convert the series to dataframe
    val=val.to_frame()
    val=val.reset_index()
    val=val.set_index('index') # I set the index so that it's the right column
    def func2(val2):
        try: # maybe the combination doesn't exist
            idx1=list(cou.index[df2[char_2]==(val2.name)]) #val2.name reads col name of df1
            idx2=list(cou.index[df2[char_1]==val2.index.values[0]]) #val2.index.values[0] reads index name of df1
            idx= list(reduce(set.intersection, map(set, [idx1,idx2])))
            idx=int(idx[0]) # final index of df2 where I need to take value to assign to df1
            check=1
        except:
            check=0
        if check==1:  # if index exists
            val2[0]=df2['value'][idx] # assign value to df1
        return val2
    val=val.apply(func2,axis=1) #apply the function for columns
    val=val.squeeze() #convert again to series
    return val
df1=df1.apply(func1,axis=1) #apply the function for rows
</code>```

I made the conversion inside func1 because without this step I wasn't able to work with series keeping index and column names so I wasn't able to find the index idx in func2.
Well the problem is that it takes forever. df1 size is (3'600 X 20'000) and df2 is ( 500 X 3 ) so it's not too much. I really don't understand the problem.. I run the code for the first row and column to check the result and it's fine and it takes 1 second, but now for the entire process I've been waiting for hours and it's still not finished.

Is there a way to optimize it? As I wrote in the title I only need to run a function that keeps column and index names and works sliding the entire dataframe. Thanks in advance!

Body:
I have two dataframes.
df1 has an index list made of strings like (row1,row2,..,rown) and a column list made of strings like (col1,col2,..,colm) while df2 has k rows and 3 columns (char_1,char_2,value). char_1 contains strings like df1 indexes while char_2 contains strings like df1 columns. I only want to assign the df2 value to df1 in the right position. For example if the first row of df2 reads ['row3','col1','value2'] I want to assign value2 to df1 in the position ([2,0]) (third row and first column).

I tried to use two functions to slide rows and columns of df1:

def func1(val):
    # first I convert the series to dataframe
    val=val.to_frame()
    val=val.reset_index()
    val=val.set_index('index') # I set the index so that it's the right column
    def func2(val2):
        try: # maybe the combination doesn't exist
            idx1=list(cou.index[df2[char_2]==(val2.name)]) #val2.name reads col name of df1
            idx2=list(cou.index[df2[char_1]==val2.index.values[0]]) #val2.index.values[0] reads index name of df1
            idx= list(reduce(set.intersection, map(set, [idx1,idx2])))
            idx=int(idx[0]) # final index of df2 where I need to take value to assign to df1
            check=1
        except:
            check=0
        if check==1:  # if index exists
            val2[0]=df2['value'][idx] # assign value to df1
        return val2
    val=val.apply(func2,axis=1) #apply the function for columns
    val=val.squeeze() #convert again to series
    return val
df1=df1.apply(func1,axis=1) #apply the function for rows

I made the conversion inside func1 because without this step I wasn't able to work with series keeping index and column names so I wasn't able to find the index idx in func2.
Well the problem is that it takes forever. df1 size is (3'600 X 20'000) and df2 is ( 500 X 3 ) so it's not too much. I really don't understand the problem.. I run the code for the first row and column to check the result and it's fine and it takes 1 second, but now for the entire process I've been waiting for hours and it's still not finished.

Is there a way to optimize it? As I wrote in the title I only need to run a function that keeps column and index names and works sliding the entire dataframe. Thanks in advance!


问:
numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32
I want to denoise images using below code with GAN.

https://gitee.com/cleryer-1/image-denoise-using-wasserstein-gan

This is my modified version of code: https://drive.google.com/drive/folders/1xdRZ5IOnAx_VyhvBB67x19EoDe6CjHUZ?usp=sharing (i only changed image pathways in config.py )
I'm trying to implement same code on my own test and training data which is as follows:
(http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_LR_bicubic_X2.zip)
(http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_valid_LR_bicubic_X2.zip)
I followed the first link above and reshaped and added noise to my own data(256*256 size) with the help of "python image_operation.py -h" in conda. I also changed the amount of virtual memory but problem still occurs. I only changed path in the config.py file with original work.

It gave 2 different errors at different times, these are:
'NoneType' object is not iterable.
numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32.

I also tried it on Google Colab Pro+ but it gives an same error. At the last line, "train()"Should i change something about filepaths?

```<code>**runfile('C:/Users/eren.alici/Desktop/pythons/train.py', wdir='C:/Users/eren.alici/Desktop/pythons')
generating patches
done
Traceback (most recent call last):
File "C:\Users\eren.alici\Desktop\pythons\train.py", line 83, in
train()
File "C:\Users\eren.alici\Desktop\pythons\train.py", line 24, in train
truth, noise = get_patch(truth, noise)
File "C:\Users\eren.alici\Desktop\pythons\utils.py", line 198, in get_patch
return np.array(out_raw), np.array(out_noise)
MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32**
</code>```

edit: i tried to train just 20 image and it gives this error this time:

```<code>C:\Users\asus\AppData\Local\Microsoft\WindowsApps\python3.8.exe C:\Users\asus\PycharmProjects\pythonProject1\train.py
2022-12-31 16:50:37.740732: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2022-12-31 16:50:37.743082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
generating patches
done
2022-12-31 16:51:48.724730: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-12-31 16:51:48.727183: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2022-12-31 16:51:48.851474: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-OLN8V00
2022-12-31 16:51:48.851846: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-OLN8V00
2022-12-31 16:51:48.860257: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-31 16:51:48.952904: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e5e84fe770 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-12-31 16:51:48.953235: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
  File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 84, in <module>
    train()
  File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 45, in train
    for times in epoch_bar(range(truth.shape[0] // BATCH_SIZE)):
  File "C:\Users\asus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\progressbar\progressbar.py", line 150, in __next__
    value = next(self.__iterable)
TypeError: 'NoneType' object is not an iterator
</code>```

Body:
I want to denoise images using below code with GAN.

https://gitee.com/cleryer-1/image-denoise-using-wasserstein-gan

This is my modified version of code: https://drive.google.com/drive/folders/1xdRZ5IOnAx_VyhvBB67x19EoDe6CjHUZ?usp=sharing (i only changed image pathways in config.py )
I'm trying to implement same code on my own test and training data which is as follows:
(http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_LR_bicubic_X2.zip)
(http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_valid_LR_bicubic_X2.zip)
I followed the first link above and reshaped and added noise to my own data(256*256 size) with the help of "python image_operation.py -h" in conda. I also changed the amount of virtual memory but problem still occurs. I only changed path in the config.py file with original work.

It gave 2 different errors at different times, these are:
'NoneType' object is not iterable.
numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32.

I also tried it on Google Colab Pro+ but it gives an same error. At the last line, "train()"Should i change something about filepaths?

**runfile('C:/Users/eren.alici/Desktop/pythons/train.py', wdir='C:/Users/eren.alici/Desktop/pythons')
generating patches
done
Traceback (most recent call last):
File "C:\Users\eren.alici\Desktop\pythons\train.py", line 83, in
train()
File "C:\Users\eren.alici\Desktop\pythons\train.py", line 24, in train
truth, noise = get_patch(truth, noise)
File "C:\Users\eren.alici\Desktop\pythons\utils.py", line 198, in get_patch
return np.array(out_raw), np.array(out_noise)
MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32**

edit: i tried to train just 20 image and it gives this error this time:

C:\Users\asus\AppData\Local\Microsoft\WindowsApps\python3.8.exe C:\Users\asus\PycharmProjects\pythonProject1\train.py
2022-12-31 16:50:37.740732: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2022-12-31 16:50:37.743082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
generating patches
done
2022-12-31 16:51:48.724730: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-12-31 16:51:48.727183: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2022-12-31 16:51:48.851474: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-OLN8V00
2022-12-31 16:51:48.851846: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-OLN8V00
2022-12-31 16:51:48.860257: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-31 16:51:48.952904: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e5e84fe770 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-12-31 16:51:48.953235: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
  File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 84, in <module>
    train()
  File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 45, in train
    for times in epoch_bar(range(truth.shape[0] // BATCH_SIZE)):
  File "C:\Users\asus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\progressbar\progressbar.py", line 150, in __next__
    value = next(self.__iterable)
TypeError: 'NoneType' object is not an iterator


问:
Getting cookies with duplicate names (Python Selenium)
I use selenium to login to a website, but the website contains two cookies which I get one of them before login and I gain another noe after login , and they have the same name like : JSESSIONID: XXX; JSESSIONID: XXX, how can I get both of them or I can choose one form them.

I use the get_cookies method and only get the cookie before login and can't get another one so I can't use that cookie to imitate login.

Is there any solution?


问:
How can I intiate change the parent class variable from the child class variable?
I have two class A and B. The A class takes multiple values. One variable takes a number(let's say 1000) and some symbols or names can be added to it(In this example, I will be using stock symbols).

This is the code for class A.

```<code>    class A:
        def __init__(self, amount=1000):
            self.amount = amount
            self.symbs = []

        def add_symbols(self, symbol):
            self.symbs.append(B(symbol))

        def run_something(self):
            for s in self.symbs:
                s.some_task()
</code>```

Now the code for class B

```<code>    class B:
        def __int__(self, symbol):
            self.symbol = symbol

        def some_task(self):
            some_variable = self other_function() #this other function gets the result either 1 or 0
            if some_variable == 1:
                 #to add 10 in class A's amount.
            else:
                #to subtract 10 from the amount in class A

</code>```

How can I add or subtract the amount value in class A from class B when Class B is initiated from class A and also to note that multiple tasks maybe be initiated by class A that can be running asynchronously.

Body:
I have two class A and B. The A class takes multiple values. One variable takes a number(let's say 1000) and some symbols or names can be added to it(In this example, I will be using stock symbols).

This is the code for class A.

    class A:
        def __init__(self, amount=1000):
            self.amount = amount
            self.symbs = []

        def add_symbols(self, symbol):
            self.symbs.append(B(symbol))

        def run_something(self):
            for s in self.symbs:
                s.some_task()

Now the code for class B

    class B:
        def __int__(self, symbol):
            self.symbol = symbol

        def some_task(self):
            some_variable = self other_function() #this other function gets the result either 1 or 0
            if some_variable == 1:
                 #to add 10 in class A's amount.
            else:
                #to subtract 10 from the amount in class A

How can I add or subtract the amount value in class A from class B when Class B is initiated from class A and also to note that multiple tasks maybe be initiated by class A that can be running asynchronously.


问:
Can i only use only one animation property in a rule at different times. If not how can i do it
```<code>**#y2022 #by::after**{
    visibility: visible;
    content: "2";
    animation: bug 3.5s linear 11.5s 1;

    animation: nwy 1s linear  infinite;
    animation-delay: 16s;
}
</code>```

I tried to use two animation at different times but only one animation is working

Body:
**#y2022 #by::after**{
    visibility: visible;
    content: "2";
    animation: bug 3.5s linear 11.5s 1;

    animation: nwy 1s linear  infinite;
    animation-delay: 16s;
}

I tried to use two animation at different times but only one animation is working


问:
The closest point
How to place n points in a plane so that the distance between every two points is unique and at the same time we could choose one of them that is the closest for all others n-1 points.

I tried to draw it. But I was able to draw it only for max n=5. I drew two perpendicular lines. One point I was intersection of the lines  and the others points lie on the line so that they formed a quadrilateral and point I was inside. With more points it seems impossible to me but I can't prove why

Title: The closest point


问:
Ansys Fluent TUI command not working properly inside the loop
I am writing a scheme script to automate my simulation process in Ansys Fluent. One of the simulation steps involves the separation of (marked) mesh cells. This separation has to take place at every time step, which is why I am trying to automate the process. The TUI command for marked cell separation is :

/mesh/modify-zones/sep-cell-zone-mark fluid "field_value_0" yes c activate-all

When I type this command in the fluent console, it works perfectly, and the separation takes place effectively. However, when I try to put this command inside a loop, it gives an error. Basically, my script contains a do-loop which runs for 'N' number of times, and each time it runs, the above command should perform the separation. But it is giving the following error:

Error: eval: unbound variable
Error Object: /mesh/modify-zones/sep-cell-zone-mark

I created a small journal file (a journal file records all the GUI and TUI operations) that contained just that command, and it worked perfectly. However, when I inserted that command within the loop in my scheme script, it stopped working.


问:
The device is not available because there was an error downloading its symbols. watchos 8.7
i tried to build a apple watch app but got this error:The device  is not available because there was an error downloading its symbols. watchos 8.7

what should i do?


问:
creating pie graph with laravel with json response
i want to know how to get laravel javascript query for my chart
why does it always return the data without making a pie chart, always to the json view

code in view:

```<code><script>
  // get data from database using Ajax or fetch
  fetch('/api/data')
    .then(response => {
        let data = response.data;

        let ctx = document.getElementById('myChart').getContext('2d');
        let myChart = new Chart(ctx, {
            type: 'pie',
            data: data
        });
    })
    .catch(error => {
        console.log(error);
    });
</code>```

code in controller:
```<code>$data = DB::table('suara')
    ->groupBy('suara')
    ->pluck(DB::raw('sum(jml_suara) as sum'), 'suara')
    ->toarray();

    // format data for pie chart
    $labels = [];
    $values = [];
    foreach ($data as $item => $key) {
        $labels[] = $item;
        $values[] = $key;
    }return response()->json([
        'labels' => $labels,
        'datasets' => [
            [
                'data' => $values,
                'backgroundColor' => ['#FF6384', '#36A2EB', '#FFCE56', '#F44336']
            ]
        ]
    ]);
</code>```


问:
Read 2 images separately in 2 different variables
I have downloaded 2 images in one folder and I want to read them one by one in 2 different variables.

I am able to print 2 different files but not able to store these images in different variables. For eg. image 1 should be stored in var1 and 2nd in var2. Below is my code-

```<code>import os
path = r’C:\Users\Desktop\Projects\ImagePractise\Images’
for image in os.listdir(path):
cv2.imread(image)
print(image)
</code>```

Body:
I have downloaded 2 images in one folder and I want to read them one by one in 2 different variables.

I am able to print 2 different files but not able to store these images in different variables. For eg. image 1 should be stored in var1 and 2nd in var2. Below is my code-

import os
path = r’C:\Users\Desktop\Projects\ImagePractise\Images’
for image in os.listdir(path):
cv2.imread(image)
print(image)


问:
Disable idlelib percolator syntax highlighting
Disable idlelib percolator syntax highlight

I was expecting some of the methods in percolator to disable syntax highlighting.

My program throws exceptions when I try .remove, .delete, etc. I load percolator once when my program starts. I would like to turn it off if I open a plain .txt file.

Is there a way to turn off syntax highlighting in idlelib percolator?


问:
A "While printing" formula can not be used to group Crystal Clear
I am working on a report where I created a formula to add 5 different totals of 5 different formulas to give a grand total.
Example: (all these formulas have different calculations)

Formula Total_1 [x1+y1 = 50]

Formula Total_1 [x1+y1 = 50]

Formula Total_2 [x2+y2 = 10]

Formula Total_3 [x3+y3 = 20]

Formula Total_4 [x4+y4 = 10]

Formula Total_5 [x5+y5 =10]

Then I created another formula

[Grand_total= Total_1 + Total_2 + Total_3 +Total_4 +Total_5]

However now I want to sort my records in descending order of the value of the [Grand_total Formula.]
But I get an error saying A "While printing" formula can not be used .
What can I do to get around this?


问:
Use Windows 10 virtual keyboard auto-completion api inside a WPF application
When using the windows 10 virtual keyboard, it offert a auto-completion feature like smartphone keyboard. I want to use this feature in a WPF application without having to open the virtual keyboard.

Does an API exist to get those suggestion from a C#/Wpf app?

There is spell check feature in WPF but it is different from auto-completion.

Spell check can only suggest a word if it's completly typed but with a few mistake. It can't suggest word if you only type the begining of a word.

It don't work with several word with missing space or apostrophe. For example, in french "cest" will be corrected to "c'est" and "helloworld" will be corrected to "hello world"


问:
How do certain input plugins know which parser to use?
I am working with AWS FireLense using Fluent Bit to forward logs from ECS. There is a parsers file with a JSON parser, and the inputs are dynamically generated by the AWS FireLense image. The generated inputs are both of type forward.

Outside of the AWS specific stuff, I know that some input plugins like Tail have the ability to assign a parser. How do forward, dummy, tcp, etc., know which, if any, parser to use?

For reference, here is a link to a sample partial config section https://github.com/aws-samples/amazon-ecs-firelens-under-the-hood/blob/mainline/generated-configs/fluent-bit/generated_by_firelens.conf


问:
How to hide the dropdown when clicked outside the container
I have a International country code selector code for my website but the problem I'm facing is that I want to hide the dropdown menu when anyone clicks outside the container, I have already written the code for this feature but the bug I'm facing right now is that It closes the dropdown menu when anyone clicks inside of the container, not the outside. it's doing the exact opposite.

I want to hide the menu when clicked outside.

Please check out my Highlighted code -

  // Cache the elements
  const xbutton = document.querySelector('.country-code-selector .telcode');
  const container = document.querySelector('.country-code-selector .container');
  const input = document.querySelector('.country-code-selector input');
  const list = document.querySelector('.country-code-selector .list');

  // Add event listeners to the button, input, and list
  // We use a process called "event delegation" on the list
  // to catch events from its children as they "bubble up" the DOM
  // https://dmitripavlutin.com/javascript-event-delegation/
  xbutton.addEventListener('click', handleButton);
  input.addEventListener('input', handleInput);
  list.addEventListener('click', handleListClick);
  document.addEventListener('click', handleDocumentClick);

  // Handles the document click - it checks to see if the clicked
  // part of the document has a parent element which is either
  // `null` or is the HTML element, and then closes the container
  // if it's open
  function handleDocumentClick(e) {
    const { parentElement } = e.target;
  }

/************************************************************************/
/****************** Hide the menu when clicked outside ******************/
/************************************************************************/
document.addEventListener("click", (event) => {
  if (container.contains(event.target)) {
    if (container.classList.contains('show')) {
      container.classList.remove('show');
    }
  }
});
/************************************************************************/
/****************** Hide the menu when clicked outside ******************/
/************************************************************************/

  // All of the data held as objects within an array
  const data = [
    { name: 'Afganistan', code: '69', flag: 'afg' },
    { name: 'Barbados', code: '1-246', flag: 'brb' },
    { name: 'Bolivia', code: '591', flag: 'bol' },
    { name: 'Cuba', code: '53', flag: 'cub' },
    { name: 'Fiji', code: '679', flag: 'fji' },
  ];

  // Filters the data based on the characters
  // at the start of the provided name
  function filterData(data, value) {
    return data.filter(obj => {
      return (
        obj.name.toLowerCase().startsWith(value.toLowerCase())
        || obj.code.toLowerCase().startsWith(value.toLowerCase())
      );
    });
  }

  // Create a series of list items based on the
  // data passed to it
  function createListHtml(data) {
    return data.map(obj => {
      const { name, code, flag } = obj;
      return `

${name} (+${code})

      `;
    }).join('');
  }

  // Toggle the container on/off
  function handleButton() {
    container.classList.toggle('show');
  }

  // No data available list item
  function createNoDataHtml() {
    return '
No data available
';
  }

  // When the input is changed filter the data
  // according to the current value, and then
  // create some list items using that filtered data
  function handleInput(e) {
    const { value } = e.target;
    if (value) {
      const filtered = filterData(data, value);
      if (filtered.length) {
        list.innerHTML = createListHtml(filtered);
      } else {
        list.innerHTML = createNoDataHtml();
      }
    } else {
      list.innerHTML = createListHtml(data);
    }
  }

  // Create some button HTML
  function createButtonHtml(code, flag) {
    return `

+${code}

    `;
  }

  // Updates the selected list by removing the `selected`
  // class from all items, and then adding one to the clicked
  // item
  function updateSelected(list, item) {
    const items = list.querySelectorAll('.item');
    items.forEach(item => item.classList.remove('selected'));
    item.classList.add('selected');
  }

  // When an item is clicked, grab the relevant data
  // attributes, create the new button HTML, and then
  // close the container
  function handleListClick(e) {
    const item = e.target.closest('li') || e.target;
    if (item.classList.contains('item')) {
      const { code, flag } = item.dataset;
      xbutton.innerHTML = createButtonHtml(code, flag);
      updateSelected(list, item);
      container.classList.remove('show');
    }
  }

  list.innerHTML = createListHtml(data);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>  .country-code-selector .telcode {
       margin-bottom: 1em;
       display: flex;
  }
  .country-code-selector .telcode div.code, .item div.name {
       margin-left: 0.25em;
  }
  .country-code-selector .container {
       display: none;
       width: 350px;
       border: 1px solid black;
  }
  .country-code-selector .show {
       display: block;
  }
  .country-code-selector .list {
       height: 100px;
       list-style: none;
       margin: 1em 0 0 0;
       padding: 0;
       overflow-y: scroll;
       border: 1px soldi darkgray;
  }
  .country-code-selector .item {
       display: flex;
       padding: 0.25em;
       border: 1px solid lightgray;
  }
  .country-code-selector .item:hover {
       cursor: pointer;
  }
  .country-code-selector .item:hover, .item.selected {
       background-color: lightyellow;
  }</code>```

<link href="https://amitdutta.co.in/flag/css/flag-icon.css" rel="stylesheet"/>

  <button type="button" class="telcode">Tel code</button>

    <input type="text" placeholder="Search for country" />

```

Body:
I have a International country code selector code for my website but the problem I'm facing is that I want to hide the dropdown menu when anyone clicks outside the container, I have already written the code for this feature but the bug I'm facing right now is that It closes the dropdown menu when anyone clicks inside of the container, not the outside. it's doing the exact opposite.

I want to hide the menu when clicked outside.

Please check out my Highlighted code -

  // Cache the elements
  const xbutton = document.querySelector('.country-code-selector .telcode');
  const container = document.querySelector('.country-code-selector .container');
  const input = document.querySelector('.country-code-selector input');
  const list = document.querySelector('.country-code-selector .list');

  // Add event listeners to the button, input, and list
  // We use a process called "event delegation" on the list
  // to catch events from its children as they "bubble up" the DOM
  // https://dmitripavlutin.com/javascript-event-delegation/
  xbutton.addEventListener('click', handleButton);
  input.addEventListener('input', handleInput);
  list.addEventListener('click', handleListClick);
  document.addEventListener('click', handleDocumentClick);

  // Handles the document click - it checks to see if the clicked
  // part of the document has a parent element which is either
  // `null` or is the HTML element, and then closes the container
  // if it's open
  function handleDocumentClick(e) {
    const { parentElement } = e.target;
  }

/************************************************************************/
/****************** Hide the menu when clicked outside ******************/
/************************************************************************/
document.addEventListener("click", (event) => {
  if (container.contains(event.target)) {
    if (container.classList.contains('show')) {
      container.classList.remove('show');
    }
  }
});
/************************************************************************/
/****************** Hide the menu when clicked outside ******************/
/************************************************************************/

  // All of the data held as objects within an array
  const data = [
    { name: 'Afganistan', code: '69', flag: 'afg' },
    { name: 'Barbados', code: '1-246', flag: 'brb' },
    { name: 'Bolivia', code: '591', flag: 'bol' },
    { name: 'Cuba', code: '53', flag: 'cub' },
    { name: 'Fiji', code: '679', flag: 'fji' },
  ];

  // Filters the data based on the characters
  // at the start of the provided name
  function filterData(data, value) {
    return data.filter(obj => {
      return (
        obj.name.toLowerCase().startsWith(value.toLowerCase())
        || obj.code.toLowerCase().startsWith(value.toLowerCase())
      );
    });
  }

  // Create a series of list items based on the
  // data passed to it
  function createListHtml(data) {
    return data.map(obj => {
      const { name, code, flag } = obj;
      return `

${name} (+${code})

      `;
    }).join('');
  }

  // Toggle the container on/off
  function handleButton() {
    container.classList.toggle('show');
  }

  // No data available list item
  function createNoDataHtml() {
    return '
No data available
';
  }

  // When the input is changed filter the data
  // according to the current value, and then
  // create some list items using that filtered data
  function handleInput(e) {
    const { value } = e.target;
    if (value) {
      const filtered = filterData(data, value);
      if (filtered.length) {
        list.innerHTML = createListHtml(filtered);
      } else {
        list.innerHTML = createNoDataHtml();
      }
    } else {
      list.innerHTML = createListHtml(data);
    }
  }

  // Create some button HTML
  function createButtonHtml(code, flag) {
    return `

+${code}

    `;
  }

  // Updates the selected list by removing the `selected`
  // class from all items, and then adding one to the clicked
  // item
  function updateSelected(list, item) {
    const items = list.querySelectorAll('.item');
    items.forEach(item => item.classList.remove('selected'));
    item.classList.add('selected');
  }

  // When an item is clicked, grab the relevant data
  // attributes, create the new button HTML, and then
  // close the container
  function handleListClick(e) {
    const item = e.target.closest('li') || e.target;
    if (item.classList.contains('item')) {
      const { code, flag } = item.dataset;
      xbutton.innerHTML = createButtonHtml(code, flag);
      updateSelected(list, item);
      container.classList.remove('show');
    }
  }

  list.innerHTML = createListHtml(data);

  .country-code-selector .telcode {
       margin-bottom: 1em;
       display: flex;
  }
  .country-code-selector .telcode div.code, .item div.name {
       margin-left: 0.25em;
  }
  .country-code-selector .container {
       display: none;
       width: 350px;
       border: 1px solid black;
  }
  .country-code-selector .show {
       display: block;
  }
  .country-code-selector .list {
       height: 100px;
       list-style: none;
       margin: 1em 0 0 0;
       padding: 0;
       overflow-y: scroll;
       border: 1px soldi darkgray;
  }
  .country-code-selector .item {
       display: flex;
       padding: 0.25em;
       border: 1px solid lightgray;
  }
  .country-code-selector .item:hover {
       cursor: pointer;
  }
  .country-code-selector .item:hover, .item.selected {
       background-color: lightyellow;
  }

<link href="https://amitdutta.co.in/flag/css/flag-icon.css" rel="stylesheet"/>

  <button type="button" class="telcode">Tel code</button>

    <input type="text" placeholder="Search for country" />


问:
Python: get data from a query MS Access with pandas and sqlalchemy

Hello, I need your help for this error
I don’t have experience In Python, I am new on it
I need to export a query from MS Access to excel
I create the connection with my database and the connection seems OK
However, when I call the dataframe from Pandas I have this message:

Empty DataFrame
Columns: [Cofor6, TypePce, Ste, CompteDeNfact]
Index: []

This is my code:

connection_string = (
r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};"
r"DBQ=C:\xxx\xx\Python_Projects\xxx\xx\xx\mydb.mdb;"
r"ExtendedAnsiSQL=1;")`

connection_url = sa.engine.URL.create("access+pyodbc",query={"odbc_connect": connection_string})

engine = sa.create_engine(connection_url)

print ('connected')

RAFAELquery= '''SELECT SAP_CONSO.Cofor6,SAP_CONSO.TypePce,SAP_CONSO.Ste,Count(SAP_CONSO.Nfact) AS CompteDeNfact FROM SAP_CONSO GROUP BY SAP_CONSO.Cofor6,SAP_CONSO.TypePce,SAP_CONSO.Ste,SAP_CONSO.SaiParFlux HAVING (((SAP_CONSO.TypePce) Not Like 'y\*') AND ((SAP_CONSO.SaiParFlux) Like '\*E')) ORDER BY SAP_CONSO.TypePce DESC;'''

df=pd.read_sql_query(RAFAELquery,engine)

print(df)

Anyone can help me? Thanks a lot


问:
GL_INVALID_OPERATION in glGetIntegerv() with GLAD
I use GLAD (config) to load OpenGL functions and GLFW 3.3.8 to create context. Each time I start my program it pops a ERROR 1282 in glGetIntegerv from GLAD debug post-callback function (as far as I know it is invoked after each gl- function and prints an error if any occurred). I figured that this happens after returning from main().

Here's the code (it loads OpenGL 3.3 and shows red window until it is closed, pretty simple I think):

#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>

int main()
{
    if(glfwInit() != GLFW_TRUE)
        throw std::runtime_error{"Unable to initialize GLFW."};

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    GLFWwindow * w{glfwCreateWindow(100, 100, "title", nullptr, nullptr)};
    if(w == nullptr)
        throw std::runtime_error{"Unable to create window."};

    glfwMakeContextCurrent(w);
    if(not gladLoadGLLoader(GLADloadproc(glfwGetProcAddress)))
        throw std::runtime_error{"Unable to load OpenGL functions."};

    glViewport(0, 0, 100, 100);

    while(not glfwWindowShouldClose(w))
    {
        glfwPollEvents();

        glClearColor(1.f, 0.f, 0.f, 1.f);
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers(w);
    }

    glfwMakeContextCurrent(nullptr);
    glfwDestroyWindow(w);
    glfwTerminate();

    std::cout << "Hey!" << std::endl;
    return 0;
}
```
<p>The output is:</p>
<pre class="lang-none prettyprint-override"><code>Hey!
ERROR 1282 in glGetIntegerv
</code>```

From this callstack:

#0  0x00416f91 in _post_call_callback_default_gl (name=0x446d40 <_glfwDataFormat+10036> "glGetIntegerv", funcptr=0x41c1ec <glad_debug_impl_glGetIntegerv@8>, len_args=2) at <glad.c>:45
#1  0x0041c265 in glad_debug_impl_glGetIntegerv@8 (arg0=33309, arg1=0x4526cc <num_exts_i>) at <glad.c>:1385
#2  0x00417168 in get_exts () at <glad.c>:220
#3  0x0042691f in find_extensionsGL () at <glad.c>:3742
#4  0x00426d12 in gladLoadGLLoader (load=0x402a2e <glfwGetProcAddress>) at <glad.c>:3821
#5  0x004016f8 in main () at :33
```

Error 1282 is GL_INVALID_OPERATION, but it pops up after the program ended (or at least after the main() ended). Even if I separate the whole code in another function (i. e. create and destroy everything in separate function), and then invoke it in main(), the error still appears after the return 0; from main().

This did not happen when I used GLEW to load OpenGL functions, but maybe it was silenced. I didn't find anything similar to my problem on the internet. What am I doing wrong? Do I have to unload OpenGL or something like that?

UPD: Error message actually pops in gladLoadGLLoader(), not after the end of main().

Body:
I use GLAD (config) to load OpenGL functions and GLFW 3.3.8 to create context. Each time I start my program it pops a ERROR 1282 in glGetIntegerv from GLAD debug post-callback function (as far as I know it is invoked after each gl- function and prints an error if any occurred). I figured that this happens after returning from main().

Here's the code (it loads OpenGL 3.3 and shows red window until it is closed, pretty simple I think):

#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>

int main()
{
    if(glfwInit() != GLFW_TRUE)
        throw std::runtime_error{"Unable to initialize GLFW."};

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    GLFWwindow * w{glfwCreateWindow(100, 100, "title", nullptr, nullptr)};
    if(w == nullptr)
        throw std::runtime_error{"Unable to create window."};

    glfwMakeContextCurrent(w);
    if(not gladLoadGLLoader(GLADloadproc(glfwGetProcAddress)))
        throw std::runtime_error{"Unable to load OpenGL functions."};

    glViewport(0, 0, 100, 100);

    while(not glfwWindowShouldClose(w))
    {
        glfwPollEvents();

        glClearColor(1.f, 0.f, 0.f, 1.f);
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers(w);
    }

    glfwMakeContextCurrent(nullptr);
    glfwDestroyWindow(w);
    glfwTerminate();

    std::cout << "Hey!" << std::endl;
    return 0;
}

The output is:

Hey!
ERROR 1282 in glGetIntegerv

From this callstack:

#0  0x00416f91 in _post_call_callback_default_gl (name=0x446d40 <_glfwDataFormat+10036> "glGetIntegerv", funcptr=0x41c1ec <glad_debug_impl_glGetIntegerv@8>, len_args=2) at <glad.c>:45
#1  0x0041c265 in glad_debug_impl_glGetIntegerv@8 (arg0=33309, arg1=0x4526cc <num_exts_i>) at <glad.c>:1385
#2  0x00417168 in get_exts () at <glad.c>:220
#3  0x0042691f in find_extensionsGL () at <glad.c>:3742
#4  0x00426d12 in gladLoadGLLoader (load=0x402a2e <glfwGetProcAddress>) at <glad.c>:3821
#5  0x004016f8 in main () at :33

Error 1282 is GL_INVALID_OPERATION, but it pops up after the program ended (or at least after the main() ended). Even if I separate the whole code in another function (i. e. create and destroy everything in separate function), and then invoke it in main(), the error still appears after the return 0; from main().

This did not happen when I used GLEW to load OpenGL functions, but maybe it was silenced. I didn't find anything similar to my problem on the internet. What am I doing wrong? Do I have to unload OpenGL or something like that?

UPD: Error message actually pops in gladLoadGLLoader(), not after the end of main().


问:
I need to animate an image with two different animations triggered by clicking a button in the header and a button in a popup menu

Wordpress + Elementor PRO

Hi guys, I hope you can help me out on this. I need to animate an image with two different animations triggered by clicking a button in the header and a button in a popup menu.

I've made the animations with CSS. Trigger is a js/jquery function on button click.

The first button opens a fullscreen popup menu, the image animates just fine and stays over the popup. Now I need to play animation 2 from the popup to make the image revert to the initial position, I tried replicating what I did before but the animation won't start if the button is in the popup.

When button clicked, fire the script (#start-animazione is assigned to the button)

```<code>    document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#start-animazione a').click(function(){
DoAnimation();
      });
});
</code>```

Variation for animation 2

```<code>    document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#start-animazione2 a').click(function(){
DoAnimation2();
      });
});
</code>```

Trigger for Animation (image has ID target) - "ruota" is the css class for animation

```<code>function DoAnimation() {
  var targetElement = document.getElementById("target");
  targetElement.className = "ruota";
}
</code>```

Variation for animation 2

```<code>function DoAnimation2() {
  var targetElement = document.getElementById("target");
  targetElement.className = "ruota2";
</code>```

It works fine if the button is in the header, but it doesn't work if the button is inside the popup menu.

I can't get my head around it.

Video of 2nd animation not working

Body:
Wordpress + Elementor PRO

Hi guys, I hope you can help me out on this. I need to animate an image with two different animations triggered by clicking a button in the header and a button in a popup menu.

I've made the animations with CSS. Trigger is a js/jquery function on button click.

The first button opens a fullscreen popup menu, the image animates just fine and stays over the popup. Now I need to play animation 2 from the popup to make the image revert to the initial position, I tried replicating what I did before but the animation won't start if the button is in the popup.

When button clicked, fire the script (#start-animazione is assigned to the button)

    document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#start-animazione a').click(function(){
DoAnimation();
      });
});

Variation for animation 2

    document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#start-animazione2 a').click(function(){
DoAnimation2();
      });
});

Trigger for Animation (image has ID target) - "ruota" is the css class for animation

function DoAnimation() {
  var targetElement = document.getElementById("target");
  targetElement.className = "ruota";
}

Variation for animation 2

function DoAnimation2() {
  var targetElement = document.getElementById("target");
  targetElement.className = "ruota2";

It works fine if the button is in the header, but it doesn't work if the button is inside the popup menu.

I can't get my head around it.

Video of 2nd animation not working


问:
Android Kotlin Navhost invisible problem?
When I add the View Host Fragment, the design becomes invisible in the xml section, what can I do?

While navigating in Android Studio, when I add nav host fragment to the xml part, the design side becomes invisible, what can I do?

If you encounter such a problem, do not forget to give tools to the xml side in the navigation section, and do not forget to set the constrait to the nav host.

Navigation xml into

xmlns:tools="http://schemas.android.com/tools"
```
<p>For example</p>
<pre class="lang-kotlin prettyprint-override"><code>
<fragment
        android:id="@+id/firstfragment"
        android:name="com.example.countryapps.firstfragment"
        tools:layout="@layout/fragment_firstfragment"
        android:label="firstfragment" >
        <action
            android:id="@+id/action_firstfragment_to_secondfragment"
            app:destination="@id/secondfragment" />
    </fragment>
</code>```

Body:
When I add the View Host Fragment, the design becomes invisible in the xml section, what can I do?

While navigating in Android Studio, when I add nav host fragment to the xml part, the design side becomes invisible, what can I do?

If you encounter such a problem, do not forget to give tools to the xml side in the navigation section, and do not forget to set the constrait to the nav host.

Navigation xml into

xmlns:tools="http://schemas.android.com/tools"

For example

<fragment
        android:id="@+id/firstfragment"
        android:name="com.example.countryapps.firstfragment"
        tools:layout="@layout/fragment_firstfragment"
        android:label="firstfragment" >
        <action
            android:id="@+id/action_firstfragment_to_secondfragment"
            app:destination="@id/secondfragment" />
    </fragment>


问:
How can I disable duplicate command entries in CMD while using Paramiko interactive shell?
So, I'm a beginner with Python and I'm mostly building an SSH client for fun and working on a little automation for repetitive tasks at work. The script works as intended right now except for one minor annoyance - the entered command shows up twice in command prompt and powershell (but for some reason it doesn't when running the script in Pycharm)

CMD response:

```<code>FortiGate-60F # sh sys admin
sh sys admin
config system admin
    edit "admin"
        set accprofile "super_admin"
        set vdom "root"
    next
end
</code>```

PyCharm response:

```<code>FortiGate-60F # sh sys admin

config system admin
    edit "admin"
        set accprofile "super_admin"
        set vdom "root"
    next
end
</code>```

Full script (un/pw redacted):

```<code>import paramiko
import time
import sys
import colorama

colorama.init()

def shell(chan):
    import threading

    def writeall(sock):
        decoder = ""
        while True:
            data = sock.recv(256)
            decoder = str(data.decode("utf8", "ignore"))
            if not data:
                sys.stdout.write("\r\n*** DISCONNECTED ***\r\n\r\n")
                sys.stdout.flush()
                remote_conn.close()
                sys.exit()
            sys.stdout.write(decoder)
            sys.stdout.flush()
            if "Type the hot key to suspend the connection: <CTRL>Z" in decoder:
                sys.stdout.write(f"\r\033[1F\033[2KType the hot key to suspend the connection: <CTRL>C\n\n")

    writer = threading.Thread(target=writeall, args=(chan,))
    writer.start()
    try:
        while True:
            d = sys.stdin.readline()
            if d == "set_phone_home\n":
                chan.send("\rexec batch start\n")
                time.sleep(.5)
                chan.send("config system central-management\n")
                time.sleep(.5)
                chan.send("set type fortimanager\n")
                time.sleep(.5)
                chan.send("set serial-number \"FMG-VM0A16000497\"\n")
                time.sleep(.5)
                chan.send("set fmg \"172.85.135.226\"\n")
                time.sleep(.5)
                chan.send("end\n")
                time.sleep(.5)
                chan.send("exec batch end\n")
            elif d == "firmware_up\n":
                chan.send("\rexecute restore image usb image.out\n")
                sys.stdout.write("\033[F")
                time.sleep(.5)
                chan.send("y")
            elif d == "quit_ssh\n":
                remote_conn.close()
                sys.exit()
            else:
                chan.send(d)

    except EOFError:
        # user hit ^Z or F6
        remote_conn.close()
        pass
    except KeyboardInterrupt:
        remote_conn.close()
        sys.exit()

def get_serv():
    global serv
    serv = input("COM: ")
    try:
        serv = int(serv)
    except:
        get_serv()

def get_portx():
    global portx
    portx = input("Port: ")
    try:
        portx = int(portx)
    except:
        get_portx()

print("\n(╯°□°)╯_- \u001b[31m♥\033[39m FortiSSH Client \u001b[31m♥\033[39m\n")

serv = 0
portx = 0
serv_list = [17, 18, 19, 200]
while serv not in serv_list:
    get_serv()
while not 0 < portx < 49:
    get_portx()

if serv == 17:
    ip = '192.168.40.17'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "30" + f"{portx:02}"
elif serv == 18:
    ip = '192.168.40.18'
    username = input("User name: ")
    password = input("Password: ")
    port = "30" + f"{portx:02}"
elif serv == 19:
    ip = '192.168.40.19'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "22" + f"{portx:02}"
elif serv == 200:
    ip = '192.168.41.200'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "30" + f"{portx:02}"

# username = input("User name: ")
# password = pwinput.pwinput(prompt="Password: ", mask="•")

# port = 3001

# Create instance of SSHClient object
remote_conn_pre = paramiko.SSHClient()

# Automatically add untrusted hosts (make sure okay for security policy in your environment)
remote_conn_pre.set_missing_host_key_policy(
    paramiko.AutoAddPolicy())

# initiate SSH connection
remote_conn_pre.connect(ip, username=username, password=password, port=port, look_for_keys=False, allow_agent=False)
print(f"\nSSH connection established to {ip}, Port {portx}")

# Use invoke_shell to establish an 'interactive session'
remote_conn = remote_conn_pre.invoke_shell()
shell(remote_conn)
remote_conn.close()

</code>```

I've tried a few different things, but can't seem to come up with a solution. Please help!

Body:
So, I'm a beginner with Python and I'm mostly building an SSH client for fun and working on a little automation for repetitive tasks at work. The script works as intended right now except for one minor annoyance - the entered command shows up twice in command prompt and powershell (but for some reason it doesn't when running the script in Pycharm)

CMD response:

FortiGate-60F # sh sys admin
sh sys admin
config system admin
    edit "admin"
        set accprofile "super_admin"
        set vdom "root"
    next
end

PyCharm response:

FortiGate-60F # sh sys admin

config system admin
    edit "admin"
        set accprofile "super_admin"
        set vdom "root"
    next
end

Full script (un/pw redacted):

import paramiko
import time
import sys
import colorama

colorama.init()

def shell(chan):
    import threading

    def writeall(sock):
        decoder = ""
        while True:
            data = sock.recv(256)
            decoder = str(data.decode("utf8", "ignore"))
            if not data:
                sys.stdout.write("\r\n*** DISCONNECTED ***\r\n\r\n")
                sys.stdout.flush()
                remote_conn.close()
                sys.exit()
            sys.stdout.write(decoder)
            sys.stdout.flush()
            if "Type the hot key to suspend the connection: <CTRL>Z" in decoder:
                sys.stdout.write(f"\r\033[1F\033[2KType the hot key to suspend the connection: <CTRL>C\n\n")

    writer = threading.Thread(target=writeall, args=(chan,))
    writer.start()
    try:
        while True:
            d = sys.stdin.readline()
            if d == "set_phone_home\n":
                chan.send("\rexec batch start\n")
                time.sleep(.5)
                chan.send("config system central-management\n")
                time.sleep(.5)
                chan.send("set type fortimanager\n")
                time.sleep(.5)
                chan.send("set serial-number \"FMG-VM0A16000497\"\n")
                time.sleep(.5)
                chan.send("set fmg \"172.85.135.226\"\n")
                time.sleep(.5)
                chan.send("end\n")
                time.sleep(.5)
                chan.send("exec batch end\n")
            elif d == "firmware_up\n":
                chan.send("\rexecute restore image usb image.out\n")
                sys.stdout.write("\033[F")
                time.sleep(.5)
                chan.send("y")
            elif d == "quit_ssh\n":
                remote_conn.close()
                sys.exit()
            else:
                chan.send(d)

    except EOFError:
        # user hit ^Z or F6
        remote_conn.close()
        pass
    except KeyboardInterrupt:
        remote_conn.close()
        sys.exit()

def get_serv():
    global serv
    serv = input("COM: ")
    try:
        serv = int(serv)
    except:
        get_serv()

def get_portx():
    global portx
    portx = input("Port: ")
    try:
        portx = int(portx)
    except:
        get_portx()

print("\n(╯°□°)╯_- \u001b[31m♥\033[39m FortiSSH Client \u001b[31m♥\033[39m\n")

serv = 0
portx = 0
serv_list = [17, 18, 19, 200]
while serv not in serv_list:
    get_serv()
while not 0 < portx < 49:
    get_portx()

if serv == 17:
    ip = '192.168.40.17'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "30" + f"{portx:02}"
elif serv == 18:
    ip = '192.168.40.18'
    username = input("User name: ")
    password = input("Password: ")
    port = "30" + f"{portx:02}"
elif serv == 19:
    ip = '192.168.40.19'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "22" + f"{portx:02}"
elif serv == 200:
    ip = '192.168.41.200'
    username = 'XXXXXXXX'
    password = 'XXXXXXXX'
    port = "30" + f"{portx:02}"

# username = input("User name: ")
# password = pwinput.pwinput(prompt="Password: ", mask="•")

# port = 3001

# Create instance of SSHClient object
remote_conn_pre = paramiko.SSHClient()

# Automatically add untrusted hosts (make sure okay for security policy in your environment)
remote_conn_pre.set_missing_host_key_policy(
    paramiko.AutoAddPolicy())

# initiate SSH connection
remote_conn_pre.connect(ip, username=username, password=password, port=port, look_for_keys=False, allow_agent=False)
print(f"\nSSH connection established to {ip}, Port {portx}")

# Use invoke_shell to establish an 'interactive session'
remote_conn = remote_conn_pre.invoke_shell()
shell(remote_conn)
remote_conn.close()

I've tried a few different things, but can't seem to come up with a solution. Please help!


问:
Linear regression lines in a time series data(BTCUSD) with Angles close 90 degrees and slopes with big numbers
I trade Bitcoin and USD. For getting regression lines values, angles and slopes, I use the talib library.

I'd like to compare angle of regression lines of different lengths, for example regression lines with length of 10 and 50, however when printing the angles and slopes values, almost all of angles are close to 90 degrees (positive or negative) and slopes are big numbers(positive or negative).

The code:

import pandas as pd
import talib

df = pd.read_csv(r'E:\filepath\Kucoin_BTCUSDT_d.csv')
# getting a short section of df for ease in printing the results
df = df[100:105]

df.date = pd.to_datetime(df.date, format="%m/%d/%Y %H:%M")
df = df.set_index("date")

lrSlope = talib.LINEARREG_SLOPE(df['close'], timeperiod=5)
lrAngle = talib.LINEARREG_ANGLE(df['close'], timeperiod=5)

print(df['close'])
print('Slope', lrSlope.iloc[-1])
print('Angle', lrAngle.iloc[-1])
```
<p>Here is the result:</p>
<pre class="lang-none prettyprint-override"><code>date

2018-02-03    9199.999443

2018-02-04    8117.000002

2018-02-05    6950.001000

2018-02-06    7676.000008

2018-02-07    7572.421893

Name: close, dtype: float64

Slope -369.61550939999984

Angle -89.84498583458068
</code>```

I think it;s because of big difference in x and y axes, x is (0, 1, 2, ...) if date is not set as index or date if it is set as index, but y axis is Bitcoin prices which are big numbers.

What is the problem here? is my assumption correct? what can I do to get more realistic angles (like 30, 45, 60, etc.) so that I can compare them, and set certain thresholds?

Body:
I trade Bitcoin and USD. For getting regression lines values, angles and slopes, I use the talib library.

I'd like to compare angle of regression lines of different lengths, for example regression lines with length of 10 and 50, however when printing the angles and slopes values, almost all of angles are close to 90 degrees (positive or negative) and slopes are big numbers(positive or negative).

The code:

import pandas as pd
import talib

df = pd.read_csv(r'E:\filepath\Kucoin_BTCUSDT_d.csv')
# getting a short section of df for ease in printing the results
df = df[100:105]

df.date = pd.to_datetime(df.date, format="%m/%d/%Y %H:%M")
df = df.set_index("date")

lrSlope = talib.LINEARREG_SLOPE(df['close'], timeperiod=5)
lrAngle = talib.LINEARREG_ANGLE(df['close'], timeperiod=5)

print(df['close'])
print('Slope', lrSlope.iloc[-1])
print('Angle', lrAngle.iloc[-1])

Here is the result:

date

2018-02-03    9199.999443

2018-02-04    8117.000002

2018-02-05    6950.001000

2018-02-06    7676.000008

2018-02-07    7572.421893

Name: close, dtype: float64

Slope -369.61550939999984

Angle -89.84498583458068

I think it;s because of big difference in x and y axes, x is (0, 1, 2, ...) if date is not set as index or date if it is set as index, but y axis is Bitcoin prices which are big numbers.

What is the problem here? is my assumption correct? what can I do to get more realistic angles (like 30, 45, 60, etc.) so that I can compare them, and set certain thresholds?


问:
Change dropdown list by radio button
I have a database-file with transport companies for local and regional public transport.
I have a dropdown that allows you to select the countries
I want to make choices with the help of 3 radio buttons whether the dropdown should show everything or only local or regional transport.

```<code> <input type="radio" name="regio" OnClick(.......) value="%" checked>alle-
 <input type="radio" name="regio" OnClick(.......) value="N" >stads-
 <input type="radio" name="regio" OnClick(.......) value="Y" >regionaalvervoer
</code>```

The command to load the page is:
by default the iframe is filled as follows:

```<code><iFrame name='BTM' height='100%' width='100%' border='0' frameborder='0' src='BTM.php?landcode=%&regio=%' /></iFrame>
</code>```

Via the dropdown I choose the desired country, but via the radio button I want to be able to set the region to % (All), N (Local) or Y (Region).

The drop-down menu should then give the following result when selected % by radiobutton:

```<code><select name="menu1" onChange="MM_jumpMenu('BTM',this,0)">
<option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=%">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=%">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=%">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=%">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=%">Chili</option>
</code>```

Or when by radiobutton selected: N

```<code><option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=N">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=N">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=N">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=N">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=N">Chili</option>
</code>```

Or when by radiobutton selected: Y

```<code><option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=Y">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=Y">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=Y">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=Y">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=Y">Chili</option>
</code>```

BTM.php retrieves the country code and region variables with $_GET and then inserts them into the MySQL-database call.

The radio buttons for Metro Tram Bus are not at the site now.

Link to the site, >Transport > Bus Tram Metro

Title: Change dropdown list by radio button

Body:
I have a database-file with transport companies for local and regional public transport.
I have a dropdown that allows you to select the countries
I want to make choices with the help of 3 radio buttons whether the dropdown should show everything or only local or regional transport.

 <input type="radio" name="regio" OnClick(.......) value="%" checked>alle-
 <input type="radio" name="regio" OnClick(.......) value="N" >stads-
 <input type="radio" name="regio" OnClick(.......) value="Y" >regionaalvervoer

The command to load the page is:
by default the iframe is filled as follows:

Via the dropdown I choose the desired country, but via the radio button I want to be able to set the region to % (All), N (Local) or Y (Region).

The drop-down menu should then give the following result when selected % by radiobutton:

<select name="menu1" onChange="MM_jumpMenu('BTM',this,0)">
<option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=%">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=%">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=%">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=%">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=%">Chili</option>

Or when by radiobutton selected: N

<option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=N">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=N">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=N">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=N">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=N">Chili</option>

Or when by radiobutton selected: Y

<option selected>Kies een land…</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=%&regio=Y">Alle landen</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=ARG&regio=Y">Argentinië</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=AZE&regio=Y">Azerbeidzjan</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=BE&regio=Y">België</option>
<option value ="https://www.reisschakel.nl/BTM.php?landcode=CL&regio=Y">Chili</option>

BTM.php retrieves the country code and region variables with $_GET and then inserts them into the MySQL-database call.

The radio buttons for Metro Tram Bus are not at the site now.

Link to the site, >Transport > Bus Tram Metro


问:
How to point my domain to ip address using NGINX?
I have a problem. I think I went through every single link on the web to find a solution. So i'm trying to figure out why NGINX can't display the desired HTML page. Let me go through what I've done from the very beginning.

I bought a domain. Let's call it example.com. After that I bought VPS. To connect them, I used A records in DNS management:

```<code>Name      IP Address      TTL
@         VPS IP Address  28800

Name      IP Address      TTL
www       VPS IP Address  28800
</code>```

To check if my VPS connected to domain, I used nslookup command in Windows:

```<code>nslookup sklyar.app 8.8.8.8

╤хЁтхЁ:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
╚ь :     sklyar.app
Address:  VPS IP Address
</code>```

Also I checked the nameservers:

```<code>nslookup -q=ns sklyar.app 8.8.8.8

╤хЁтхЁ:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
example.com      nameserver = dns4.domainregistrar.com
example.com      nameserver = dns1.domainregistrar.com
example.com      nameserver = dns3.domainregistrar.com
example.com      nameserver = dns2.domainregistrar.com
</code>```

This means that everything is alright, isn't it?
After that I connected to VPS via ssh. Then wrote the series of commands:

```<code>sudo apt update
sudo apt upgrade
sudo apt install nginx
sudo ufw allow 'Nginx Full'
</code>```

Then I went to http://VPS IP Address and I saw NGINX starting page.
After that created a simple HTML:

```<code>sudo mkdir -p /var/www/example.com/html
sudo vim /var/www/example.com/html/index.html
</code>```

In index.html I put:

```<code><html>
    <head>
        <title>Welcome to example.com!</title>
    </head>
    <body>
        <h1>Success! The example.com server block is working!</h1>
    </body>
</html>
</code>```

Then I created NGINX file:

```<code>sudo vim /etc/nginx/sites-available/example.com
</code>```

Where I put:

```<code>server {
    listen 80;
    listen [::]:80;

    root /var/www/example.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

    location / {
        try_files $uri $uri/ =404;
    }
}
</code>```

After that I used:

```<code>sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo systemctl restart nginx
</code>```

And when I go to http://example.com it gives me ERR_CONNECTION_REFUSED error.

I also tried changing the user in /etc/nginx/nginx.conf, setting this parameter: server_names_hash_bucket_size 64;, deploying a Flask app, using tutorial that worked for me on other registrars and VPS before.

What am I doing wrong? Help me please!

Body:
I have a problem. I think I went through every single link on the web to find a solution. So i'm trying to figure out why NGINX can't display the desired HTML page. Let me go through what I've done from the very beginning.

I bought a domain. Let's call it example.com. After that I bought VPS. To connect them, I used A records in DNS management:

Name      IP Address      TTL
@         VPS IP Address  28800

Name      IP Address      TTL
www       VPS IP Address  28800

To check if my VPS connected to domain, I used nslookup command in Windows:

nslookup sklyar.app 8.8.8.8

╤хЁтхЁ:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
╚ь :     sklyar.app
Address:  VPS IP Address

Also I checked the nameservers:

nslookup -q=ns sklyar.app 8.8.8.8

╤хЁтхЁ:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
example.com      nameserver = dns4.domainregistrar.com
example.com      nameserver = dns1.domainregistrar.com
example.com      nameserver = dns3.domainregistrar.com
example.com      nameserver = dns2.domainregistrar.com

This means that everything is alright, isn't it?
After that I connected to VPS via ssh. Then wrote the series of commands:

sudo apt update
sudo apt upgrade
sudo apt install nginx
sudo ufw allow 'Nginx Full'

Then I went to http://VPS IP Address and I saw NGINX starting page.
After that created a simple HTML:

sudo mkdir -p /var/www/example.com/html
sudo vim /var/www/example.com/html/index.html

In index.html I put:

        <title>Welcome to example.com!</title>

Success! The example.com server block is working!

Then I created NGINX file:

sudo vim /etc/nginx/sites-available/example.com

Where I put:

server {
    listen 80;
    listen [::]:80;

    root /var/www/example.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

    location / {
        try_files $uri $uri/ =404;
    }
}

After that I used:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo systemctl restart nginx

And when I go to http://example.com it gives me ERR_CONNECTION_REFUSED error.

I also tried changing the user in /etc/nginx/nginx.conf, setting this parameter: server_names_hash_bucket_size 64;, deploying a Flask app, using tutorial that worked for me on other registrars and VPS before.

What am I doing wrong? Help me please!


问:
imGoogleMaps, skip wrong address and continue loading markers on Map
I'm using the Google Maps JS API "imGoogleMaps". I get the error "Sorry, we are unable to gecode address: ..." and the Map stops loading (stays grey). Somebody knows how to skip this wrong address and continue loading the other addresses? </p>

<p>I want it to show a lot of markers (addresses) on a Map. It loads the addresses from a JSON file. </p>

Body:
I'm using the Google Maps JS API "imGoogleMaps". I get the error "Sorry, we are unable to gecode address: ..." and the Map stops loading (stays grey). Somebody knows how to skip this wrong address and continue loading the other addresses?

I want it to show a lot of markers (addresses) on a Map. It loads the addresses from a JSON file.


问:
Javascript - Upload multiple images and have a delete button
I'm working with python and flask to save my files, and to upload multiple images in js, with the preview and a delete button. When I click on the delete button, I want to delete a specific image. Currently, clicking on the delete button, deletes all.

This is the source code and I understand why the click deletes all.

```<code>let photo = document.getElementById('imgPhoto');
let file = document.getElementById('file-input');

photo.addEventListener('click', () => {
    file.click();
});

$(document).ready(function() {

    if (window.File && window.FileList && window.FileReader) {
        $("#file-input").on("change", function(e) {

            var files = e.target.files, filesLength = files.length;

            for (var i = 0; i < filesLength; i++) {

                var f = files[i]
                var fileReader = new FileReader();

                fileReader.onload = (function(e) {
                    var file = e.target;

                    $("<span class=\"pip\">" + "<img class=\"imageThumb\" src=\"" + e.target.result + "\" title=\"" + file.name + "\"/>" + "<br/><span class=\"remove\">Remover imagem</span>" +"</span>").insertAfter("#file-input");

                    $(".remove").click(function(){
                        $(this).parent(".pip").remove();
                        document.getElementById('file-input').value = "";
                    });
                });

                fileReader.readAsDataURL(f);
            }
        });
    }

});
</code>```

The result when uploaded

Body:
I'm working with python and flask to save my files, and to upload multiple images in js, with the preview and a delete button. When I click on the delete button, I want to delete a specific image. Currently, clicking on the delete button, deletes all.

This is the source code and I understand why the click deletes all.

let photo = document.getElementById('imgPhoto');
let file = document.getElementById('file-input');

photo.addEventListener('click', () => {
    file.click();
});

$(document).ready(function() {

    if (window.File && window.FileList && window.FileReader) {
        $("#file-input").on("change", function(e) {

            var files = e.target.files, filesLength = files.length;

            for (var i = 0; i < filesLength; i++) {

                var f = files[i]
                var fileReader = new FileReader();

                fileReader.onload = (function(e) {
                    var file = e.target;

                    $("" + "" + "
Remover imagem" +"").insertAfter("#file-input");

                    $(".remove").click(function(){
                        $(this).parent(".pip").remove();
                        document.getElementById('file-input').value = "";
                    });
                });

                fileReader.readAsDataURL(f);
            }
        });
    }

});

The result when uploaded


问:
Spring gateway server won't start - java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
I'm trying to learn about Spring Gateway (how it is put together, how it works).

I'm following this tutorial here, and I run into an issue as I try to run the server. I haven't even done anything specific yet, outside of what this tutorial shows.

There is no mention of that issue on it, and this didn't help my case.

I'm not sure what I'm missing as the issue I'm running into didn't seem to be common.

Any help would be appreciated.

Here is my pom.xml :

        <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.7.7</version>
            <relativePath/>
        </parent>
        <groupId>com.container</groupId>
        <artifactId>gateway</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>gateway</name>
        <description>Gateway</description>
        <properties>
            <java.version>11</java.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-webflux</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-gateway</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </dependency>
            <dependency>
                <groupId>io.projectreactor</groupId>
                <artifactId>reactor-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>

        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-gateway</artifactId>
                    <version>2.0.0.RC2</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
            <finalName>gateway-app</finalName>
        </build>
        <repositories>
            <repository>
                <id>spring-milestones</id>
                <name>Spring Milestones</name>
                <url>https://repo.spring.io/milestone</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
            <repository>
                <id>spring-snapshots</id>
                <name>Spring Snapshots</name>
                <url>https://repo.spring.io/snapshot</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>spring-milestones</id>
                <name>Spring Milestones</name>
                <url>https://repo.spring.io/milestone</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </pluginRepository>
            <pluginRepository>
                <id>spring-snapshots</id>
                <name>Spring Snapshots</name>
                <url>https://repo.spring.io/snapshot</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </pluginRepository>
        </pluginRepositories>

    </project>

```


问:
Why ngx-socket.io doesn't emit or get events, if the connection is correct?
My connection with the websocket server looks correct. I see the events on the browser, I can emit events from postman.

Browser WS view

But when I try to emmit or get events in Angular App, nothing happens, I don't know why.

WebsocketService:

```<code>import { Injectable } from '@angular/core';
import { Socket } from 'ngx-socket-io';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root',
})
export class WebsocketService {
  constructor(public socket: Socket) {}

  sendMessage(msg: any) {
    this.socket.emit('messageSendToUser', msg);
  }

  getMessages() {
    return this.socket.fromEvent('messages').pipe(map((data: any) => data));
  }
}
</code>```

App component:

```<code>export class AppComponent implements OnInit {
  constructor(private socket: WebsocketService) {}

  ngOnInit() {
    this.socket
      .getMessages()
      .subscribe((data) => console.log('messages', data));
  }

  useSocket() {
    this.socket.sendMessage(
      JSON.stringify({
        senderName: 'Angular app',
        targetUserName: 'postman',
        message: 'hello from angular',
      })
    );
  }
}
</code>```

Different configs that I tried on APP Module

```<code>import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';

const config: SocketIoConfig = {
  url: 'localhost:8878',
  options: { transports: ['websocket'] },
};

// const config: SocketIoConfig = {
//   url: 'ws://localhost:8878',
//   options: {},
// };

// const config: SocketIoConfig = {
//   url: 'http://localhost:8878',
//   options: { transports: ['websocket'] },
// };

// const config: SocketIoConfig = {
//   url: 'http://localhost:8878',
//   options: {},
// };

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, SocketIoModule.forRoot(config)],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}
</code>```

I want to create a websocket application to emit and get events.
I expect to emit the message. See the emit event on the browser and get it on my server (java with springboot and socket io server dependency that works correctly with postman)

Body:
My connection with the websocket server looks correct. I see the events on the browser, I can emit events from postman.

Browser WS view

But when I try to emmit or get events in Angular App, nothing happens, I don't know why.

WebsocketService:

import { Injectable } from '@angular/core';
import { Socket } from 'ngx-socket-io';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root',
})
export class WebsocketService {
  constructor(public socket: Socket) {}

  sendMessage(msg: any) {
    this.socket.emit('messageSendToUser', msg);
  }

  getMessages() {
    return this.socket.fromEvent('messages').pipe(map((data: any) => data));
  }
}

App component:

export class AppComponent implements OnInit {
  constructor(private socket: WebsocketService) {}

  ngOnInit() {
    this.socket
      .getMessages()
      .subscribe((data) => console.log('messages', data));
  }

  useSocket() {
    this.socket.sendMessage(
      JSON.stringify({
        senderName: 'Angular app',
        targetUserName: 'postman',
        message: 'hello from angular',
      })
    );
  }
}

Different configs that I tried on APP Module

import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';

const config: SocketIoConfig = {
  url: 'localhost:8878',
  options: { transports: ['websocket'] },
};

// const config: SocketIoConfig = {
//   url: 'ws://localhost:8878',
//   options: {},
// };

// const config: SocketIoConfig = {
//   url: 'http://localhost:8878',
//   options: { transports: ['websocket'] },
// };

// const config: SocketIoConfig = {
//   url: 'http://localhost:8878',
//   options: {},
// };

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, SocketIoModule.forRoot(config)],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}

I want to create a websocket application to emit and get events.
I expect to emit the message. See the emit event on the browser and get it on my server (java with springboot and socket io server dependency that works correctly with postman)