问:
How to add mask for angular material date range picker?
Hello I am using angular material date range picker. (angular material 14).

```<code> <mat-form-field appearance="fill">
      <mat-date-range-input [rangePicker]="picker" [max]="today">
        <input matStartDate [(ngModel)]="item.startValue" [placeholder]="'Of' | translate " #dateRangeStart
          (keypress)="validation($event, index)">
        <input matEndDate [(ngModel)]="item.endValue" [placeholder]="'Till' | translate" #dateRangeEnd
          (dateChange)="dateRangeChange(index)" (keypress)="validation($event, index)">
      </mat-date-range-input>
      <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
      <mat-date-range-picker #picker (closed)="afterClose(item, index)"></mat-date-range-picker>
    </mat-form-field>
</code>```

ts   file

```<code>validation(event: { which: number; keyCode: number; key: string }, index: number) {

if (this.filterList[index].validation) {
  const charCode = (event.which) ? event.which : event.keyCode;
  if (this.filterList[index].type == 'date') {
    const dateRegEx = new RegExp(/^\d{1,2}\.\d{1,2}\.\d{4}$/);
    return dateRegEx.test(this.filterList[index].startValue) ? null : { date: true }
  }
  if (eval(this.filterList[index].validation)) {
    return true;
  }

  return false;
}
</code>```

}

I want to  write only numbers  and  format should be  dd/mm/YYYY.
If  I choose date from  format is correct but when I writing on keyword and  write  to number it doesn't show me automatically '/'  character.
I have problem when I writing on keyboard,  date doesn't split  by /  If I unfocused input. Therefor I can write 1111111111111

Body:
Hello I am using angular material date range picker. (angular material 14).

 <mat-form-field appearance="fill">
      <mat-date-range-input [rangePicker]="picker" [max]="today">
        <input matStartDate [(ngModel)]="item.startValue" [placeholder]="'Of' | translate " #dateRangeStart
          (keypress)="validation($event, index)">
        <input matEndDate [(ngModel)]="item.endValue" [placeholder]="'Till' | translate" #dateRangeEnd
          (dateChange)="dateRangeChange(index)" (keypress)="validation($event, index)">
      </mat-date-range-input>
      <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
      <mat-date-range-picker #picker (closed)="afterClose(item, index)"></mat-date-range-picker>
    </mat-form-field>

ts   file

validation(event: { which: number; keyCode: number; key: string }, index: number) {

if (this.filterList[index].validation) {
  const charCode = (event.which) ? event.which : event.keyCode;
  if (this.filterList[index].type == 'date') {
    const dateRegEx = new RegExp(/^\d{1,2}\.\d{1,2}\.\d{4}$/);
    return dateRegEx.test(this.filterList[index].startValue) ? null : { date: true }
  }
  if (eval(this.filterList[index].validation)) {
    return true;
  }

  return false;
}

}

I want to  write only numbers  and  format should be  dd/mm/YYYY.
If  I choose date from  format is correct but when I writing on keyword and  write  to number it doesn't show me automatically '/'  character.
I have problem when I writing on keyboard,  date doesn't split  by /  If I unfocused input. Therefor I can write 1111111111111


来源: stackexchange

问:
Export appointment information in Exchange 2016 with Powershell over EWS to csv
I am trying to export Exchange appointment information of specific users as CSV in Powershell.
The script almost works (I can see required information).

But I got 2 problems:

Export to CSV does not work - I found some options I tried to adept, but failed (see below).

When an appointment has no Location set (=empty) I receive an error:

The script without CSV-Export looks like that:

```<code>$users = Get-ADGroupmember -Identity "GR_Test" -Recursive | Get-ADUser

foreach ($user in $users) {

$StartDate = new-object System.DateTime(2022, 01, 01)
$EndDate = new-object System.DateTime(2022, 12, 31)

$dllpath = "C:\Install\Microsoft.Exchange.WebServices.dll"
[void][Reflection.Assembly]::LoadFile($dllpath)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016_SP1)

$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind

$service.AutodiscoverUrl($aceuser.mail.ToString())

$folderid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,($user.UserPrincipalNAme))
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate)
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
foreach ($apApointment in $frCalendarResult.Items){
     $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
     $apApointment.load($psPropset)
    "Appointment : " + $apApointment.Subject.ToString()
    "Start : " + $apApointment.Start.ToString()
    "End : " + $apApointment.End.ToString()
    "Organizer : " + $apApointment.Organizer.ToString()
    "Location : " + $apApointment.Location.ToString()
    "Required Attendees :"
    foreach($attendee in $apApointment.RequiredAttendees){
        "   " + $attendee.Address
    }
    "Optional Attendees :"
     foreach($attendee in $apApointment.OptionalAttendees){
        "   " + $attendee.Address
     }
    "Resources :"
     foreach($attendee in $apApointment.Resources){
        "   " + $attendee.Address
     }
    " "
}
}
</code>```

First try was to use Out-File within the array with -append:

I set it before the last bracket like this:

```<code>Out-file appointments.csv -Append }
}
</code>```

I got no result (empty).

Second try was the same with Export-CSV

```<code>Export-Csv -Path c:\temp\calender.csv -NoTypeInformation -Append}
}
</code>```

in this case script stops asking for "InputObject"

```<code>Supply values for the following parameters:
InputObject:
</code>```

Another try was to "put" the whole array in $output variable and export it.

```<code>$users = Get-ADGroupmember -Identity "GR_Test" -Recursive | Get-ADUser

$Output = foreach ($user in $users) {

$StartDate = new-object System.DateTime(2022, 01, 01)
$EndDate = new-object System.DateTime(2022, 12, 31)

$dllpath = "C:\Install\Microsoft.Exchange.WebServices.dll"
[void][Reflection.Assembly]::LoadFile($dllpath)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016_SP1)

$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind

$service.AutodiscoverUrl($aceuser.mail.ToString())

$folderid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,($user.UserPrincipalNAme))
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate)
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
foreach ($apApointment in $frCalendarResult.Items){
     $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
     $apApointment.load($psPropset)
    "Appointment : " + $apApointment.Subject.ToString()
    "Start : " + $apApointment.Start.ToString()
    "End : " + $apApointment.End.ToString()
    "Organizer : " + $apApointment.Organizer.ToString()
    "Location : " + $apApointment.Location.ToString()
    "Required Attendees :"
    foreach($attendee in $apApointment.RequiredAttendees){
        "   " + $attendee.Address
    }
    "Optional Attendees :"
     foreach($attendee in $apApointment.OptionalAttendees){
        "   " + $attendee.Address
     }
    "Resources :"
     foreach($attendee in $apApointment.Resources){
        "   " + $attendee.Address
     }
    " "
}
}

$Output | Export-Csv -Path c:\temp\calender.csv -NoTypeInformation
</code>```

In this case I got incomprehensible output like this:

```<code>"Length"
"52"
"27"
"25"
"57"
"20"
"20"
"11"
"1"
</code>```

Thanks for any help!

ContentLicense: CC BY-SA 4.0

Body:
I am trying to export Exchange appointment information of specific users as CSV in Powershell.
The script almost works (I can see required information).

But I got 2 problems:

Export to CSV does not work - I found some options I tried to adept, but failed (see below).

When an appointment has no Location set (=empty) I receive an error:

The script without CSV-Export looks like that:

$users = Get-ADGroupmember -Identity "GR_Test" -Recursive | Get-ADUser

foreach ($user in $users) {

$StartDate = new-object System.DateTime(2022, 01, 01)
$EndDate = new-object System.DateTime(2022, 12, 31)

$dllpath = "C:\Install\Microsoft.Exchange.WebServices.dll"
[void][Reflection.Assembly]::LoadFile($dllpath)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016_SP1)

$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind

$service.AutodiscoverUrl($aceuser.mail.ToString())

$folderid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,($user.UserPrincipalNAme))
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate)
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
foreach ($apApointment in $frCalendarResult.Items){
     $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
     $apApointment.load($psPropset)
    "Appointment : " + $apApointment.Subject.ToString()
    "Start : " + $apApointment.Start.ToString()
    "End : " + $apApointment.End.ToString()
    "Organizer : " + $apApointment.Organizer.ToString()
    "Location : " + $apApointment.Location.ToString()
    "Required Attendees :"
    foreach($attendee in $apApointment.RequiredAttendees){
        "   " + $attendee.Address
    }
    "Optional Attendees :"
     foreach($attendee in $apApointment.OptionalAttendees){
        "   " + $attendee.Address
     }
    "Resources :"
     foreach($attendee in $apApointment.Resources){
        "   " + $attendee.Address
     }
    " "
}
}

First try was to use Out-File within the array with -append:

I set it before the last bracket like this:

Out-file appointments.csv -Append }
}

I got no result (empty).

Second try was the same with Export-CSV

Export-Csv -Path c:\temp\calender.csv -NoTypeInformation -Append}
}

in this case script stops asking for "InputObject"

Supply values for the following parameters:
InputObject:

Another try was to "put" the whole array in $output variable and export it.

$users = Get-ADGroupmember -Identity "GR_Test" -Recursive | Get-ADUser

$Output = foreach ($user in $users) {

$StartDate = new-object System.DateTime(2022, 01, 01)
$EndDate = new-object System.DateTime(2022, 12, 31)

$dllpath = "C:\Install\Microsoft.Exchange.WebServices.dll"
[void][Reflection.Assembly]::LoadFile($dllpath)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016_SP1)

$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind

$service.AutodiscoverUrl($aceuser.mail.ToString())

$folderid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,($user.UserPrincipalNAme))
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDate)
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
foreach ($apApointment in $frCalendarResult.Items){
     $psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
     $apApointment.load($psPropset)
    "Appointment : " + $apApointment.Subject.ToString()
    "Start : " + $apApointment.Start.ToString()
    "End : " + $apApointment.End.ToString()
    "Organizer : " + $apApointment.Organizer.ToString()
    "Location : " + $apApointment.Location.ToString()
    "Required Attendees :"
    foreach($attendee in $apApointment.RequiredAttendees){
        "   " + $attendee.Address
    }
    "Optional Attendees :"
     foreach($attendee in $apApointment.OptionalAttendees){
        "   " + $attendee.Address
     }
    "Resources :"
     foreach($attendee in $apApointment.Resources){
        "   " + $attendee.Address
     }
    " "
}
}

$Output | Export-Csv -Path c:\temp\calender.csv -NoTypeInformation

In this case I got incomprehensible output like this:

"Length"
"52"
"27"
"25"
"57"
"20"
"20"
"11"
"1"

Thanks for any help!


问:
A method other than client library to run a custom scheduler in kubernetes
I would like to run a custom scheduler parallel with default scheduler in kubernetes control plane but NOT through client libraries like python or java.
Since scheduler should be able to watch the API server, I am not sure how to do it. In python-client library function watch.Watch() is responsible to contact the API server but as I said, I wouldn't use client library. Is there any option to do it?


问:
Traverse to child dependency in .net
Traverse through records in array  & find out circular dependency. below are some example. add category for record. solution need in c# language

Circular dependency example:

A-> B -> C -> D -> A

A1-> A2->A1

Input :-

```<code> {
  "stories": [
    {
      "storyId": "A",
      "storyDependentOn": [
        "B"
      ]
    },
    {
      "storyId": "B",
      "storyDependentOn": [
        "C",
        "E"
      ]
    },
    {
      "storyId": "C",
      "storyDependentOn": [
        "D",
        "F"
      ]
    },
    {
      "storyId": "D",
      "storyDependentOn": [
        "A"
      ]
    },
    {
      "storyId": "E",
      "storyDependentOn": [
        "F"
      ]
    },
    {
      "storyId": "F",
      "storyDependentOn": [
        ""
      ]
    }
  ]
}
</code>```

As "A","B", "C", "D" involve in circular dependency.
"E" , "F" don't have any circular dependency category field will not add

Expected Result

```<code>{
  "stories": [
    {
      "storyId": "A",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "B",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "C",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "D",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "E",
      "categories": []
    },
    {
      "storyId": "F",
      "categories": [
        ""
      ]
    }
  ]
}
</code>```

`

Title: Traverse to child dependency in .net

Body:
Traverse through records in array  & find out circular dependency. below are some example. add category for record. solution need in c# language

Circular dependency example:

A-> B -> C -> D -> A

A1-> A2->A1

Input :-

 {
  "stories": [
    {
      "storyId": "A",
      "storyDependentOn": [
        "B"
      ]
    },
    {
      "storyId": "B",
      "storyDependentOn": [
        "C",
        "E"
      ]
    },
    {
      "storyId": "C",
      "storyDependentOn": [
        "D",
        "F"
      ]
    },
    {
      "storyId": "D",
      "storyDependentOn": [
        "A"
      ]
    },
    {
      "storyId": "E",
      "storyDependentOn": [
        "F"
      ]
    },
    {
      "storyId": "F",
      "storyDependentOn": [
        ""
      ]
    }
  ]
}

As "A","B", "C", "D" involve in circular dependency.
"E" , "F" don't have any circular dependency category field will not add

Expected Result

{
  "stories": [
    {
      "storyId": "A",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "B",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "C",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "D",
      "categories": [
        {
          "categoryId": "3",
          "name": "Circular dependency"
        }
      ]
    },
    {
      "storyId": "E",
      "categories": []
    },
    {
      "storyId": "F",
      "categories": [
        ""
      ]
    }
  ]
}

`


问:
Next.js fetching image link from a database and the image is missing
i have images in my project, and i fetching the url of the images from my database.
then display the images in component.
but for some reason the images dispalyed in my localhost fine.
but in deployment the images are missing.

this is the error:

GET https://lior-malul-trainer.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Ftrx.19166871.png&w=2048&q=75 404

i tried to use the img element and the Image element by next.js, both dosent work.


问:
Apscheduler how synchronize to specific time
this is my challenge : I've a service that write a respose like this when get:

['1670182568','00001', 'ON', '1670182572', '0.35', 'sensor1']
The first element (1670182568) is the current time in unix format and 1670182572 is the future time that the sensor will update the value (0.35). So, you suppose that you get this url every second , the 1670182568  will increment by 1 second until current time is will be equal to the  future time, in this moment the value of sensore will be updated and  the 1670182572 incremet of a specific amount of second that depends of kind of sensor. ( mybe sensor update data after  2 seconds )

I would like set my start time of schedlue exatly on 1670182568 and to be secured that is synchronized with the current timer , because it can happen than the job scheduled cant'be able to get the updated value and the lose the value.

In this scenario , for example, how can i synchronize the scheduler exactly with the time? I try for every 1 second get the new current time and every 2 second update with the next_run_time the new schedule but it is not always synchronized perfectly.

Sorry for my bad english , i hope that it is clear my scope. thanks in advance for any help.

```<code>async def fetch(url):
    sem = asyncio.Semaphore(100)
    async with aiohttp.ClientSession() as session:
        async with sem, session.get(url) as resp:
            Response = await resp.read()
        return  Response
JobCycle = 0
def job():

    Result =asyncio.run(fetch(url))
    Current_Time_Unix=Result[0]
    tz = tzlocal.get_localzone()
    Current_Time_Data= datetime.fromtimestamp(int(Current_Time_Unix),tz)

    first_run_time =Current_Time_Data
    if JobCycle == 1:

        JobCycle = 0

        refreshed = []
        for job in scheduler.get_jobs():
            print(job.name , job.id)
            if job.name == "Main_JOB":
                scheduler.modify_job(job_id='Main_JOB',next_run_time=first_run_time)
                Jobrefreshed= json.dumps( {'number': len(scheduler.get_jobs()), 'list': refreshed} )
                print(Jobrefreshed)
            else:
                continue

def schedule_task():

    Result =asyncio.run(fetch(url))

    Current_Time_Unix=Result[0]
    tz = tzlocal.get_localzone()
    Current_Time_Data= datetime.fromtimestamp(int(Current_Time_Unix),tz)
    first_run_time =Current_Time_Data

    print(f'Start time: {first_run_time}')
    #

    scheduler.add_job(
        job,
        trigger='interval',
        seconds=1,
        next_run_time=first_run_time,
        name="Main_JOB",
        id='Main_JOB'
    )

    scheduler.start()

schedule_task()

</code>```

Body:
this is my challenge : I've a service that write a respose like this when get:

['1670182568','00001', 'ON', '1670182572', '0.35', 'sensor1']
The first element (1670182568) is the current time in unix format and 1670182572 is the future time that the sensor will update the value (0.35). So, you suppose that you get this url every second , the 1670182568  will increment by 1 second until current time is will be equal to the  future time, in this moment the value of sensore will be updated and  the 1670182572 incremet of a specific amount of second that depends of kind of sensor. ( mybe sensor update data after  2 seconds )

I would like set my start time of schedlue exatly on 1670182568 and to be secured that is synchronized with the current timer , because it can happen than the job scheduled cant'be able to get the updated value and the lose the value.

In this scenario , for example, how can i synchronize the scheduler exactly with the time? I try for every 1 second get the new current time and every 2 second update with the next_run_time the new schedule but it is not always synchronized perfectly.

Sorry for my bad english , i hope that it is clear my scope. thanks in advance for any help.

async def fetch(url):
    sem = asyncio.Semaphore(100)
    async with aiohttp.ClientSession() as session:
        async with sem, session.get(url) as resp:
            Response = await resp.read()
        return  Response
JobCycle = 0
def job():

    Result =asyncio.run(fetch(url))
    Current_Time_Unix=Result[0]
    tz = tzlocal.get_localzone()
    Current_Time_Data= datetime.fromtimestamp(int(Current_Time_Unix),tz)

    first_run_time =Current_Time_Data
    if JobCycle == 1:

        JobCycle = 0

        refreshed = []
        for job in scheduler.get_jobs():
            print(job.name , job.id)
            if job.name == "Main_JOB":
                scheduler.modify_job(job_id='Main_JOB',next_run_time=first_run_time)
                Jobrefreshed= json.dumps( {'number': len(scheduler.get_jobs()), 'list': refreshed} )
                print(Jobrefreshed)
            else:
                continue

def schedule_task():

    Result =asyncio.run(fetch(url))

    Current_Time_Unix=Result[0]
    tz = tzlocal.get_localzone()
    Current_Time_Data= datetime.fromtimestamp(int(Current_Time_Unix),tz)
    first_run_time =Current_Time_Data

    print(f'Start time: {first_run_time}')
    #

    scheduler.add_job(
        job,
        trigger='interval',
        seconds=1,
        next_run_time=first_run_time,
        name="Main_JOB",
        id='Main_JOB'
    )

    scheduler.start()

schedule_task()


问:
Blazor Server Entity Framework Core: data column encryption not working
I'm trying to make my user data more secure by encrypting sensitive data like Firstname and Lastname of a client. But when I use the following code from medium and update my database, the data doesn't get encrypted after adding an new client.

Source:

https://medium.com/emrekizildas/encrypt-your-database-columns-with-entityframework-1f129b19bdf8

Other suggestions for encrypting data are also welcome!

These are the things I tried:

Updating from .NET Core 3.1 to .NET 5.0 and changing package version

Creating 128bit key instead of "test123456"

AesEncryption: https://github.com/Eastrall/EntityFrameworkCore.DataEncryption

Model/DbContext:

```<code>using EntityFrameworkCore.EncryptColumn;
using EntityFrameworkCore.EncryptColumn.Extension;
using EntityFrameworkCore.EncryptColumn.Interfaces;
using EntityFrameworkCore.EncryptColumn.Util;
using Globals.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;

private readonly IEncryptionProvider _provider;

public Model()
{
    Initialize.EncryptionKey = "test123456";
    this._provider = new GenerateEncryptionProvider();
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.UseEncryption(this._provider);
}
</code>```

Example entity:

```<code>using EntityFrameworkCore.EncryptColumn.Attribute;

namespace Globals.Entities
{
    public class Client
    {
        [Key]
        [Required]
        public int Id { get; set; }

        [EncryptColumn]
        public string FirstName { get; set; }

        [EncryptColumn]
        public string LastName { get; set; }

        public Client(string firstName, string lastName)
        {
            FirstName = firstName;
            LastName = lastName;
        }
    }
}
</code>```

Commands for reinstalling the database:

```<code>drop-database
remove-migration
add-migration initialCreate
update-database
</code>```

Body:
I'm trying to make my user data more secure by encrypting sensitive data like Firstname and Lastname of a client. But when I use the following code from medium and update my database, the data doesn't get encrypted after adding an new client.

Source:

https://medium.com/emrekizildas/encrypt-your-database-columns-with-entityframework-1f129b19bdf8

Other suggestions for encrypting data are also welcome!

These are the things I tried:

Updating from .NET Core 3.1 to .NET 5.0 and changing package version

Creating 128bit key instead of "test123456"

AesEncryption: https://github.com/Eastrall/EntityFrameworkCore.DataEncryption

Model/DbContext:

using EntityFrameworkCore.EncryptColumn;
using EntityFrameworkCore.EncryptColumn.Extension;
using EntityFrameworkCore.EncryptColumn.Interfaces;
using EntityFrameworkCore.EncryptColumn.Util;
using Globals.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;

private readonly IEncryptionProvider _provider;

public Model()
{
    Initialize.EncryptionKey = "test123456";
    this._provider = new GenerateEncryptionProvider();
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.UseEncryption(this._provider);
}

Example entity:

using EntityFrameworkCore.EncryptColumn.Attribute;

namespace Globals.Entities
{
    public class Client
    {
        [Key]
        [Required]
        public int Id { get; set; }

        [EncryptColumn]
        public string FirstName { get; set; }

        [EncryptColumn]
        public string LastName { get; set; }

        public Client(string firstName, string lastName)
        {
            FirstName = firstName;
            LastName = lastName;
        }
    }
}

Commands for reinstalling the database:

drop-database
remove-migration
add-migration initialCreate
update-database


问:
Unable to access Plesk
I start to using the plesk with trial. But when I entered new key, I got this error:

The license key is invalid. In order to use Plesk, please obtain and install a new valid license key. The amount of currently used resources exceeds the limits defined by your license. The number of websites hosted on the server exceeds the limits defined by your license. You have 4 sites hosted; your license allows hosting only 3 sites.

I know what is that mean, but I didnt see my panel so I can delete the 1 domain to open it.
So I tried this command in CLI:
/usr/local/psa/bin/domain --remove [domainname.com]

And still show me same error, How can I delete the domain from my server? (With CLI)

Title: Unable to access Plesk


问:
Blazor component that render Reactjs component
I wish to make Blazor component. That i would use in few places on Blazor Page
`

```<code><div class="form-grid">
    <DatePicker Id="datepicker_1" />
    <DatePicker Id="datepicker_2" />
</div>
</code>```

DatePicker.razor

```<code><div id="@Id"></div>
</code>```

DatePicker.razor.cs

```<code>protected override async Task OnAfterRenderAsync(bool firstRender)
{
        try
        {
            await _js.InvokeVoidAsync("loadScript", "js/app.bundle.js");
            await _js.InvokeVoidAsync("App.renderDatePicker",Id);
        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }

}
</code>```

It render React in first component but on the other is feiling withError: Could not find 'App.renderText' ('renderText' was undefined).`
Any ideas how to get it work ?

I tried to send reference in sted for Id.
I know that i can render react component directly on page without blazor component.
I delayed script loading but then it is rulet if it is working. and it trow a exception from time to time.

Body:
I wish to make Blazor component. That i would use in few places on Blazor Page
`

    <DatePicker Id="datepicker_1" />
    <DatePicker Id="datepicker_2" />

DatePicker.razor

DatePicker.razor.cs

protected override async Task OnAfterRenderAsync(bool firstRender)
{
        try
        {
            await _js.InvokeVoidAsync("loadScript", "js/app.bundle.js");
            await _js.InvokeVoidAsync("App.renderDatePicker",Id);
        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }

}

It render React in first component but on the other is feiling withError: Could not find 'App.renderText' ('renderText' was undefined).`
Any ideas how to get it work ?

I tried to send reference in sted for Id.
I know that i can render react component directly on page without blazor component.
I delayed script loading but then it is rulet if it is working. and it trow a exception from time to time.


问:
Allow multiple slashes in an AngularJS parameter
I have a URL like this: https://example.com/display/this/is/a/single/parameter

I want this/is/a/single/parameter to be treated as a single parameter. The path is /display/.

```<code>export default function routes($stateProvider) {
    $stateProvider
        .state('app.display', {
            url: '/display/:parameter',
            templateUrl: templateDisplayUrl,
            controller: 'DisplayController',
            controllerAs: 'displayCtrl'
        })
    ;
}
</code>```

This doesn't match the example URL. It can only match parameters that don't include slashes. I've also tried url: '/display/:parameter*', and url: '/display/*', (not capturing the parameter) with the same results.

How can I match any number of slashes inside an AngularJS parameter?

I've got it working with:

```<code>export default function routes($stateProvider) {
    $stateProvider
        .state('app.display', {
            url: '/display/:a/:b/:c/:d/:e/:f/:g/:h/:i/:j/:k/:l',
            templateUrl: templateDisplayUrl,
            controller: 'DisplayController',
            controllerAs: 'displayCtrl',
            params: {
                a: {squash: true, value: null},
                b: {squash: true, value: null},
                c: {squash: true, value: null},
                d: {squash: true, value: null},
                e: {squash: true, value: null},
                f: {squash: true, value: null},
                g: {squash: true, value: null},
                h: {squash: true, value: null},
                i: {squash: true, value: null},
                j: {squash: true, value: null},
                k: {squash: true, value: null},
                l: {squash: true, value: null}
            }
        })
    ;
}
</code>```

but that is not a great solution. Can it be simplified and handle any number of slashes instead of a maximum number?

Body:
I have a URL like this: https://example.com/display/this/is/a/single/parameter

I want this/is/a/single/parameter to be treated as a single parameter. The path is /display/.

export default function routes($stateProvider) {
    $stateProvider
        .state('app.display', {
            url: '/display/:parameter',
            templateUrl: templateDisplayUrl,
            controller: 'DisplayController',
            controllerAs: 'displayCtrl'
        })
    ;
}

This doesn't match the example URL. It can only match parameters that don't include slashes. I've also tried url: '/display/:parameter*', and url: '/display/*', (not capturing the parameter) with the same results.

How can I match any number of slashes inside an AngularJS parameter?

I've got it working with:

export default function routes($stateProvider) {
    $stateProvider
        .state('app.display', {
            url: '/display/:a/:b/:c/:d/:e/:f/:g/:h/:i/:j/:k/:l',
            templateUrl: templateDisplayUrl,
            controller: 'DisplayController',
            controllerAs: 'displayCtrl',
            params: {
                a: {squash: true, value: null},
                b: {squash: true, value: null},
                c: {squash: true, value: null},
                d: {squash: true, value: null},
                e: {squash: true, value: null},
                f: {squash: true, value: null},
                g: {squash: true, value: null},
                h: {squash: true, value: null},
                i: {squash: true, value: null},
                j: {squash: true, value: null},
                k: {squash: true, value: null},
                l: {squash: true, value: null}
            }
        })
    ;
}

but that is not a great solution. Can it be simplified and handle any number of slashes instead of a maximum number?


问:
Three.js Curve Modifier issue
Image showing an example

Link to CodePen: [https://codepen.io/Aleks0/pen/wvXZvYB]

I'm trying to make my Box move from point A to point B along a curve and stop at the end.

But Box is smaller than the original size and there is some kind of glitch during movement, does anyone know how to fix this?

Thanks!

Title: Three.js Curve Modifier issue


问:
STM32 Multiple Timer Clock Configuration for PWM Generation and Timer Source Delay Function
I try to temperature control with close loop control system. I use dımmer circuit for control my AC heater. Dimmer circuit has a psm pin for current based heat control. For use the psm control i set my APB1 timer source 16 MHz. I use DS18B20 sensor for temperature sensing. This sensor work with 1 wire communucation protocol. In this protocol works with special delay function that;

```<code>void delay (uint16_t time)
{

    __HAL_TIM_SET_COUNTER(&htim6, 0);
    while ((__HAL_TIM_GET_COUNTER(&htim6))<time);
}
</code>```

As you see in this code, delay function works timer clock source based.

When i use DS18B20 sensor and dimmer circuit in same time , sensor data return incorrect values after 40 celcius degree.
When i set my clock source 52 MHz , sensor works correctly but dimmer psm signal is not work.
How can i set multiple timer clock source? If i can't, how can i solve this problem?

p.s.
I drive dimmer circuit with send PWM signal from my timer to circuit PSM input .

I try to set my timmer clock source the different values and i read sensor's datasheet.
This is link of DS18B20 temp. sensors datasheet .
https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf

Thanks for help...

Body:
I try to temperature control with close loop control system. I use dımmer circuit for control my AC heater. Dimmer circuit has a psm pin for current based heat control. For use the psm control i set my APB1 timer source 16 MHz. I use DS18B20 sensor for temperature sensing. This sensor work with 1 wire communucation protocol. In this protocol works with special delay function that;

void delay (uint16_t time)
{

    __HAL_TIM_SET_COUNTER(&htim6, 0);
    while ((__HAL_TIM_GET_COUNTER(&htim6))<time);
}

As you see in this code, delay function works timer clock source based.

When i use DS18B20 sensor and dimmer circuit in same time , sensor data return incorrect values after 40 celcius degree.
When i set my clock source 52 MHz , sensor works correctly but dimmer psm signal is not work.
How can i set multiple timer clock source? If i can't, how can i solve this problem?

p.s.
I drive dimmer circuit with send PWM signal from my timer to circuit PSM input .

I try to set my timmer clock source the different values and i read sensor's datasheet.
This is link of DS18B20 temp. sensors datasheet .
https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf

Thanks for help...


问:
How can I fix java.sql.SQLException: Value 14:50 cannot be converted to INTEGER error?
I want to list my data on a grid and I used hibernate for it on Java. But my code doesn't work and I get error. When I run my SQL script it works. I think there is an error on my code and there isn't an error on my SQL script. Code blocks and error screenshot is below. How can I fix it ?

DaoImp.java:

```<code>@Override public DealResponse radyolojiSorgulamaListesiAlt(List<BaseFilter> prmFilter, Integer start, Integer limit) {
        //sysFunc.writeDealLog_Start(new DealLog(_projeEnum.LogLevel.StartMethod, "tr.com.metasoft.deal.dao.sbs", "SbsIstemFisHastaDaoImpl", "istemHastaSiraListesi"));
        DealResponse response = new DealResponse();
        try {

            List<PatolojiSorusturmaUI> liste =new ArrayList<>();
            List<PatolojiSorusturmaUI> listeCount = new ArrayList<>();

            StringBuilder sqlAna = new StringBuilder();
            sqlAna.append(
                    "select dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT)   as hstGelisSaati,\n" +
                            "hrk.ISTEM_DURUM as istemDurum,\n" +
                            "ACCESSION_NUMBER as accessionNumber,\n" +
                            "srck.RC_CIHAZ AS rcCihaz,srck.RC_CIHAZ_SEVK as rcSevkDurum,\n" +
                            "sd.DOKTOR_AD + ' '  + sd.DOKTOR_SOYAD  as cekimYapan,\n" +
                            "sifh.HASTA_GELIS_TRH as hstGelisTrh,\n" +
                            "dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT) as hstGelisSaat,\n" +
                            "SBS_SAGLIK_RAPOR_ID as sbsSaglikRaporId,\n" +
                            "hrk.ISTSH_TRH  as sevkistemTrh,\n" +
                            "hrk.KABUL_TRH   as sevkkabulTrh,\n" +
                            "dbo.IntegerIntoTime(hrk.ISTSH_ISLEM_SAAT)  as sevkistemSaat,\n" +
                            "dbo.IntegerIntoTime(hrk.KABUL_SAAT )  as sevkkabulSaat,\n" +
                            "hrk.SEVK_ID as sevkId,NULL as teknisyen,\n" +
                            "hzm.HIZMET_SUT_KODU as Butce_Kodu,\n" +
                            "hzm.HIZMET_SUT_TANIMI as Butce_Tanimi,\n" +
                            "hrk.ISTSH_ID AS istem_Id\n"+

                            "from SBS_ISTEM_FIS  as sif  with(nolock)\n" +
                            "inner join SBS_ISTEM_FIS_HASTA as sifh with(nolock) on sif.ISTEM_FS_ID=sifh.SBS_ISTEM_FIS_ID and isnull(sif.PSF_ID,0)=0\n" +
                            "inner join SBS_ISTEM_HAREKET as hrk with(nolock) on sif.ISTEM_FS_ID=hrk.ISTEM_FIS_ID and isnull(hrk.PSF_ID,0)=0\n" +
                            "inner join SBS_ISTEM_FIS as siff        with(nolock) on siff.ISTEM_FS_ID=hrk.ISTEM_FIS_ID and (isnull(siff.PSF_ID,0)=0)\n" +
                            "inner join STOK_KART_HIZMET as hzm with(nolock) on hrk.ISTSH_STOKKART_ID = hzm.STOK_ID and (isnull(hzm.PSF_ID,0)=0)\n" +
                            "left join SBS_DOKTOR as sd with(nolock) on SD.KIMLIK_ID = HRK.UYGULAYACAK_HEKIM_KIMLIK_ID and (isnull(hzm.PSF_ID,0)=0)\n" +
                            "left join TUR_DETAY AS TD WITH(NOLOCK) ON TD.TUR_DETAY_ID=SD.CALISMA_TURU AND ISNULL(TD.PSF_ID,0)=0 AND (TD.TUR_DEGER_KOD='DISHEKIMI' or TD.TUR_DEGER_KOD='HEKIM')\n" +
                            "inner join SBS_HASTA  as hst with(nolock) on hst.HASTA_KIMLIK_ID=sifh.HASTA_KIMLIK_ID and isnull(hst.PSF_ID,0)=0\n" +
                            "inner join  KIMLIK as k  with(nolock) on   k.KIMLIK_ID =sifh.HASTA_KIMLIK_ID  and  isnull(k.PSF_ID,0)=0\n" +
                            "left join TUR_DETAY as tdc  with(nolock) on k.CINSIYET_TUR_ID = tdc.TUR_DETAY_ID  and  isnull(tdc.PSF_ID,0)=0\n" +
                            "left join SBS_GIZLI_HASTA as gh ON gh.TC_KIMLIK_NO = sifh.KIMLIK_TC_NO and (GETDATE() BETWEEN gh.MAHKEME_TARIHI AND hst.GIZLILIK_BITIS_TARIH) and ISNULL(gh.PSF_ID,0) = 0\n" +
                            "left join BIRIM as b  with(nolock)  on b.BIRIM_ID = sifh.HASTA_SERVIS_ID and isnull(b.PSF_ID,0)=0\n" +
                            "left join SBS_KLINIK as klinik  with(nolock) on b.BIRIM_ID = klinik.BIRIM_ID and isnull(klinik.PSF_ID,0)=0\n" +
                            "left join SBS_KLINIK_UST as ust  with(nolock) on klinik.KLINIK_UST_ID = ust.KLINIK_UST_ID and (ISNULL(ust.PSF_ID,0)=0)\n" +
                            "left join TUR_DETAY as klinikTur  with(nolock) on klinik.KLINIK_TUR_ID = klinikTur.TUR_DETAY_ID and isnull(klinikTur.PSF_ID,0)=0\n" +
                            "left join CARI_KURUM_TUR as ck  with(nolock) on  sifh.HASTA_KURUM_TUR_ID  = ck.KURUM_TUR_ID and isnull(ck.PSF_ID,0)=0\n" +
                            "left join CARI_KART as cari  with(nolock) on sifh.HASTA_KURUM_ID = cari.CARI_KART_ID and isnull(cari.PSF_ID,0)=0\n" +
                            "left join SBS_SIRA_TUR as siraTur  with(nolock)on hst.SIRA_TUR_ID = siraTur.SBS_SIRA_TUR_ID and isnull(siraTur.PSF_ID,0)=0\n" +
                            "left join BIRIM as br on br.BIRIM_ID =sif.ISTEM_FS_ISTEM_YAPAN_BIRIM_ID\n" +
                            "left join BIRIM as ustBirim on ustBirim.BIRIM_ID =br.UST_BIRIM_ID\n" +
                            "left join KAYIT_DURUM as tdKayitDurum with(nolock) on tdKayitDurum.KAYIT_DURUM_ID=hrk.ISTSH_KAYIT_DURUM_ID   and isnull(tdKayitDurum.PSF_ID,0)=0\n" +
                            "left join SBS_RONTGEN_CIHAZ as srck with(nolock) on srck.SBS_RONTGEN_CIHAZ_ID=hrk.RONTGEN_CIHAZ_ID  and isnull(srck.PSF_ID,0)=0\n" +
                            "left join BIRIM as rontgenBirim on  srck.RC_CIHAZ_SRVNO= rontgenBirim.BIRIM_ID\n" +
                            "left join BIRIM rontgenUstBirim on rontgenBirim.UST_BIRIM_ID =rontgenUstBirim.BIRIM_ID and rontgenUstBirim.BIRIM_ID =ustBirim.BIRIM_ID\n" +
                            "where (isnull(hrk.PSF_ID,0)=0)\n" +
                            "and (isnull(sifh.PSF_ID,0)=0)\n" +
                            "and  hzm.HIZMET_TUR  &4 =4\n");

            if (sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_GELIS_TRH >= '"+(sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_GELIS_TRH <= '"+(sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.KIMLIK_TC_NO = '"+(sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_SERVIS_AD = '"+(sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HEKIM_AD_SOYAD = '"+(sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue != "") {
                sqlAna.append( " and hst.HASTA_KODU = '"+(sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            sqlAna.append("group by sifh.HASTA_KIMLIK_ID," + " \n" );
            sqlAna.append("sifh.HASTA_GELIS_ID," + " \n");
            sqlAna.append("sifh.HST_GELIS_KOD," + " \n" );
            sqlAna.append("sifh.HASTA_AD_SOYAD,"  + " \n");
            sqlAna.append("hst.HASTA_KODU,"  + " \n");
            sqlAna.append("(sd.DOKTOR_AD +' ' + sd.DOKTOR_SOYAD),"  + " \n");
            sqlAna.append("(b.BIRIM_AD),"  + " \n");
            sqlAna.append("sifh.KIMLIK_TC_NO,"  + " \n");
            sqlAna.append("ck.KURUM_TUR_TANIM,"  + " \n");
            sqlAna.append("sifh.HASTA_KURUM_TUR_ID,"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT),"  + " \n");
            sqlAna.append("cari.CARI_KART_ADI,"  + " \n");
            sqlAna.append("cari.CARI_KART_ADI,"  + " \n");
            sqlAna.append("klinikTur.TUR_DEGER_KOD,"  + " \n");
            sqlAna.append("hst.SIRA_TUR_ID,"  + " \n");
            sqlAna.append("siraTur.Ad,"  + " \n");
            sqlAna.append("gh.HASTA_RUMUZ,"  + " \n");
            sqlAna.append("hst.GIZLILIK_BITIS_TARIH,"  + " \n");
            sqlAna.append("b.BIRIM_ID,"  + " \n");
            sqlAna.append("sd.KIMLIK_ID,"  + " \n");
            sqlAna.append("convert(date ,sif.ISTEM_FS_TRH ,102),"  + " \n");
            sqlAna.append("hrk.ISTEM_DURUM,"  + " \n");
            sqlAna.append("cast(convert(date,sifh.KIMLIK_DOGUM_TRH,102) as nvarchar), "  + " \n");
            sqlAna.append("ACCESSION_NUMBER,"  + " \n");
            sqlAna.append("srck.RC_CIHAZ,"  + " \n");
            sqlAna.append("srck.RC_CIHAZ_SEVK,"  + " \n");
            sqlAna.append("sd.DOKTOR_AD + ' '  + sd.DOKTOR_SOYAD,"  + " \n");
            sqlAna.append("sifh.HASTA_GELIS_TRH,"  + " \n");
            sqlAna.append("sif.ISTEM_FS_SAAT,"  + " \n");
            sqlAna.append("SBS_SAGLIK_RAPOR_ID,"  + " \n");
            sqlAna.append("hrk.ISTSH_TRH,"  + " \n");
            sqlAna.append("hrk.KABUL_TRH,"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(hrk.ISTSH_ISLEM_SAAT),"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(hrk.KABUL_SAAT ),"  + " \n");
            sqlAna.append("hrk.SEVK_ID,"  + " \n");
            sqlAna.append("hzm.HIZMET_SUT_KODU,"  + " \n");
            sqlAna.append("hzm.HIZMET_SUT_TANIMI,"  + " \n");
            sqlAna.append("hrk.ISTSH_ID");

            org.hibernate.Query queryListCount = hibernate().createSQLQuery(sqlAna.toString()).addScalar("hstGelisSaati",StringType.INSTANCE)
                    .addScalar("istemDurum",IntegerType.INSTANCE).addScalar("accessionNumber", StringType.INSTANCE).addScalar("rcCihaz",StringType.INSTANCE)
                    .addScalar("rcSevkDurum",IntegerType.INSTANCE).addScalar("cekimYapan",StringType.INSTANCE).addScalar("hstGelisTrh", DateType.INSTANCE)
                    .addScalar("hstGelisSaat",IntegerType.INSTANCE).addScalar("sbsSaglikRaporId",IntegerType.INSTANCE).addScalar("sevkistemTrh",DateType.INSTANCE)
                    .addScalar("sevkkabulTrh",DateType.INSTANCE).addScalar("sevkistemSaat",IntegerType.INSTANCE).addScalar("sevkkabulSaat",IntegerType.INSTANCE)
                    .addScalar("teknisyen",StringType.INSTANCE).addScalar("Butce_Kodu",IntegerType.INSTANCE).addScalar("Butce_Tanimi",StringType.INSTANCE)
                    .addScalar("istem_Id",IntegerType.INSTANCE);

            liste = queryListCount.setResultTransformer(Transformers.aliasToBean(SbsKlinikSevkUI.class)).list();
            //sih.ACIL_ONCELIK_TURU ,sih.ISTSH_ISLEM_SAAT,SHRU.HST_GELIS_SAAT, sih.ACCESSION_NUMBER,sih.KABUL_TRH
            response.setData(liste);
            response.setTotal(liste.size());
            response.setSuccessful(true);
        } catch (Exception e) {
            e.printStackTrace();
            response.setSuccessful(false);
            response.setMessageCode("SISTEM.ERROR.0001");
        }
        return response;
</code>```

UIModel.java:

```<code>private String hstGelisSaati;

private Integer istemDurum;

private String accessionNumber;

private String rcCihaz;

private Integer rcSevkDurum;

private String cekimYapan;

private Date hstGelisTrh;

private Integer hstGelisSaat;

private Integer sbsSaglikRaporId;

private Date sevkistemTrh;

private Date sevkkabulTrh;

private Integer sevkistemSaat;

private Integer sevkkabulSaat;

private Integer Butce_Kodu;

private String Butce_Tanimi;

private Integer istem_Id;

public String getHstGelisSaati() {
        return hstGelisSaati;
    }

    public void setHstGelisSaati(String hstGelisSaati) {
        this.hstGelisSaati = hstGelisSaati;
    }

 public Integer getIstemDurum() {
        return istemDurum;
    }

    public void setIstemDurum(Integer istemDurum) {
        this.istemDurum = istemDurum;
    }

    public String getAccessionNumber() {
        return accessionNumber;
    }

    public void setAccessionNumber(String accessionNumber) {
        this.accessionNumber = accessionNumber;
    }

    public Integer getRcSevkDurum() {
        return rcSevkDurum;
    }

    public void setRcSevkDurum(Integer rcSevkDurum) {
        this.rcSevkDurum = rcSevkDurum;
    }

    public String getCekimYapan() {
        return cekimYapan; }

    public void setCekimYapan(String cekimYapan) {
        this.cekimYapan = cekimYapan; }

    public Date getHstGelisTrh() {
        return hstGelisTrh;
    }

    public void setHstGelisTrh(Date hstGelisTrh) {
        this.hstGelisTrh = hstGelisTrh;
    }

    public Integer getHstGelisSaat() {
        return hstGelisSaat;
    }

    public void setHstGelisSaat(Integer hstGelisSaat) {
        this.hstGelisSaat = hstGelisSaat;
    }

    public Integer getSbsSaglikRaporId() {
        return sbsSaglikRaporId;
    }

    public void setSbsSaglikRaporId(Integer sbsSaglikRaporId) {
        this.sbsSaglikRaporId = sbsSaglikRaporId;
    }

    public Date getsevkistemTrh() {
        return sevkistemTrh;
    }

    public void setsevkistemTrh(Date sevkistemTrh) {
        this.sevkistemTrh = sevkistemTrh;
    }

    public Date getsevkkabulTrh() {
        return sevkkabulTrh;
    }

    public void setsevkkabulTrh(Date sevkkabulTrh) {
        this.sevkkabulTrh = sevkkabulTrh;
    }

    public Integer getsevkistemSaat() {
        return sevkistemSaat;
    }

    public void setsevkistemSaat(Integer sevkistemSaat) {
        this.sevkistemSaat = sevkistemSaat;
    }

    public Integer getsevkkabulSaat() {
        return sevkkabulSaat;
    }

    public void setsevkkabulSaat(Integer sevkkabulSaat) {
        this.sevkkabulSaat = sevkkabulSaat;
    }

    public Integer getButce_Kodu() {
        return Butce_Kodu;
    }

    public void setButce_Kodu(Integer Butce_Kodu) {
        this.Butce_Kodu = Butce_Kodu;
    }

    public String getButce_Tanimi() {
        return Butce_Tanimi;
    }

    public void setButce_Tanimi(String Butce_Tanimi) {
        this.Butce_Tanimi = Butce_Tanimi;
    }

    public Integer getIstem_Id() {
        return istem_Id;
    }

    public void setistem_Id(Integer istem_Id) {
        this.istem_Id = istem_Id;
    }

</code>```

the error

Body:
I want to list my data on a grid and I used hibernate for it on Java. But my code doesn't work and I get error. When I run my SQL script it works. I think there is an error on my code and there isn't an error on my SQL script. Code blocks and error screenshot is below. How can I fix it ?

DaoImp.java:

@Override public DealResponse radyolojiSorgulamaListesiAlt(List<BaseFilter> prmFilter, Integer start, Integer limit) {
        //sysFunc.writeDealLog_Start(new DealLog(_projeEnum.LogLevel.StartMethod, "tr.com.metasoft.deal.dao.sbs", "SbsIstemFisHastaDaoImpl", "istemHastaSiraListesi"));
        DealResponse response = new DealResponse();
        try {

            List<PatolojiSorusturmaUI> liste =new ArrayList<>();
            List<PatolojiSorusturmaUI> listeCount = new ArrayList<>();

            StringBuilder sqlAna = new StringBuilder();
            sqlAna.append(
                    "select dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT)   as hstGelisSaati,\n" +
                            "hrk.ISTEM_DURUM as istemDurum,\n" +
                            "ACCESSION_NUMBER as accessionNumber,\n" +
                            "srck.RC_CIHAZ AS rcCihaz,srck.RC_CIHAZ_SEVK as rcSevkDurum,\n" +
                            "sd.DOKTOR_AD + ' '  + sd.DOKTOR_SOYAD  as cekimYapan,\n" +
                            "sifh.HASTA_GELIS_TRH as hstGelisTrh,\n" +
                            "dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT) as hstGelisSaat,\n" +
                            "SBS_SAGLIK_RAPOR_ID as sbsSaglikRaporId,\n" +
                            "hrk.ISTSH_TRH  as sevkistemTrh,\n" +
                            "hrk.KABUL_TRH   as sevkkabulTrh,\n" +
                            "dbo.IntegerIntoTime(hrk.ISTSH_ISLEM_SAAT)  as sevkistemSaat,\n" +
                            "dbo.IntegerIntoTime(hrk.KABUL_SAAT )  as sevkkabulSaat,\n" +
                            "hrk.SEVK_ID as sevkId,NULL as teknisyen,\n" +
                            "hzm.HIZMET_SUT_KODU as Butce_Kodu,\n" +
                            "hzm.HIZMET_SUT_TANIMI as Butce_Tanimi,\n" +
                            "hrk.ISTSH_ID AS istem_Id\n"+

                            "from SBS_ISTEM_FIS  as sif  with(nolock)\n" +
                            "inner join SBS_ISTEM_FIS_HASTA as sifh with(nolock) on sif.ISTEM_FS_ID=sifh.SBS_ISTEM_FIS_ID and isnull(sif.PSF_ID,0)=0\n" +
                            "inner join SBS_ISTEM_HAREKET as hrk with(nolock) on sif.ISTEM_FS_ID=hrk.ISTEM_FIS_ID and isnull(hrk.PSF_ID,0)=0\n" +
                            "inner join SBS_ISTEM_FIS as siff        with(nolock) on siff.ISTEM_FS_ID=hrk.ISTEM_FIS_ID and (isnull(siff.PSF_ID,0)=0)\n" +
                            "inner join STOK_KART_HIZMET as hzm with(nolock) on hrk.ISTSH_STOKKART_ID = hzm.STOK_ID and (isnull(hzm.PSF_ID,0)=0)\n" +
                            "left join SBS_DOKTOR as sd with(nolock) on SD.KIMLIK_ID = HRK.UYGULAYACAK_HEKIM_KIMLIK_ID and (isnull(hzm.PSF_ID,0)=0)\n" +
                            "left join TUR_DETAY AS TD WITH(NOLOCK) ON TD.TUR_DETAY_ID=SD.CALISMA_TURU AND ISNULL(TD.PSF_ID,0)=0 AND (TD.TUR_DEGER_KOD='DISHEKIMI' or TD.TUR_DEGER_KOD='HEKIM')\n" +
                            "inner join SBS_HASTA  as hst with(nolock) on hst.HASTA_KIMLIK_ID=sifh.HASTA_KIMLIK_ID and isnull(hst.PSF_ID,0)=0\n" +
                            "inner join  KIMLIK as k  with(nolock) on   k.KIMLIK_ID =sifh.HASTA_KIMLIK_ID  and  isnull(k.PSF_ID,0)=0\n" +
                            "left join TUR_DETAY as tdc  with(nolock) on k.CINSIYET_TUR_ID = tdc.TUR_DETAY_ID  and  isnull(tdc.PSF_ID,0)=0\n" +
                            "left join SBS_GIZLI_HASTA as gh ON gh.TC_KIMLIK_NO = sifh.KIMLIK_TC_NO and (GETDATE() BETWEEN gh.MAHKEME_TARIHI AND hst.GIZLILIK_BITIS_TARIH) and ISNULL(gh.PSF_ID,0) = 0\n" +
                            "left join BIRIM as b  with(nolock)  on b.BIRIM_ID = sifh.HASTA_SERVIS_ID and isnull(b.PSF_ID,0)=0\n" +
                            "left join SBS_KLINIK as klinik  with(nolock) on b.BIRIM_ID = klinik.BIRIM_ID and isnull(klinik.PSF_ID,0)=0\n" +
                            "left join SBS_KLINIK_UST as ust  with(nolock) on klinik.KLINIK_UST_ID = ust.KLINIK_UST_ID and (ISNULL(ust.PSF_ID,0)=0)\n" +
                            "left join TUR_DETAY as klinikTur  with(nolock) on klinik.KLINIK_TUR_ID = klinikTur.TUR_DETAY_ID and isnull(klinikTur.PSF_ID,0)=0\n" +
                            "left join CARI_KURUM_TUR as ck  with(nolock) on  sifh.HASTA_KURUM_TUR_ID  = ck.KURUM_TUR_ID and isnull(ck.PSF_ID,0)=0\n" +
                            "left join CARI_KART as cari  with(nolock) on sifh.HASTA_KURUM_ID = cari.CARI_KART_ID and isnull(cari.PSF_ID,0)=0\n" +
                            "left join SBS_SIRA_TUR as siraTur  with(nolock)on hst.SIRA_TUR_ID = siraTur.SBS_SIRA_TUR_ID and isnull(siraTur.PSF_ID,0)=0\n" +
                            "left join BIRIM as br on br.BIRIM_ID =sif.ISTEM_FS_ISTEM_YAPAN_BIRIM_ID\n" +
                            "left join BIRIM as ustBirim on ustBirim.BIRIM_ID =br.UST_BIRIM_ID\n" +
                            "left join KAYIT_DURUM as tdKayitDurum with(nolock) on tdKayitDurum.KAYIT_DURUM_ID=hrk.ISTSH_KAYIT_DURUM_ID   and isnull(tdKayitDurum.PSF_ID,0)=0\n" +
                            "left join SBS_RONTGEN_CIHAZ as srck with(nolock) on srck.SBS_RONTGEN_CIHAZ_ID=hrk.RONTGEN_CIHAZ_ID  and isnull(srck.PSF_ID,0)=0\n" +
                            "left join BIRIM as rontgenBirim on  srck.RC_CIHAZ_SRVNO= rontgenBirim.BIRIM_ID\n" +
                            "left join BIRIM rontgenUstBirim on rontgenBirim.UST_BIRIM_ID =rontgenUstBirim.BIRIM_ID and rontgenUstBirim.BIRIM_ID =ustBirim.BIRIM_ID\n" +
                            "where (isnull(hrk.PSF_ID,0)=0)\n" +
                            "and (isnull(sifh.PSF_ID,0)=0)\n" +
                            "and  hzm.HIZMET_TUR  &4 =4\n");

            if (sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_GELIS_TRH >= '"+(sysFunc.getFilterInBaseFilterList("baslangicTrh", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_GELIS_TRH <= '"+(sysFunc.getFilterInBaseFilterList("bitisTrh", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.KIMLIK_TC_NO = '"+(sysFunc.getFilterInBaseFilterList("hastaTcKimlikNo", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HASTA_SERVIS_AD = '"+(sysFunc.getFilterInBaseFilterList("birimAd", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue != "") {
                sqlAna.append( " and sifh.HEKIM_AD_SOYAD = '"+(sysFunc.getFilterInBaseFilterList("hekimAdSoyad", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            if (sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue != null && sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue != "") {
                sqlAna.append( " and hst.HASTA_KODU = '"+(sysFunc.getFilterInBaseFilterList("hastaKodu", prmFilter).fieldValue.toString()) + "'" + " \n");
            }
            sqlAna.append("group by sifh.HASTA_KIMLIK_ID," + " \n" );
            sqlAna.append("sifh.HASTA_GELIS_ID," + " \n");
            sqlAna.append("sifh.HST_GELIS_KOD," + " \n" );
            sqlAna.append("sifh.HASTA_AD_SOYAD,"  + " \n");
            sqlAna.append("hst.HASTA_KODU,"  + " \n");
            sqlAna.append("(sd.DOKTOR_AD +' ' + sd.DOKTOR_SOYAD),"  + " \n");
            sqlAna.append("(b.BIRIM_AD),"  + " \n");
            sqlAna.append("sifh.KIMLIK_TC_NO,"  + " \n");
            sqlAna.append("ck.KURUM_TUR_TANIM,"  + " \n");
            sqlAna.append("sifh.HASTA_KURUM_TUR_ID,"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(sif.ISTEM_FS_SAAT),"  + " \n");
            sqlAna.append("cari.CARI_KART_ADI,"  + " \n");
            sqlAna.append("cari.CARI_KART_ADI,"  + " \n");
            sqlAna.append("klinikTur.TUR_DEGER_KOD,"  + " \n");
            sqlAna.append("hst.SIRA_TUR_ID,"  + " \n");
            sqlAna.append("siraTur.Ad,"  + " \n");
            sqlAna.append("gh.HASTA_RUMUZ,"  + " \n");
            sqlAna.append("hst.GIZLILIK_BITIS_TARIH,"  + " \n");
            sqlAna.append("b.BIRIM_ID,"  + " \n");
            sqlAna.append("sd.KIMLIK_ID,"  + " \n");
            sqlAna.append("convert(date ,sif.ISTEM_FS_TRH ,102),"  + " \n");
            sqlAna.append("hrk.ISTEM_DURUM,"  + " \n");
            sqlAna.append("cast(convert(date,sifh.KIMLIK_DOGUM_TRH,102) as nvarchar), "  + " \n");
            sqlAna.append("ACCESSION_NUMBER,"  + " \n");
            sqlAna.append("srck.RC_CIHAZ,"  + " \n");
            sqlAna.append("srck.RC_CIHAZ_SEVK,"  + " \n");
            sqlAna.append("sd.DOKTOR_AD + ' '  + sd.DOKTOR_SOYAD,"  + " \n");
            sqlAna.append("sifh.HASTA_GELIS_TRH,"  + " \n");
            sqlAna.append("sif.ISTEM_FS_SAAT,"  + " \n");
            sqlAna.append("SBS_SAGLIK_RAPOR_ID,"  + " \n");
            sqlAna.append("hrk.ISTSH_TRH,"  + " \n");
            sqlAna.append("hrk.KABUL_TRH,"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(hrk.ISTSH_ISLEM_SAAT),"  + " \n");
            sqlAna.append("dbo.IntegerIntoTime(hrk.KABUL_SAAT ),"  + " \n");
            sqlAna.append("hrk.SEVK_ID,"  + " \n");
            sqlAna.append("hzm.HIZMET_SUT_KODU,"  + " \n");
            sqlAna.append("hzm.HIZMET_SUT_TANIMI,"  + " \n");
            sqlAna.append("hrk.ISTSH_ID");

            org.hibernate.Query queryListCount = hibernate().createSQLQuery(sqlAna.toString()).addScalar("hstGelisSaati",StringType.INSTANCE)
                    .addScalar("istemDurum",IntegerType.INSTANCE).addScalar("accessionNumber", StringType.INSTANCE).addScalar("rcCihaz",StringType.INSTANCE)
                    .addScalar("rcSevkDurum",IntegerType.INSTANCE).addScalar("cekimYapan",StringType.INSTANCE).addScalar("hstGelisTrh", DateType.INSTANCE)
                    .addScalar("hstGelisSaat",IntegerType.INSTANCE).addScalar("sbsSaglikRaporId",IntegerType.INSTANCE).addScalar("sevkistemTrh",DateType.INSTANCE)
                    .addScalar("sevkkabulTrh",DateType.INSTANCE).addScalar("sevkistemSaat",IntegerType.INSTANCE).addScalar("sevkkabulSaat",IntegerType.INSTANCE)
                    .addScalar("teknisyen",StringType.INSTANCE).addScalar("Butce_Kodu",IntegerType.INSTANCE).addScalar("Butce_Tanimi",StringType.INSTANCE)
                    .addScalar("istem_Id",IntegerType.INSTANCE);

            liste = queryListCount.setResultTransformer(Transformers.aliasToBean(SbsKlinikSevkUI.class)).list();
            //sih.ACIL_ONCELIK_TURU ,sih.ISTSH_ISLEM_SAAT,SHRU.HST_GELIS_SAAT, sih.ACCESSION_NUMBER,sih.KABUL_TRH
            response.setData(liste);
            response.setTotal(liste.size());
            response.setSuccessful(true);
        } catch (Exception e) {
            e.printStackTrace();
            response.setSuccessful(false);
            response.setMessageCode("SISTEM.ERROR.0001");
        }
        return response;

UIModel.java:

private String hstGelisSaati;

private Integer istemDurum;

private String accessionNumber;

private String rcCihaz;

private Integer rcSevkDurum;

private String cekimYapan;

private Date hstGelisTrh;

private Integer hstGelisSaat;

private Integer sbsSaglikRaporId;

private Date sevkistemTrh;

private Date sevkkabulTrh;

private Integer sevkistemSaat;

private Integer sevkkabulSaat;

private Integer Butce_Kodu;

private String Butce_Tanimi;

private Integer istem_Id;

public String getHstGelisSaati() {
        return hstGelisSaati;
    }

    public void setHstGelisSaati(String hstGelisSaati) {
        this.hstGelisSaati = hstGelisSaati;
    }

 public Integer getIstemDurum() {
        return istemDurum;
    }

    public void setIstemDurum(Integer istemDurum) {
        this.istemDurum = istemDurum;
    }

    public String getAccessionNumber() {
        return accessionNumber;
    }

    public void setAccessionNumber(String accessionNumber) {
        this.accessionNumber = accessionNumber;
    }

    public Integer getRcSevkDurum() {
        return rcSevkDurum;
    }

    public void setRcSevkDurum(Integer rcSevkDurum) {
        this.rcSevkDurum = rcSevkDurum;
    }

    public String getCekimYapan() {
        return cekimYapan; }

    public void setCekimYapan(String cekimYapan) {
        this.cekimYapan = cekimYapan; }

    public Date getHstGelisTrh() {
        return hstGelisTrh;
    }

    public void setHstGelisTrh(Date hstGelisTrh) {
        this.hstGelisTrh = hstGelisTrh;
    }

    public Integer getHstGelisSaat() {
        return hstGelisSaat;
    }

    public void setHstGelisSaat(Integer hstGelisSaat) {
        this.hstGelisSaat = hstGelisSaat;
    }

    public Integer getSbsSaglikRaporId() {
        return sbsSaglikRaporId;
    }

    public void setSbsSaglikRaporId(Integer sbsSaglikRaporId) {
        this.sbsSaglikRaporId = sbsSaglikRaporId;
    }

    public Date getsevkistemTrh() {
        return sevkistemTrh;
    }

    public void setsevkistemTrh(Date sevkistemTrh) {
        this.sevkistemTrh = sevkistemTrh;
    }

    public Date getsevkkabulTrh() {
        return sevkkabulTrh;
    }

    public void setsevkkabulTrh(Date sevkkabulTrh) {
        this.sevkkabulTrh = sevkkabulTrh;
    }

    public Integer getsevkistemSaat() {
        return sevkistemSaat;
    }

    public void setsevkistemSaat(Integer sevkistemSaat) {
        this.sevkistemSaat = sevkistemSaat;
    }

    public Integer getsevkkabulSaat() {
        return sevkkabulSaat;
    }

    public void setsevkkabulSaat(Integer sevkkabulSaat) {
        this.sevkkabulSaat = sevkkabulSaat;
    }

    public Integer getButce_Kodu() {
        return Butce_Kodu;
    }

    public void setButce_Kodu(Integer Butce_Kodu) {
        this.Butce_Kodu = Butce_Kodu;
    }

    public String getButce_Tanimi() {
        return Butce_Tanimi;
    }

    public void setButce_Tanimi(String Butce_Tanimi) {
        this.Butce_Tanimi = Butce_Tanimi;
    }

    public Integer getIstem_Id() {
        return istem_Id;
    }

    public void setistem_Id(Integer istem_Id) {
        this.istem_Id = istem_Id;
    }

the error


问:
Running FN Server on a Openshift Cluster without --privileged flag
We are trying to deploy FN server in an Openshift Cluster without privileged security context, only enabling root mode (not privileged), but we are getting this error:

`

```<code>/usr/local/bin/preentry.sh: set: line 14: can't access tty; job control turned off
mount: permission denied (are you root?)
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: permission denied (are you root?)
time="2022-12-09T12:03:59Z" level=info msg="Setting log level to" fields.level=DEBUG
time="2022-12-09T12:03:59Z" level=info msg="Registering data store provider 'sql'"
time="2022-12-09T12:03:59Z" level=debug msg="creating new datastore" db=sqlite3
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=info msg="Connecting to DB" url="sqlite3:///app/data/fn.db"
time="2022-12-09T12:03:59Z" level=info msg="datastore dialed" datastore=sqlite3 max_idle_connections=256 url="sqlite3:///app/data/fn.db"
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=info msg="agent starting cfg={MinDockerVersion:17.10.0-ce ContainerLabelTag: DockerNetworks: DockerLoadFile: DisableUnprivilegedContainers:false FreezeIdle:50ms HotPoll:200ms HotLauncherTimeout:1h0m0s HotPullTimeout:10m0s HotStartTimeout:5s DetachedHeadRoom:6m0s MaxResponseSize:0 MaxHdrResponseSize:0 MaxLogSize:1048576 MaxTotalCPU:0 MaxTotalMemory:0 MaxFsSize:0 MaxPIDs:50 MaxOpenFiles:0xc4201b5bf8 MaxLockedMemory:0xc4201b5c10 MaxPendingSignals:0xc4201b5c18 MaxMessageQueue:0xc4201b5c20 PreForkPoolSize:0 PreForkImage:busybox PreForkCmd:tail -f /dev/null PreForkUseOnce:0 PreForkNetworks: EnableNBResourceTracker:false MaxTmpFsInodes:0 DisableReadOnlyRootFs:false DisableDebugUserLogs:false IOFSEnableTmpfs:false EnableFDKDebugInfo:false IOFSAgentPath: IOFSMountRoot: IOFSOpts: ImageCleanMaxSize:0 ImageCleanExemptTags: ImageEnableVolume:false}"
time="2022-12-09T12:03:59Z" level=info msg="no docker auths from config files found (this is fine)" error="open /root/.dockercfg: no such file or directory"
time="2022-12-09T12:03:59Z" level=fatal msg="couldn't connect to docker daemon" error="Get http://unix.sock/_ping: dial unix /var/run/docker.sock: connect: no such file or directory"
</code>```

`

Is there any way to deploy FN server without privileged mode?

Body:
We are trying to deploy FN server in an Openshift Cluster without privileged security context, only enabling root mode (not privileged), but we are getting this error:

`

/usr/local/bin/preentry.sh: set: line 14: can't access tty; job control turned off
mount: permission denied (are you root?)
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: permission denied (are you root?)
time="2022-12-09T12:03:59Z" level=info msg="Setting log level to" fields.level=DEBUG
time="2022-12-09T12:03:59Z" level=info msg="Registering data store provider 'sql'"
time="2022-12-09T12:03:59Z" level=debug msg="creating new datastore" db=sqlite3
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=info msg="Connecting to DB" url="sqlite3:///app/data/fn.db"
time="2022-12-09T12:03:59Z" level=info msg="datastore dialed" datastore=sqlite3 max_idle_connections=256 url="sqlite3:///app/data/fn.db"
time="2022-12-09T12:03:59Z" level=debug msg="mysql does not support sqlite3"
time="2022-12-09T12:03:59Z" level=debug msg="postgres does not support sqlite3"
time="2022-12-09T12:03:59Z" level=info msg="agent starting cfg={MinDockerVersion:17.10.0-ce ContainerLabelTag: DockerNetworks: DockerLoadFile: DisableUnprivilegedContainers:false FreezeIdle:50ms HotPoll:200ms HotLauncherTimeout:1h0m0s HotPullTimeout:10m0s HotStartTimeout:5s DetachedHeadRoom:6m0s MaxResponseSize:0 MaxHdrResponseSize:0 MaxLogSize:1048576 MaxTotalCPU:0 MaxTotalMemory:0 MaxFsSize:0 MaxPIDs:50 MaxOpenFiles:0xc4201b5bf8 MaxLockedMemory:0xc4201b5c10 MaxPendingSignals:0xc4201b5c18 MaxMessageQueue:0xc4201b5c20 PreForkPoolSize:0 PreForkImage:busybox PreForkCmd:tail -f /dev/null PreForkUseOnce:0 PreForkNetworks: EnableNBResourceTracker:false MaxTmpFsInodes:0 DisableReadOnlyRootFs:false DisableDebugUserLogs:false IOFSEnableTmpfs:false EnableFDKDebugInfo:false IOFSAgentPath: IOFSMountRoot: IOFSOpts: ImageCleanMaxSize:0 ImageCleanExemptTags: ImageEnableVolume:false}"
time="2022-12-09T12:03:59Z" level=info msg="no docker auths from config files found (this is fine)" error="open /root/.dockercfg: no such file or directory"
time="2022-12-09T12:03:59Z" level=fatal msg="couldn't connect to docker daemon" error="Get http://unix.sock/_ping: dial unix /var/run/docker.sock: connect: no such file or directory"

`

Is there any way to deploy FN server without privileged mode?


问:
Should I guard Map.clear() with readLock or writeLock of j.u.c.l.ReentrantReadWriteLock
In my code I'm using ReentrantReadWriteLock to guard some paired read/write operations:

public class AgreementCache {

    private final ConcurrentMap<String, Agreement> agreements = new ConcurrentHashMap<>();

    private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock();

    public Agreement putIntoCache(String key, Function<String, Agreement> valueSupplyingFunction) {
        Lock lock = readWriteLock.writeLock();
        try {
            lock.lock();
            return agreements.put(key, valueSupplyingFunction.apply(key));
        } finally {
            lock.unlock();
        }
    }

    public void drainCache(Map<String, Agreement> destination) {
        Lock lock = readWriteLock.readLock(); // <--- !!!
        try {
            lock.lock();
            destination.putAll(agreements);
            agreements.clear(); // <--- !!!
        } finally {
            lock.unlock();
        }
    }

    public Agreement getFromCache(String key) {
        Lock lock = readWriteLock.readLock();
        try {
            lock.lock();
            return agreements.get(key);
        } finally {
            lock.unlock();
        }
    }
}
```

Here in put() method I need to ensure that mapping function is executed atomically along with putting the computed value into the map. At the same time I need to enforce raceless drain() operation, i.e. I need to make sure that no data will be put into the map while draining its contents. Currently I use writeLock in put() method and readLock() in drain() method, but I suspect this is wrong, because after map.putAll() I clear the map which is a modifying operation.

So my question is whether I need to use writeLock in drain() method or I can still rely on readLock()?

Body:
In my code I'm using ReentrantReadWriteLock to guard some paired read/write operations:

public class AgreementCache {

    private final ConcurrentMap<String, Agreement> agreements = new ConcurrentHashMap<>();

    private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock();

    public Agreement putIntoCache(String key, Function<String, Agreement> valueSupplyingFunction) {
        Lock lock = readWriteLock.writeLock();
        try {
            lock.lock();
            return agreements.put(key, valueSupplyingFunction.apply(key));
        } finally {
            lock.unlock();
        }
    }

    public void drainCache(Map<String, Agreement> destination) {
        Lock lock = readWriteLock.readLock(); // <--- !!!
        try {
            lock.lock();
            destination.putAll(agreements);
            agreements.clear(); // <--- !!!
        } finally {
            lock.unlock();
        }
    }

    public Agreement getFromCache(String key) {
        Lock lock = readWriteLock.readLock();
        try {
            lock.lock();
            return agreements.get(key);
        } finally {
            lock.unlock();
        }
    }
}

Here in put() method I need to ensure that mapping function is executed atomically along with putting the computed value into the map. At the same time I need to enforce raceless drain() operation, i.e. I need to make sure that no data will be put into the map while draining its contents. Currently I use writeLock in put() method and readLock() in drain() method, but I suspect this is wrong, because after map.putAll() I clear the map which is a modifying operation.

So my question is whether I need to use writeLock in drain() method or I can still rely on readLock()?


问:
One section will be image and other section is text(H1,P,Span)
what sematic tags we will use?
Can we use non sematic tags within sematic tags is it good to write clean code?
Like this.

```<code><section>
    <div>

    </div>
 </section>
</code>```

Here is the image

I tried doing like this
I used

```<code><main>
    <section>
    </section>
    <section>
    </section>
</main>
</code>```

Body:
what sematic tags we will use?
Can we use non sematic tags within sematic tags is it good to write clean code?
Like this.

Here is the image

I tried doing like this
I used


问:
Postgresql, recursive view with getting rows of older iterations
I would like to do some calculations with postgresql in a recursive / iterative way.
Here is a very rudimentary example: There is a line and on the line are 2 points. I want to create new points in the middle of every pair of points before existing.
(This is just an example, this does not really make sense, because we will get infinitely many points and got at the same point as existing ones)

```<code>CREATE TABLE IF NOT EXISTS public.points
(
    pos real
)
TABLESPACE pg_default;

INSERT INTO points VALUES (0),(1024);
</code>```

What i want to achieve is something like this:

```<code>| pos      | step     | Parent A | Parent B |
| -------- | -------- | -------- | -------- |
|    0     |    1     |   -1     |   -1     |
| 1024     |    1     |   -1     |   -1     |
|  512     |    2     |    0     | 1024     |
|  256     |    3     |    0     |  512     |
|  768     |    3     |  512     | 1024     |
...
</code>```

Now I have two starting points. How to build a request to achieve such a result?
If you have a solution without the step, it would be great also, but i think it can help me, to prevent doing calculations twice.

After a few tries and help from the article Recursive cumulative function - reuse resulting rows as input
I found this solution. Is this the way to go, or do you have a better solution?

```<code>CREATE TYPE public.points_type AS
(
    pos real,
    step integer,
    parenta real,
    parentb real
);

CREATE TYPE public.points_type_input AS
(
    pos real,
    step integer
);

CREATE OR REPLACE FUNCTION public.points_calc(
_points points_type_input[])
    RETURNS SETOF points_type
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE PARALLEL UNSAFE
    ROWS 1000
AS $BODY$
 declare
 new_point points_type;
 Begin
    FOR new_point IN
        SELECT  (new_p).pos AS pos,
                (new_p).stepnow +1 AS step,
                (new_p).parentA AS parentA,
                (new_p).parentB AS parentB
        FROM (
            SELECT  ((p1.pos + p2.pos)/2)::real AS pos,
                    (array_agg(p1.pos) OVER (PARTITION BY 1)) AS oldpos,
                    (max(p1.step) OVER (PARTITION BY 1)) AS stepnow,
                    p1.pos AS parentA,
                    p2.pos AS parentB
            FROM unnest(_points) p1
            CROSS JOIN unnest(_points) p2
            WHERE p1.pos < p2.pos
        ) new_p
        WHERE not ARRAY[pos] <@ oldpos
    LOOP
        RETURN NEXT new_point;
    END LOOP;
    RETURN;
 END

$BODY$;
</code>```

This is the best solution i found. Is there a better way?

```<code>CREATE OR REPLACE FUNCTION points_v2(end_step integer)
  RETURNS TABLE(pos real, step integer, parenta real, parentb real)
  LANGUAGE plpgsql AS
$func$
DECLARE
   t record;
   a boolean;
   cnt integer;
BEGIN
   DROP TABLE IF EXISTS pg_temp.result2;
   CREATE TEMP TABLE result2 (pos real, step integer, parenta real, parentb real) ON COMMIT DROP;

   FOR t IN
          TABLE points ORDER BY pos
   LOOP
      INSERT INTO result2(pos, step, parenta, parentb)
        SELECT t.pos, 1 AS step, -1 AS parenta, -1 AS parentb;
   END LOOP;
    a = true;
    cnt = 0;
    WHILE a AND cnt<end_step
    LOOP
    a = false;
    cnt = cnt + 1;
       FOR t IN
            SELECT  (newpoints.result).pos,
                (newpoints.result).step,
                (newpoints.result).parenta,
                (newpoints.result).parentb
            FROM ( SELECT points_calc(array_agg(ROW(p.pos, p.step)::points_type_input)) AS result
            FROM result2 p
            ) newpoints
       LOOP
            a = true;
            INSERT INTO result2(pos, step, parenta, parentb)
            SELECT t.pos, t.step, t.parenta, t.parentb;
       END LOOP;
   END LOOP;
   RETURN QUERY
   SELECT r.pos, r.step, r.parenta, r.parentb
   FROM   result2 r;
END
$func$;

</code>```
```<code>SELECT * FROM points_v2(3);
</code>```

Is there someone, who can help me?
Here is a dbfiddle example.

Thank you very much, best regards, Ludwig Rahlff

Body:
I would like to do some calculations with postgresql in a recursive / iterative way.
Here is a very rudimentary example: There is a line and on the line are 2 points. I want to create new points in the middle of every pair of points before existing.
(This is just an example, this does not really make sense, because we will get infinitely many points and got at the same point as existing ones)

CREATE TABLE IF NOT EXISTS public.points
(
    pos real
)
TABLESPACE pg_default;

INSERT INTO points VALUES (0),(1024);

What i want to achieve is something like this:

| pos      | step     | Parent A | Parent B |
| -------- | -------- | -------- | -------- |
|    0     |    1     |   -1     |   -1     |
| 1024     |    1     |   -1     |   -1     |
|  512     |    2     |    0     | 1024     |
|  256     |    3     |    0     |  512     |
|  768     |    3     |  512     | 1024     |
...

Now I have two starting points. How to build a request to achieve such a result?
If you have a solution without the step, it would be great also, but i think it can help me, to prevent doing calculations twice.

After a few tries and help from the article Recursive cumulative function - reuse resulting rows as input
I found this solution. Is this the way to go, or do you have a better solution?

CREATE TYPE public.points_type AS
(
    pos real,
    step integer,
    parenta real,
    parentb real
);

CREATE TYPE public.points_type_input AS
(
    pos real,
    step integer
);

CREATE OR REPLACE FUNCTION public.points_calc(
_points points_type_input[])
    RETURNS SETOF points_type
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE PARALLEL UNSAFE
    ROWS 1000
AS $BODY$
 declare
 new_point points_type;
 Begin
    FOR new_point IN
        SELECT  (new_p).pos AS pos,
                (new_p).stepnow +1 AS step,
                (new_p).parentA AS parentA,
                (new_p).parentB AS parentB
        FROM (
            SELECT  ((p1.pos + p2.pos)/2)::real AS pos,
                    (array_agg(p1.pos) OVER (PARTITION BY 1)) AS oldpos,
                    (max(p1.step) OVER (PARTITION BY 1)) AS stepnow,
                    p1.pos AS parentA,
                    p2.pos AS parentB
            FROM unnest(_points) p1
            CROSS JOIN unnest(_points) p2
            WHERE p1.pos < p2.pos
        ) new_p
        WHERE not ARRAY[pos] <@ oldpos
    LOOP
        RETURN NEXT new_point;
    END LOOP;
    RETURN;
 END

$BODY$;

This is the best solution i found. Is there a better way?

CREATE OR REPLACE FUNCTION points_v2(end_step integer)
  RETURNS TABLE(pos real, step integer, parenta real, parentb real)
  LANGUAGE plpgsql AS
$func$
DECLARE
   t record;
   a boolean;
   cnt integer;
BEGIN
   DROP TABLE IF EXISTS pg_temp.result2;
   CREATE TEMP TABLE result2 (pos real, step integer, parenta real, parentb real) ON COMMIT DROP;

   FOR t IN
          TABLE points ORDER BY pos
   LOOP
      INSERT INTO result2(pos, step, parenta, parentb)
        SELECT t.pos, 1 AS step, -1 AS parenta, -1 AS parentb;
   END LOOP;
    a = true;
    cnt = 0;
    WHILE a AND cnt<end_step
    LOOP
    a = false;
    cnt = cnt + 1;
       FOR t IN
            SELECT  (newpoints.result).pos,
                (newpoints.result).step,
                (newpoints.result).parenta,
                (newpoints.result).parentb
            FROM ( SELECT points_calc(array_agg(ROW(p.pos, p.step)::points_type_input)) AS result
            FROM result2 p
            ) newpoints
       LOOP
            a = true;
            INSERT INTO result2(pos, step, parenta, parentb)
            SELECT t.pos, t.step, t.parenta, t.parentb;
       END LOOP;
   END LOOP;
   RETURN QUERY
   SELECT r.pos, r.step, r.parenta, r.parentb
   FROM   result2 r;
END
$func$;

SELECT * FROM points_v2(3);

Is there someone, who can help me?
Here is a dbfiddle example.

Thank you very much, best regards, Ludwig Rahlff


问:
How to programmatically know that play services version was updated
In my application, I need to implement functionality that will depend on an update to Google Play Services.
Is it possible to dynamically track that the version of Google Play Services has been updated? Maybe there are some events, listeners or broadcast?</p>


问:
Timezone converter using python
I have created a timezone converter using python using libraries like pytz and datetime

Is there a way to make it without using any libraries

Title: Timezone converter using python


问:
Async::WebSocket unable to connect on Windows 10
I'm attempting to write a Ruby SDK for the Stream Deck, a product that is basically a fancy hardware AutoHotkey allowing the user to program buttons with customized icons that do whatever they please, including making directories to achieve an unlimited amount of buttons organized to their liking. It has a language-agnostic API wherein it runs your script or compiled app with the arguments -port, -pluginUUID, -registerEvent, and -info. It runs a websocket on localhost at the port specified in the args, and on opening a connection you are to send a JSON string with your event and UUID as specified in the args.

I've gotten Ruby 3.0.5 running within a plugin with console output, but I'm having trouble getting it to talk to the websocket. I'm using SDPL to load my script (intended only for testing):

```<code>#!/esr/bin/env ruby

require "json"
require "async/websocket/client"
require "async/http/endpoint"

include Async
include Async::HTTP

# Parse arguments
_, port, _, UUID, _, REGISTER_EVENT, _, *info = ARGV
PORT = port.to_i
INFO = JSON.parse info.join(" ")

# Debug output prints properly
p PORT
p UUID
p REGISTER_EVENT
p INFO

Async do |task|
  WebSocket::Client.connect(Endpoint.parse "http://localhost:#{PORT}") do |ws|
    ws.write({ event: REGISTER_EVENT, uuid: UUID }.to_json)
    ws.flush
    puts "Opened!"

    while msg = ws.read
      puts "Message:"
      puts msg
    end
  end
end
</code>```

The arguments output as expected, then it hangs. If this code is run in WSL (with modifications to hardcode the port and an open plugin UUID), it talks to the Stream Deck as expected. Possible issue with the module on Windows 10? On RubyInstaller 3.1.2, the situation is even worse- it crashes with the following error:

```<code>  0.0s     warn: Async::Task [oid=0x280] [ec=0x294] [pid=32436] [2022-12-13 00:36:46 -0500]
               | Task may have ended with unhandled exception.
               |   Errno::EBADF: Bad file descriptor
               |   → <internal:io> 63
               |     C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/io-event-1.1.4/lib/io/event/selector/select.rb 206
</code>```

Body:
I'm attempting to write a Ruby SDK for the Stream Deck, a product that is basically a fancy hardware AutoHotkey allowing the user to program buttons with customized icons that do whatever they please, including making directories to achieve an unlimited amount of buttons organized to their liking. It has a language-agnostic API wherein it runs your script or compiled app with the arguments -port, -pluginUUID, -registerEvent, and -info. It runs a websocket on localhost at the port specified in the args, and on opening a connection you are to send a JSON string with your event and UUID as specified in the args.

I've gotten Ruby 3.0.5 running within a plugin with console output, but I'm having trouble getting it to talk to the websocket. I'm using SDPL to load my script (intended only for testing):

#!/esr/bin/env ruby

require "json"
require "async/websocket/client"
require "async/http/endpoint"

include Async
include Async::HTTP

# Parse arguments
_, port, _, UUID, _, REGISTER_EVENT, _, *info = ARGV
PORT = port.to_i
INFO = JSON.parse info.join(" ")

# Debug output prints properly
p PORT
p UUID
p REGISTER_EVENT
p INFO

Async do |task|
  WebSocket::Client.connect(Endpoint.parse "http://localhost:#{PORT}") do |ws|
    ws.write({ event: REGISTER_EVENT, uuid: UUID }.to_json)
    ws.flush
    puts "Opened!"

    while msg = ws.read
      puts "Message:"
      puts msg
    end
  end
end

The arguments output as expected, then it hangs. If this code is run in WSL (with modifications to hardcode the port and an open plugin UUID), it talks to the Stream Deck as expected. Possible issue with the module on Windows 10? On RubyInstaller 3.1.2, the situation is even worse- it crashes with the following error:

  0.0s     warn: Async::Task [oid=0x280] [ec=0x294] [pid=32436] [2022-12-13 00:36:46 -0500]
               | Task may have ended with unhandled exception.
               |   Errno::EBADF: Bad file descriptor
               |   → <internal:io> 63
               |     C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/io-event-1.1.4/lib/io/event/selector/select.rb 206


问:
Address drill down component
I am developing an application where one of the screen takes the postal address of the user.
My requirement is, the user should be able to select the top most administrative regions in a drop down e.g a country. Based on the selection the next drop drown shows regions in the selected region. This should continue till the user selects the lowest region. Is there any out of box UI component in any UI library that allows to do this? A database table with such hierarchical organization  or free rest API will also do.

Thanks,
Nealesh

Title: Address drill down component


问:
How to stub a function inside lambda
I am developing a Lambda function that internally contains multiple function

I need to check how many times the internal functions are called

this is my handler file source.js

```<code>exports.handler = () =>{
  function function_1 ()
  {
    returns something;
  }
  function function_2 ()
  {
    //calls functions_1 internally and
    returns something;
  }

  function_2();
}
</code>```

this is what i've tried.
test.spect.js

```<code>const handler = require('./source').handler,
      sinon = require('sinon'),
      stub = require('sinon').stub

describe('testing lambdas',()=>{
  let myspy = spy(handler,'function_2');
  sinon.assert.calledOnce(myspy)

})
</code>```

It gives me this error Attempted to wrap undefined property anotherMethod as function

Title: How to stub a function inside lambda

Body:
I am developing a Lambda function that internally contains multiple function

I need to check how many times the internal functions are called

this is my handler file source.js

exports.handler = () =>{
  function function_1 ()
  {
    returns something;
  }
  function function_2 ()
  {
    //calls functions_1 internally and
    returns something;
  }

  function_2();
}

this is what i've tried.
test.spect.js

const handler = require('./source').handler,
      sinon = require('sinon'),
      stub = require('sinon').stub

describe('testing lambdas',()=>{
  let myspy = spy(handler,'function_2');
  sinon.assert.calledOnce(myspy)

})

It gives me this error Attempted to wrap undefined property anotherMethod as function


问:
Decorator to raise exception if not in context
I did not find a direct answer to this question and I find it quite usefull.
For example, I am developing a database interface, therefore, I am creating a class with methods that should only run when inside the class context, otherwise raise an exception:

with DBInterfaceContext() as session:
    session.do_something1()
    session.do_something2()
```
<p>This class implements the <code>do_something</code> methods, that should only be used when the connection to the database/other is done trhough the <code>__enter__</code> method.</p>
<p>Here a basic template of what to achieve:</p>
<pre class="lang-py prettyprint-override"><code>from contextlib import AbstractContextManager
from functools import wraps

class DBInterfaceContext(AbstractContextManager):
    """This is the DB interface example to build"""

    def __init__(self, *args, **kwds):
        ....

    def __enter__(self):
        ...
    def __exit__(self, exc_type, exc_value, traceback):
        ...

    @classmethod
    def require_session(meth):  # Decorator method
        ...
        @wraps(meth)
        def wrapped_method(self, *args, **kwds):
            if not self.in_session():
                raise RuntimeError(f"Method {meth} called out of session")
            return meth(self, *args, **kwds)
        return wrapped_method

    @DBInterfaceContext.require_session
    def do_something1(self, *args, **kwds):
        ...

    @DBInterfaceContext.require_session
    def do_something2(self, *args, **kwds):
        ...

</code>```

Feel free to modify the example as much as you like for the example and share your experience.

Great thanks!

Body:
I did not find a direct answer to this question and I find it quite usefull.
For example, I am developing a database interface, therefore, I am creating a class with methods that should only run when inside the class context, otherwise raise an exception:

with DBInterfaceContext() as session:
    session.do_something1()
    session.do_something2()

This class implements the do_something methods, that should only be used when the connection to the database/other is done trhough the __enter__ method.

Here a basic template of what to achieve:

from contextlib import AbstractContextManager
from functools import wraps

class DBInterfaceContext(AbstractContextManager):
    """This is the DB interface example to build"""

    def __init__(self, *args, **kwds):
        ....

    def __enter__(self):
        ...
    def __exit__(self, exc_type, exc_value, traceback):
        ...

    @classmethod
    def require_session(meth):  # Decorator method
        ...
        @wraps(meth)
        def wrapped_method(self, *args, **kwds):
            if not self.in_session():
                raise RuntimeError(f"Method {meth} called out of session")
            return meth(self, *args, **kwds)
        return wrapped_method

    @DBInterfaceContext.require_session
    def do_something1(self, *args, **kwds):
        ...

    @DBInterfaceContext.require_session
    def do_something2(self, *args, **kwds):
        ...

Feel free to modify the example as much as you like for the example and share your experience.

Great thanks!


问:
React warnings point out to the bundle, not the actual file
I use react-script start, and in chrome console I see warnings point not to the jsx file but bundle.js. Debugging works proper however using the original files, so it looks that sourcemap works (or not?). Is it possible to see points to the original files.
Example of the warning:

```<code>Warning: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
at input
at li
at ul
at TodosList (http://localhost:3000/static/js/bundle.js:430:5)
at section
at Main (http://localhost:3000/static/js/bundle.js:340:5)
at section
at App (http://localhost:3000/static/js/bundle.js:35:76)
</code>```

Body:
I use react-script start, and in chrome console I see warnings point not to the jsx file but bundle.js. Debugging works proper however using the original files, so it looks that sourcemap works (or not?). Is it possible to see points to the original files.
Example of the warning:

Warning: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
at input
at li
at ul
at TodosList (http://localhost:3000/static/js/bundle.js:430:5)
at section
at Main (http://localhost:3000/static/js/bundle.js:340:5)
at section
at App (http://localhost:3000/static/js/bundle.js:35:76)