问:
Django compare two users of a model and if one is the current user return the other user
I have this really simple friendship model that just consists of two users. After all if user1 is friends with user2 then user2 is friends with user1 automatically. I would like to filter all the results by the current user and if a row contains the current user I would like to return the other user.

So basically I want to return all records if the current user is either userone or usertwo and if the current user is usertwo swap the values so the current user is userone.

Currently it works but only one way using the following model, serializer and view

Model:

```<code>class Friendship(models.Model):
    userone = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="friendone"
    )
    usertwo = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="friendtwo"
    )

    created_at = models.DateTimeField(auto_now_add=True, verbose_name="created at")
    updated_at = models.DateTimeField(auto_now=True, verbose_name="updated at")

    class Meta:
        unique_together = ["userone", "usertwo"]

    def __str__(self):
        return "{} is friends with {}".format(self.userone, self.usertwo)

    def save(self, *args, **kwargs):
        if self.userone == self.usertwo:
            return "Same person friendship should happen mentally"
        else:
            super().save(*args, **kwargs)
</code>```

serializer:

```<code>class FriendSerializer(serializers.ModelSerializer):
    profile2 = serializers.SerializerMethodField()

    class Meta:
        model = Friendship
        fields = [
            "usertwo",
            "profile2"
        ]

    def get_profile2(self, obj):
        profile2_obj = Profile.objects.get(id=obj.usertwo.profile.id)
        profile2 = ProfileSerializer(profile2_obj)
        return profile2.data
</code>```

and view:

```<code>class FriendList(generics.ListAPIView):

    permission_classes = [permissions.IsAuthenticated]

    serializer_class = FriendSerializer
    name = "friends_list"

    def get_queryset(self):
        user = self.kwargs["user"]

        return Friendship.objects.all().filter(userone=user)
</code>```

The way it's set up is userone will always be the logged in user.

I have searched but cannot find information on how to handle this situation so guidance is appreciated.

Body:
I have this really simple friendship model that just consists of two users. After all if user1 is friends with user2 then user2 is friends with user1 automatically. I would like to filter all the results by the current user and if a row contains the current user I would like to return the other user.

So basically I want to return all records if the current user is either userone or usertwo and if the current user is usertwo swap the values so the current user is userone.

Currently it works but only one way using the following model, serializer and view

Model:

class Friendship(models.Model):
    userone = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="friendone"
    )
    usertwo = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="friendtwo"
    )

    created_at = models.DateTimeField(auto_now_add=True, verbose_name="created at")
    updated_at = models.DateTimeField(auto_now=True, verbose_name="updated at")

    class Meta:
        unique_together = ["userone", "usertwo"]

    def __str__(self):
        return "{} is friends with {}".format(self.userone, self.usertwo)

    def save(self, *args, **kwargs):
        if self.userone == self.usertwo:
            return "Same person friendship should happen mentally"
        else:
            super().save(*args, **kwargs)

serializer:

class FriendSerializer(serializers.ModelSerializer):
    profile2 = serializers.SerializerMethodField()

    class Meta:
        model = Friendship
        fields = [
            "usertwo",
            "profile2"
        ]

    def get_profile2(self, obj):
        profile2_obj = Profile.objects.get(id=obj.usertwo.profile.id)
        profile2 = ProfileSerializer(profile2_obj)
        return profile2.data

and view:

class FriendList(generics.ListAPIView):

    permission_classes = [permissions.IsAuthenticated]

    serializer_class = FriendSerializer
    name = "friends_list"

    def get_queryset(self):
        user = self.kwargs["user"]

        return Friendship.objects.all().filter(userone=user)

The way it's set up is userone will always be the logged in user.

I have searched but cannot find information on how to handle this situation so guidance is appreciated.


来源: stackexchange

问:
Property 'fp_incr' does not exist on type 'Date'
I'm trying to set the minDate to previous 90 days in react-flatpickr instance as mentioned here

But I keep getting the typescript error that the property does not exist.

It has been intermittently solved by adding @ts-ignore for that line

How to solve this?

ContentLicense: CC BY-SA 4.0


问:
PySpark - Transform a data frame from long to wide adding repeating rows with the same ID to new columns
I'm translating a script from R to PySpark and I have the following data frame:

patient_id
test
result

1
PCR
Positive

1
Culture
Negative

2
PCR
Negative

2
CRP
Positive

I want to transform this to wide format like this:

patient_id
test_1
result_1
test_2
result_2

1
PCR
Positive
Culture
Negative

2
PCR
Negative
CRP
Positive

I can get this done in R with dplyr and tidyr using:

```<code>wide_df <- long_df %>%
    group_by(patient_id) %>%
    mutate(rownum = row_number()) %>%
    pivot_wider(names_from = rownum,
                values_from = c(-patient_id, -rownum),
                names_glue = "{.value}_{rownum}",
                names_vary = "slowest") %>%
    ungroup()
</code>```

Would it be possible to do this in PySpark?

I looked for solutions on Stackoverflow but couldn't find one.

Body:
I'm translating a script from R to PySpark and I have the following data frame:

patient_id
test
result

1
PCR
Positive

1
Culture
Negative

2
PCR
Negative

2
CRP
Positive

I want to transform this to wide format like this:

patient_id
test_1
result_1
test_2
result_2

1
PCR
Positive
Culture
Negative

2
PCR
Negative
CRP
Positive

I can get this done in R with dplyr and tidyr using:

wide_df <- long_df %>%
    group_by(patient_id) %>%
    mutate(rownum = row_number()) %>%
    pivot_wider(names_from = rownum,
                values_from = c(-patient_id, -rownum),
                names_glue = "{.value}_{rownum}",
                names_vary = "slowest") %>%
    ungroup()

Would it be possible to do this in PySpark?

I looked for solutions on Stackoverflow but couldn't find one.


问:
Is odata (open data) protocol work with http2
We are seeing partial data downloading when we enable HTTP/2 for odata api endpoints.</p>


问:
MongoDB: Use variable in "from" field in lookup
I have one collection with a structure like this:

```<code>collection: versions

itemID version
abc    42
bcd    43
</code>```

I also have multiple collections, one per version, for example:

```<code>collection: itemData.42

itemID data
abc    {some: stuff}
bcd    {some: old stuff}

collection: itemData.42

itemID data
bcd    {some: new stuff}
</code>```

I can easily fetch the data for item bcd using two queries. First query the current version, here 43, then query from itemData.43 to get {some: new stuff}.

Is there a way to fetch this data using a single query?

Body:
I have one collection with a structure like this:

collection: versions

itemID version
abc    42
bcd    43

I also have multiple collections, one per version, for example:

collection: itemData.42

itemID data
abc    {some: stuff}
bcd    {some: old stuff}

collection: itemData.42

itemID data
bcd    {some: new stuff}

I can easily fetch the data for item bcd using two queries. First query the current version, here 43, then query from itemData.43 to get {some: new stuff}.

Is there a way to fetch this data using a single query?


问:
Configuring winhttrack to download a website that using local storage access token
I faced a website that uses a localstorage access token when a user login and not using the cookies in the request header.

My question is how to configure winhttrack to use the accesstoken from localstorage to download webpages that require authentication.

PS: the website is behind CloudFront cdn.


问:
Pass array of objects to template in Go lang
I'm tried to send an array of object to template in Golang but do not pass the array to template, this is my code:

```<code>foldersVar := []folder{
    folder{FolderName: "OP10", Path: "C:op10"},
    folder{FolderName: "OP14", Path: "C:op14"},
}

_template.Execute(&body, struct {
    Test    string
    Folders []folder
}{
    Test:    "Prueba",
    Folders: foldersVar,
})

err = smtp.SendMail(hostAndport, auth, from, to, body.Bytes())
</code>```

And my template:

```<code><!DOCTYPE html>
<html>
<body>

    <h2>Estas carpetas no se estan respaldando</h2>
    <h3>{{.Test}}</h3>
    {{ range .Folders }}
    <li>{{ .FolderName }}</li>
    {{end}}
</body>
</html>
</code>```

Actually, works only send Test variable but with Folders var not working.

help me please
Thanks.

Body:
I'm tried to send an array of object to template in Golang but do not pass the array to template, this is my code:

foldersVar := []folder{
    folder{FolderName: "OP10", Path: "C:op10"},
    folder{FolderName: "OP14", Path: "C:op14"},
}

_template.Execute(&body, struct {
    Test    string
    Folders []folder
}{
    Test:    "Prueba",
    Folders: foldersVar,
})

err = smtp.SendMail(hostAndport, auth, from, to, body.Bytes())

And my template:

<!DOCTYPE html>

Estas carpetas no se estan respaldando

{{.Test}}

    {{ range .Folders }}

{{ .FolderName }}

    {{end}}

Actually, works only send Test variable but with Folders var not working.

help me please
Thanks.


问:
Parallelism for global window with stateful DoFn on unbounded collection
I am reading documentation about stateful functions in Apache Beam and I don't understand some parts of it.

I found that here if I will not assign any window to PCollection it means that global window will be used by default.

Note that even if you don’t set a windowing function, there is still a window – all elements in your PCollection are assigned to a single global window.

After that I read this article about stateful processing in Apache Beam. I found here that default parallelization for stateful function will be done per key and window.

A state cell in Beam is scoped to a key+window pair.

Am I right in case of usage of unbounded collection with ten unique keys for example I will have ten separate stateful PTransform for each key with infinite state, right?


问:
Disabling NWebsec CSP in Admin folder
I am implementing csp with NWebsec in an MVC application (not core)
I am referring to this post: Applying different Content Security Policies to different directories with NWebSec

I have entries in the web.config file at the root of the site and they work fine. I want to disable the csp on all the admin pages. The route to the admin is ~/Admin. The Admin files are in Areas/Admin and the web.config is in Areas/Admin/Views.
I have found some posts about overriding nwebsec in a location, but nothing I am trying works.
The main web.config has

```<code>  <location path="." allowOverride="true">
        <nwebsec>
    ...
     <content-Security-Policy-Report-Only enabled="true">
    ...
       </content-Security-Policy-Report-Only>

    </nwebsec>
    </location>
</code>```

The web.config in the Areas/Admin/Views folder has

```<code>   <location path="." allowOverride="true">
        <nwebsec>
    ...
     <content-Security-Policy-Report-Only enabled="false">
    ...
       </content-Security-Policy-Report-Only>

    </nwebsec>
    </location>
</code>```

I've also tried
<content-Security-Policy-Report-Only enabled="true"> in the web.config in the Admin folder and changing some of the rules, but the CSP in the root web.config is still being applied.

Thanks for any help.

Title: Disabling NWebsec CSP in Admin folder

Body:
I am implementing csp with NWebsec in an MVC application (not core)
I am referring to this post: Applying different Content Security Policies to different directories with NWebSec

I have entries in the web.config file at the root of the site and they work fine. I want to disable the csp on all the admin pages. The route to the admin is ~/Admin. The Admin files are in Areas/Admin and the web.config is in Areas/Admin/Views.
I have found some posts about overriding nwebsec in a location, but nothing I am trying works.
The main web.config has

  <location path="." allowOverride="true">
        <nwebsec>
    ...
     <content-Security-Policy-Report-Only enabled="true">
    ...
       </content-Security-Policy-Report-Only>

    </nwebsec>
    </location>

The web.config in the Areas/Admin/Views folder has

   <location path="." allowOverride="true">
        <nwebsec>
    ...
     <content-Security-Policy-Report-Only enabled="false">
    ...
       </content-Security-Policy-Report-Only>

    </nwebsec>
    </location>

I've also tried
<content-Security-Policy-Report-Only enabled="true"> in the web.config in the Admin folder and changing some of the rules, but the CSP in the root web.config is still being applied.

Thanks for any help.


问:
How to know if repository's Security policy and Security advisories are Enabled/Disabled with Github API?
I'm trying to get the two following values for a Github repository using the Github API but I've been unsuccessful so far:

Is there a way to get these two information from the API provided by Github, at least for public repos?

Thanks.


问:
SET @myxml.modify not working with leading node Has <leadnode xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2">
Thanks to a lot of help from here i have my update working to a point.
if i do not have the xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" in the xml all works greate but i am receiveing the xml with xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" in the lead node. Why does my modify not work with this xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2"

```<code>DECLARE @myDoc xml
SET @myDoc =
'<?xml version="1.0" encoding="UTF-8"?>
<SyncReceiveDelivery xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2">
  <ApplicationArea>
    <Sender>
      <LogicalID>infor.azure.azure_prd</LogicalID>
      <ComponentID>External</ComponentID>
      <ConfirmationCode>OnError</ConfirmationCode>
    </Sender>
    <CreationDateTime>2022-12-30T08:44:36.267</CreationDateTime>
    <BODID>infor.azure_application_to_AIM_ReceiveDelivery:xyz1234:2022-12-30T08:44:36.267</BODID>
  </ApplicationArea>
  <DataArea>
    <Sync>
      <TenantID>AIM_PRD</TenantID>
      <AccountingEntityID>5140</AccountingEntityID>
      <Location>5140</Location>
      <ActionCriteria>
        <ActionExpression actionCode="Add"/>
      </ActionCriteria>
    </Sync>
    <ReceiveDelivery>
      <ReceiveDeliveryHeader>
        <DocumentID>
          <ID>xyz1234</ID>
        </DocumentID>
        <DocumentDateTime>2022-12-28T11:46:13.7300000</DocumentDateTime>
        <Description>3P Manifest - xyz1234</Description>
        <Status>
          <Code>Pending</Code>
          <Description>Pending</Description>
          <EffectiveDateTime>2022-12-30T14:44:36.3343520Z</EffectiveDateTime>
        </Status>
        <PackingSlip>xyz1234</PackingSlip>
      </ReceiveDeliveryHeader>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            <Code listID="Classes" sequence="1">*</Code>
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">44</ReceivedQuantity>
        <LineNumber>63</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            <Code listID="Classes" sequence="1">*</Code>
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>51</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            <Code listID="Classes" sequence="1">*</Code>
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>75</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            <Code listID="Classes" sequence="1">*</Code>
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">15000000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>75</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
    </ReceiveDelivery>
  </DataArea>
</SyncReceiveDelivery>'

declare @po nvarchar(50)
declare @poline nvarchar(10)
declare @reqline nvarchar(10)

set @po = '14500000999'
set @poline = '1'
set @reqline = '63'

      select  @myDoc

          SET @myDoc.modify('replace value of
    (/SyncReceiveDelivery/DataArea/ReceiveDelivery/ReceiveDeliveryItem[LineNumber[text()=sql:variable("@reqline")]]
        [PurchaseOrderReference/DocumentID/ID[text()=sql:variable("@po")]]
        [PurchaseOrderReference/LineNumber[text()=sql:variable("@poline")]]/ReceivedQuantity/text())[1]
with "99"')
</code>```

removing the xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" works but I receive the xml from a vendor with it so I need to fix the modify/replace to work with xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2"

Body:
Thanks to a lot of help from here i have my update working to a point.
if i do not have the xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" in the xml all works greate but i am receiveing the xml with xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" in the lead node. Why does my modify not work with this xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2"

DECLARE @myDoc xml
SET @myDoc =
'<?xml version="1.0" encoding="UTF-8"?>
<SyncReceiveDelivery xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2">
  <ApplicationArea>
    <Sender>
      <LogicalID>infor.azure.azure_prd</LogicalID>
      <ComponentID>External</ComponentID>
      <ConfirmationCode>OnError</ConfirmationCode>
    </Sender>
    <CreationDateTime>2022-12-30T08:44:36.267</CreationDateTime>
    <BODID>infor.azure_application_to_AIM_ReceiveDelivery:xyz1234:2022-12-30T08:44:36.267</BODID>
  </ApplicationArea>
  <DataArea>
    <Sync>
      <TenantID>AIM_PRD</TenantID>
      <AccountingEntityID>5140</AccountingEntityID>
      <Location>5140</Location>
      <ActionCriteria>
        <ActionExpression actionCode="Add"/>
      </ActionCriteria>
    </Sync>
    <ReceiveDelivery>
      <ReceiveDeliveryHeader>
        <DocumentID>
          <ID>xyz1234</ID>
        </DocumentID>
        <DocumentDateTime>2022-12-28T11:46:13.7300000</DocumentDateTime>
        <Description>3P Manifest - xyz1234</Description>
        <Status>
          Pending
          <Description>Pending</Description>
          <EffectiveDateTime>2022-12-30T14:44:36.3343520Z</EffectiveDateTime>
        </Status>
        <PackingSlip>xyz1234</PackingSlip>
      </ReceiveDeliveryHeader>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            *
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">44</ReceivedQuantity>
        <LineNumber>63</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            *
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>51</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            *
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">14500000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>75</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
      <ReceiveDeliveryItem>
        <Classification>
          <Codes>
            *
          </Codes>
        </Classification>
        <ServiceIndicator/>
        <PurchaseOrderReference>
          <DocumentID>
            <ID accountingEntity="9991" lid="lid://infor.eam.aim_prd" location="9991">15000000999</ID>
          </DocumentID>
          <LineNumber>1</LineNumber>
        </PurchaseOrderReference>
        <ReceivedQuantity unitCode="EA">100</ReceivedQuantity>
        <LineNumber>75</LineNumber>
        <UserArea>
          <Property>
            <NameValue name="UDFCHAR02">S00603851</NameValue>
          </Property>
          <Property>
            <NameValue name="UDFCHAR03">1</NameValue>
          </Property>
        </UserArea>
      </ReceiveDeliveryItem>
    </ReceiveDelivery>
  </DataArea>
</SyncReceiveDelivery>'

declare @po nvarchar(50)
declare @poline nvarchar(10)
declare @reqline nvarchar(10)

set @po = '14500000999'
set @poline = '1'
set @reqline = '63'

      select  @myDoc

          SET @myDoc.modify('replace value of
    (/SyncReceiveDelivery/DataArea/ReceiveDelivery/ReceiveDeliveryItem[LineNumber[text()=sql:variable("@reqline")]]
        [PurchaseOrderReference/DocumentID/ID[text()=sql:variable("@po")]]
        [PurchaseOrderReference/LineNumber[text()=sql:variable("@poline")]]/ReceivedQuantity/text())[1]
with "99"')

removing the xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2" works but I receive the xml from a vendor with it so I need to fix the modify/replace to work with xmlns="http://schema.infor.com/InforOAGIS/2" releaseID="9.2"


问:
Using wheelnav.js on Vue 3 project
So I have seen this pie menu generator which gives you an HTML, CSS and JS code and I wanted to use it in my Vue 3 project. I am new to vue and this was how I imported it.

here is the link to the pie menu generator: http://pmg.softwaretailoring.net/

I did this in my wrapper component. Somehow this bought many errors in which I think is because of how I imported the JS library.

```<code><template>
    <div class="context-menu" v-show="show" :style="style" ref="context" tabindex="0" @blur="close">
        <div id='piemenu' data-wheelnav data-wheelnav-slicepath='DonutSlice' data-wheelnav-marker
            data-wheelnav-markerpath='PieLineMarker' data-wheelnav-rotateoff data-wheelnav-navangle='270'
            data-wheelnav-cssmode data-wheelnav-init>
            <div data-wheelnav-navitemtext='0' onmouseup='alert("Place your logic here.");'></div>
            <div data-wheelnav-navitemtext='1' onmouseup='alert("Place your logic here.");'></div>
        </div>
    </div>
</template>

<script>
import '../assets/raphael.min.js'
import '../assets/raphael.icons.min.js'
import '../assets/wheelnav.min.js'

var piemenu = new wheelnav('piemenu');
piemenu.wheelRadius = piemenu.wheelRadius * 0.83;
piemenu.createWheel();

export default {
    name: 'CmpContextMenu',
    props: {
        display: Boolean, // prop detect if we should show context menu
    },
    data() {
        return {
            left: 0, // left position
            top: 0, // top position
            show: false, // affect display of context menu
        };
    },
    computed: {
        // get position of context menu
        style() {
            return {
                top: this.top + 'px',
                left: this.left + 'px',
            };
        },
    },
    methods: {
        // closes context menu
        close() {
            this.show = false;
            this.left = 0;
            this.top = 0;
            this.myTrigger = false;
            console.log('trigger false');
        },
        open(evt) {
            this.show = true;
            // updates position of context menu
            this.left = evt.pageX || evt.clientX;
            this.top = evt.pageY || evt.clientY;
        },
    },
};
</script>

<style>
.context-menu {
    position: fixed;
    z-index: 999;
    cursor: pointer;
}

#piemenu>svg {
    width: 100%;
    height: 100%;
}

#piemenu {
    height: 400px;
    width: 400px;
    margin: auto;
}

@media (max-width: 400px) {
    #piemenu {
        height: 300px;
        width: 300px;
    }
}

[class|=wheelnav-piemenu-slice-basic] {
    fill: #497F4C;
    stroke: none;
}

[class|=wheelnav-piemenu-slice-selected] {
    fill: #497F4C;
    stroke: none;
}

[class|=wheelnav-piemenu-slice-hover] {
    fill: #497F4C;
    stroke: none;
    fill-opacity: 0.77;
    cursor: pointer;
}

[class|=wheelnav-piemenu-title-basic] {
    fill: #333;
    stroke: none;
}

[class|=wheelnav-piemenu-title-selected] {
    fill: #fff;
    stroke: none;
}

[class|=wheelnav-piemenu-title-hover] {
    fill: #222;
    stroke: none;
    cursor: pointer;
}

[class|=wheelnav-piemenu-title]>tspan {
    font-family: Impact, Charcoal, sans-serif;
    font-size: 24px;
}

.wheelnav-piemenu-marker {
    stroke: #444;
    stroke-width: 2;
}
</style>
</code>```

Title: Using wheelnav.js on Vue 3 project

Body:
So I have seen this pie menu generator which gives you an HTML, CSS and JS code and I wanted to use it in my Vue 3 project. I am new to vue and this was how I imported it.

here is the link to the pie menu generator: http://pmg.softwaretailoring.net/

I did this in my wrapper component. Somehow this bought many errors in which I think is because of how I imported the JS library.

<template>

</template>


问:
Enabling FIPS mode in RHEL 7.9 causing Thunderbird to crash
Our organization is making required changes for compliance, and enabling FIPS mode on all of our systems is one of the requirements.

Yesterday, FIPS mode was enabled on two Red Hat 7.9 systems, and after rebooting, the users can still receive emails, but when they try to send an email, Thunderbird (version 102.6.0-2.el7_9.x86_64) prompts them for a password. When they provide the password and click "enter", Thunderbird immediately crashes.

After sudo cat /var/log/messages | grep thunderbird, I see the following entries which stand out (I've omitted user IDs, names, and dates):

[date/time][username] abrt-hook-ccpp: Process 11654 (thunderbird) of user [##########] killed by SIGSEGV - dumping core

[date/time][username] rtkit-daemon[1102]: Successfully made thread 4672 of process 4473 (/usr/lib64/thunderbird/thunderbird) owned by '##########' RT at priority 10.

[date/time][username] dbus[1072]: [system] Rejected send message, 0 matched rules; type="method_return", sender=":1.1" (uid=70 pid=1066 comm="avahi-daemon: starting up ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.114" (uid=########## pid=4473 comm="thunderbird ")

Originally, the users had older Thunderbird versions installed (one had v68 and the other had v91), and upgrading Thunderbird to this newer version did nothing to fix the problem.

We also tried disabling FIPS mode to confirm that was the actual cause, and email worked fine afterward. Upon enabling FIPS mode again, the problem returned.

Any ideas how to approach this? Thanks in advance for any help.

Marshall


问:
Apache echart Json Data contains spend in place of value
Hi I am using apache echart so for the i have created the used the example script

```<code>option = {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    top: '5%',
    left: 'center'
  },
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: ['40%', '70%'],
      avoidLabelOverlap: false,
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 40,
          fontWeight: 'bold'
        }
      },
      labelLine: {
        show: false
      },
      data: [
       {name: 'test1', spend1: 12468.31},
       {name: 'test2', spend2: 2322}
      ]

    }
  ]
};
</code>```

In this case labels are visible test 1 and test2 but piechart is not visible . I am new to this can anyone help me how can recplace spend 1 AND spend2 with value.

Solution for my json data so that pie chart will be visible

Body:
Hi I am using apache echart so for the i have created the used the example script

option = {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    top: '5%',
    left: 'center'
  },
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: ['40%', '70%'],
      avoidLabelOverlap: false,
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 40,
          fontWeight: 'bold'
        }
      },
      labelLine: {
        show: false
      },
      data: [
       {name: 'test1', spend1: 12468.31},
       {name: 'test2', spend2: 2322}
      ]

    }
  ]
};

In this case labels are visible test 1 and test2 but piechart is not visible . I am new to this can anyone help me how can recplace spend 1 AND spend2 with value.

Solution for my json data so that pie chart will be visible


问:
Android draw path given the Z position
I want to draw multiple paths (lines) But I want to specify the Z position of each line.

In IOS they have something as:

```<code>/* The Z component of the layer's position in its superlayer. Defaults
 * to zero. Animatable. */

open var zPosition: CGFloat
</code>```

Where you can tell the Z layer position. But in Android Canvas doesn't seem to have a method constructor to pass the Z position.

Does anyone have any idea how to do this in Android?
Thanks, guys

Title: Android draw path given the Z position

Body:
I want to draw multiple paths (lines) But I want to specify the Z position of each line.

In IOS they have something as:

/* The Z component of the layer's position in its superlayer. Defaults
 * to zero. Animatable. */

open var zPosition: CGFloat

Where you can tell the Z layer position. But in Android Canvas doesn't seem to have a method constructor to pass the Z position.

Does anyone have any idea how to do this in Android?
Thanks, guys


问:
How to figure out how this file was encoded? Cant seem to open it properly to read the contents
I cant seem to open this .dat file to read ECG data from it.

```<code>import chardet

with open("rec_1.dat", "rb") as f:
    result = chardet.detect(f.read())

with open("rec_1.dat", "r", encoding=result["encoding"]) as f:
    data = f.read()

print(data)`
</code>```

Here's the code I tried and this

```<code>"UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1396: character maps to <undefined>"
</code>```

is the error I keep getting, I can't seem to decode this file and the website (https://physionet.org/content/ecgiddb/1.0.0/) doesn't give me any hints on how this was encoded either.

Body:
I cant seem to open this .dat file to read ECG data from it.

import chardet

with open("rec_1.dat", "rb") as f:
    result = chardet.detect(f.read())

with open("rec_1.dat", "r", encoding=result["encoding"]) as f:
    data = f.read()

print(data)`

Here's the code I tried and this

"UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1396: character maps to <undefined>"

is the error I keep getting, I can't seem to decode this file and the website (https://physionet.org/content/ecgiddb/1.0.0/) doesn't give me any hints on how this was encoded either.


问:
S3 disposable url
I need to create a S3 presigned url that expires after one use.

I have tried to create presigned url with near expiration date, but in my case is not enough.

is there a method to do this?

Title: S3 disposable url


问:
How to provide Hlit SingletonComponent to Dagger 2 dependencies in Hilt migration?
One of our Dagger 2 components looks like this:

```<code>@Component(modules = [FragmentAModule::class], dependencies = [AppComponent::class])
@ViewScope
interface FragmentAComponent {
    fun inject(fragment: FragmentA)
}
</code>```

And we inject it on a Fragment like this:

```<code>DaggerFragmentAComponent.builder()
    .appComponent(App.appComponent())
    .build()
    .inject(this)
</code>```

Now I am trying to migrate Dagger 2 to Hilt, however, we can not migrate all at the same time, so I am trying to migrate only App-wise Singletons first, but I am not sure how to replace the dependencies = [AppComponent::class]) part and also appComponent(App.component()) part.

Is there any way to get Hilt SingletonComponent to use in Dagger 2 part?

I really appreciate any help you can provide.

Body:
One of our Dagger 2 components looks like this:

@Component(modules = [FragmentAModule::class], dependencies = [AppComponent::class])
@ViewScope
interface FragmentAComponent {
    fun inject(fragment: FragmentA)
}

And we inject it on a Fragment like this:

DaggerFragmentAComponent.builder()
    .appComponent(App.appComponent())
    .build()
    .inject(this)

Now I am trying to migrate Dagger 2 to Hilt, however, we can not migrate all at the same time, so I am trying to migrate only App-wise Singletons first, but I am not sure how to replace the dependencies = [AppComponent::class]) part and also appComponent(App.component()) part.

Is there any way to get Hilt SingletonComponent to use in Dagger 2 part?

I really appreciate any help you can provide.


问:
ffmpeg in Docker not recording the whole screen with Selenium
I am having issues recording Selenium tests in Docker.
I am using Selenium Standalone and ffmpeg.
The problem I am having is with the recording. FFMPEG is not recording my entire screen, only about 70% of it. This means that I am missing a part of the screen on the right side and on the bottom.
I have verified that the whole page is being rendered correctly in full size... it is only the video that is not recording the whole screen.
Can you advise how to modify the staring script to record the whole screen in 1920x1080?
This is my Execute Windows batch command in Jenkins:</p>
```<code>docker stop %inContainerName%%inDockerSeleniumPort%
docker rm %inContainerName%%inDockerSeleniumPort%
docker stop %inVideoContainerName%%inDockerSeleniumPort%
docker rm %inVideoContainerName%%inDockerSeleniumPort%
docker network rm %inNetworkName%%inDockerSeleniumPort%

docker network create %inNetworkName%%inDockerSeleniumPort%
docker run -e SCREEN_HEIGHT=1080 -e SCREEN_WIDTH=1920 --env NO_PROXY="xxxx" --env HTTP_PROXY="xxx" --env HTTPS_PROXY="xxx" -d -p %inDockerSeleniumPort%:4444 -p %inDockerVNCPort%:5900 --net %inNetworkName%%inDockerSeleniumPort% --name %inContainerName%%inDockerSeleniumPort% --shm-size="2g" %inSeleniumImageName%
docker run -e SCREEN_HEIGHT=1080 -e SCREEN_WIDTH=1920 -e FILE_NAME=video%inDockerSeleniumPort%.mp4 -e DISPLAY_CONTAINER_NAME=selenium%inDockerSeleniumPort% -d --net %inNetworkName%%inDockerSeleniumPort% --name %inVideoContainerName%%inDockerSeleniumPort% -v C:\ProgramData\Docker\tmp\videos:/videos %inVideoImageName%
</code>```

Body:
I am having issues recording Selenium tests in Docker.
I am using Selenium Standalone and ffmpeg.
The problem I am having is with the recording. FFMPEG is not recording my entire screen, only about 70% of it. This means that I am missing a part of the screen on the right side and on the bottom.
I have verified that the whole page is being rendered correctly in full size... it is only the video that is not recording the whole screen.
Can you advise how to modify the staring script to record the whole screen in 1920x1080?
This is my Execute Windows batch command in Jenkins:

docker stop %inContainerName%%inDockerSeleniumPort%
docker rm %inContainerName%%inDockerSeleniumPort%
docker stop %inVideoContainerName%%inDockerSeleniumPort%
docker rm %inVideoContainerName%%inDockerSeleniumPort%
docker network rm %inNetworkName%%inDockerSeleniumPort%

docker network create %inNetworkName%%inDockerSeleniumPort%
docker run -e SCREEN_HEIGHT=1080 -e SCREEN_WIDTH=1920 --env NO_PROXY="xxxx" --env HTTP_PROXY="xxx" --env HTTPS_PROXY="xxx" -d -p %inDockerSeleniumPort%:4444 -p %inDockerVNCPort%:5900 --net %inNetworkName%%inDockerSeleniumPort% --name %inContainerName%%inDockerSeleniumPort% --shm-size="2g" %inSeleniumImageName%
docker run -e SCREEN_HEIGHT=1080 -e SCREEN_WIDTH=1920 -e FILE_NAME=video%inDockerSeleniumPort%.mp4 -e DISPLAY_CONTAINER_NAME=selenium%inDockerSeleniumPort% -d --net %inNetworkName%%inDockerSeleniumPort% --name %inVideoContainerName%%inDockerSeleniumPort% -v C:\ProgramData\Docker\tmp\videos:/videos %inVideoImageName%


问:
How to use Dependency inject when using a service layer with Entity Framework Core?
My project is an ASP.NET Core 6 Web API. I am using Entity Framework Core and built-in dependency injection.

Program.cs:

```<code>var builder = WebApplication.CreateBuilder(args);
...
builder.Services.AddDbContext<myService>(options => options.UseSqlServer(ConnStr));
builder.Services.AddDbContext<anotherService>(options => options.UseSqlServer(anotherConnStr));
...
</code>```

myController.cs:

```<code>public class myController : ControllerBase
{
    private readonly myService _context;

    public myController(myService context)
    {
        _context = context;
    }

    // ... Routes use either db models directly or methods from myService
}
</code>```

myService.cs:

I'm using myContext as a base class so I can access the db tables directly in my controller.

Any better way to do this? db = this;

How do I inject this service?

```<code>private readonly anotherService anotherdb;
</code>```
```<code>public class myService : myContext
{
    private readonly myContext db;
    private readonly anotherService anotherdb;

    public myService(DbContextOptions<myService> options) : base(options)
    {
        // inject myContext, works but doesn't feel right.
        db = this;

        // how do I inject this?
        anotherdb = new anotherService();
    }

    public IQueryable<mytable> Getdata()
    {
        var q = from s in db.mytable
                select s;

        return q;
    }
    // ...
}
</code>```

myContext.cs:

```<code>public partial class myContext : DbContext
{
    public myContext()
    {
    }

    public myContext(DbContextOptions<myContext> options)
        : base(options)
    {
    }

    protected myContext(DbContextOptions options)
        : base(options)
    {
    }

    // ...
}
</code>```

I have lots of services all with the same design, how can I inject another service into myService.cs?

Body:
My project is an ASP.NET Core 6 Web API. I am using Entity Framework Core and built-in dependency injection.

Program.cs:

var builder = WebApplication.CreateBuilder(args);
...
builder.Services.AddDbContext<myService>(options => options.UseSqlServer(ConnStr));
builder.Services.AddDbContext<anotherService>(options => options.UseSqlServer(anotherConnStr));
...

myController.cs:

public class myController : ControllerBase
{
    private readonly myService _context;

    public myController(myService context)
    {
        _context = context;
    }

    // ... Routes use either db models directly or methods from myService
}

myService.cs:

I'm using myContext as a base class so I can access the db tables directly in my controller.

Any better way to do this? db = this;

How do I inject this service?

private readonly anotherService anotherdb;

public class myService : myContext
{
    private readonly myContext db;
    private readonly anotherService anotherdb;

    public myService(DbContextOptions<myService> options) : base(options)
    {
        // inject myContext, works but doesn't feel right.
        db = this;

        // how do I inject this?
        anotherdb = new anotherService();
    }

    public IQueryable<mytable> Getdata()
    {
        var q = from s in db.mytable
                select s;

        return q;
    }
    // ...
}

myContext.cs:

public partial class myContext : DbContext
{
    public myContext()
    {
    }

    public myContext(DbContextOptions<myContext> options)
        : base(options)
    {
    }

    protected myContext(DbContextOptions options)
        : base(options)
    {
    }

    // ...
}

I have lots of services all with the same design, how can I inject another service into myService.cs?


问:
How to detect leak in non-heap memory in Node JS?
Our NodeJS application is facing memory leak issues for a while. Unlike other heap memory leak issues, I found there is a leak in non-heap using NewRelic APM tool. I'm using node 14.15.5 version.

I had gone through various articles to detect memory leaks in heap section but couldn't find one for non-heap. Due to this, GC metrics are poor which in turn increases avg. latency of the application. How do I find the non-heap memory leak? Does NodeJS upgrade helps?


问:
ASP.NET application not accessible through Apache proxy on Linux
I need to clarify the process of pointing a web domain to a running ASP.NET application on a raspberry pi. The application is developed and ready, and the website is up and running. I have researched multiple posts and can't find anything wrong with my proxy redirect.

Is dotnet blocking the recieved redirect in someway by locking out any external visitors from the application?

Since there are multiple ways of setting up such an environment. Do I need to configure both an XForwarding in my application as well as a ProxyPass in Apache?

I have an SSL via Letsencrypt, protecting the traffic on my website. This worked fine when running a simple HTML/CSS layout. Do I need to acquire a certificate for my application aswell?

Overall the setup is not working, and I'm itching to understand why. Most threads seem to imply its as simple as running the app on port x -> pointing to port x -> success. For me this isn't working...

Through wget I successfully reach my website via both ports (since I redirect HTTP to HTTPS). By entering the localhost:port into browser I can find the application. Why is my proxy not working?

Accessing my website

https://localhost:7199

Apache2 Virtual host

```<code><VirtualHost *:80>
        ServerName www.website.com
        RedirectPermanent / https://www.website.com
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName www.website.com
        ServerAlias www.website.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://localhost:7199/
        ProxyPassReverse / http://localhost:7199/

        SSLEngine On
        SSLCertificateFile /etc/letsencrypt/live/www.website.com/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/www.website.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/www.website.com/chain.pem
</VirtualHost>
</IfModule>
</code>```

All and any thoughts are very appreciated. Thanks for reading!

Body:
I need to clarify the process of pointing a web domain to a running ASP.NET application on a raspberry pi. The application is developed and ready, and the website is up and running. I have researched multiple posts and can't find anything wrong with my proxy redirect.

Is dotnet blocking the recieved redirect in someway by locking out any external visitors from the application?

Since there are multiple ways of setting up such an environment. Do I need to configure both an XForwarding in my application as well as a ProxyPass in Apache?

I have an SSL via Letsencrypt, protecting the traffic on my website. This worked fine when running a simple HTML/CSS layout. Do I need to acquire a certificate for my application aswell?

Overall the setup is not working, and I'm itching to understand why. Most threads seem to imply its as simple as running the app on port x -> pointing to port x -> success. For me this isn't working...

Through wget I successfully reach my website via both ports (since I redirect HTTP to HTTPS). By entering the localhost:port into browser I can find the application. Why is my proxy not working?

Accessing my website

https://localhost:7199

Apache2 Virtual host

<VirtualHost *:80>
        ServerName www.website.com
        RedirectPermanent / https://www.website.com
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName www.website.com
        ServerAlias www.website.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://localhost:7199/
        ProxyPassReverse / http://localhost:7199/

        SSLEngine On
        SSLCertificateFile /etc/letsencrypt/live/www.website.com/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/www.website.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/www.website.com/chain.pem
</VirtualHost>
</IfModule>

All and any thoughts are very appreciated. Thanks for reading!


问:
Download file with limited speed in ASP.NET Core 7
I have an ASP.NET Core website & I there's a large file to download. So I want to make a limitation for unauthorized users & limit their download speed for that file to 50 kb/s.

I've checked rate limiting solutions, but they didn't do this actually. This is what I want:

```<code>if (User.Identity.IsAuthenticated)
{
    // Download file with unlimited speed
}
else
{
    // Download file with limited speed
}
</code>```

Body:
I have an ASP.NET Core website & I there's a large file to download. So I want to make a limitation for unauthorized users & limit their download speed for that file to 50 kb/s.

I've checked rate limiting solutions, but they didn't do this actually. This is what I want:

if (User.Identity.IsAuthenticated)
{
    // Download file with unlimited speed
}
else
{
    // Download file with limited speed
}


问:
Vapor: How to get response URL using Vapor Client or async-http
Something I'm running into when using Vapor to crawl sites is if I enter a url like http://website(dot)com and it redirects to https://www.website(dot)com, I need to grab that final response URL to know what the final page URL is.

I can do this with URLSession but I'm not seeing something similar in the Vapor client. I tried using the Vapor client and the async-http package it's built on and I can't find the page URL listed in the response.

Any pointers would be appreciated, thank you.

Example getting this info using URLSession

```<code>if let url = URL(string: self) {
            do {
                let(_, response) = try await URLSession.shared.data(from: url)
                if let responseURL = response.url {
                    result = responseURL.description
                    return result
                }
            } catch {
            }
        }

</code>```

Where this is the first line of the response, and you can easily use response.url to grab the below "URL" value:

```<code><NSHTTPURLResponse: 0x600000210c00> { URL: https://github.com/ } { Status Code: 200, Headers {

</code>```

Body:
Something I'm running into when using Vapor to crawl sites is if I enter a url like http://website(dot)com and it redirects to https://www.website(dot)com, I need to grab that final response URL to know what the final page URL is.

I can do this with URLSession but I'm not seeing something similar in the Vapor client. I tried using the Vapor client and the async-http package it's built on and I can't find the page URL listed in the response.

Any pointers would be appreciated, thank you.

Example getting this info using URLSession

if let url = URL(string: self) {
            do {
                let(_, response) = try await URLSession.shared.data(from: url)
                if let responseURL = response.url {
                    result = responseURL.description
                    return result
                }
            } catch {
            }
        }

Where this is the first line of the response, and you can easily use response.url to grab the below "URL" value:

<NSHTTPURLResponse: 0x600000210c00> { URL: https://github.com/ } { Status Code: 200, Headers {


问:
Fix blurry/distorted text within HtmlWidget, Flutter
I am trying to show an IFrame of the Spotify embed on my flutter website, however due to a know flutter issue the element itself aswell as its contents are blurry/distorted.

Image of distorted Spotify embed: Imgur image

This is a known issue since 2019 and flutter is still "fixing" it, however even there being multiple workarounds for text's via TextTheme I found none working for the HtmlWidget, mostly due to TextTheme not being available for the widget, reference:

Flutter issue 32274
Flutter issue 81215
Here's also an similar question but not that detailed: Unanswered duplicate
I tried all given workarounds within the issues that where upvoted and feasible.

Here is the HTML string and my implementation:

```<code>// HTML:
final String htmlcode = """
    <body>
     <iframe style="border-radius:12px" src="https://open.spotify.com/embed/track/7vQbuQcyTflfCIOu3Uzzya" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
      </body>"""

// Implementation:
Column(
  children: [
    HtmlWidget(
      htmlcode,
      buildAsync: true,
      textStyle: const TextStyle(
          fontFeatures: [FontFeature.proportionalFigures()]),
    ),
  ],
)),
</code>```

I would be very happy if someone has a workaround or knows a different way of displaying it, so there aren't any distortions.

Body:
I am trying to show an IFrame of the Spotify embed on my flutter website, however due to a know flutter issue the element itself aswell as its contents are blurry/distorted.

Image of distorted Spotify embed: Imgur image

This is a known issue since 2019 and flutter is still "fixing" it, however even there being multiple workarounds for text's via TextTheme I found none working for the HtmlWidget, mostly due to TextTheme not being available for the widget, reference:

Flutter issue 32274
Flutter issue 81215
Here's also an similar question but not that detailed: Unanswered duplicate
I tried all given workarounds within the issues that where upvoted and feasible.

Here is the HTML string and my implementation:

// HTML:
final String htmlcode = """

      """

// Implementation:
Column(
  children: [
    HtmlWidget(
      htmlcode,
      buildAsync: true,
      textStyle: const TextStyle(
          fontFeatures: [FontFeature.proportionalFigures()]),
    ),
  ],
)),

I would be very happy if someone has a workaround or knows a different way of displaying it, so there aren't any distortions.


问:
Auto-scale AKS with keda and AzuredevOps Server
I follow instruction described here https://learn.microsoft.com/en-us/azure/aks/keda-about to setup keda with AKS and have a concrete workflow using self-hosted Azuredevops agent.

I do confirm everything is working fine when my agent pool is hosted on AzureDevOps service.
I would like to do same with azuredevops server. Here what i get:

AKS is connected to VNET which is connected to my on-premises network

Self-hosted agent can register to my AzureDevOps server instance

To make it works i needed to customize my etc/hosts file and also add the .crt certificate required by AzureDevops for registration

So far so good my Self-hosted agent do the job for pipeline build&release

my Agent belongs to namespace 'default'

My issue is related to Keda which failed because of certificate

```<code>ERROR   Failed to create new HPA resource   {"controller": "scaledobject", "controllerGroup": "keda.sh", "controllerKind": "ScaledObject", "scaledObject": {"name":"azure-pipelines-scaledobject","namespace":"default"}, "namespace": "default", "name": "azure-pipelines-scaledobject", "reconcileID": "76554c6b-3876-4e83-8ce2-b6966e9b10ec", "HPA.Namespace": "default", "HPA.Name": "keda-hpa-azure-pipelines-scaledobject", "error": "error parsing azure Pipelines metadata: Get \"https://myazuredevops.mydomain.lan/MyCollection/_apis/distributedtask/pools?poolName=My-pool\": x509: certificate signed by unknown authority"}
</code>```

As you can see keda-operator tries to join my Azuredevops instance with name 'myazuredevops.mydomain.lan' but failed because of certificate.

I try to setup my custom certificate as described here https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority but i am not sure to doing things good.

Is there any member who succedeed to setup keda with AzureDevopsServer ? How do you solve certificate issue ?

My understanding is that we could configure a certificate at AKS cluster and then any pod could beneficiate it ? Is it how it works ? If yes how can achieve that?

Thx

Body:
I follow instruction described here https://learn.microsoft.com/en-us/azure/aks/keda-about to setup keda with AKS and have a concrete workflow using self-hosted Azuredevops agent.

I do confirm everything is working fine when my agent pool is hosted on AzureDevOps service.
I would like to do same with azuredevops server. Here what i get:

AKS is connected to VNET which is connected to my on-premises network

Self-hosted agent can register to my AzureDevOps server instance

To make it works i needed to customize my etc/hosts file and also add the .crt certificate required by AzureDevops for registration

So far so good my Self-hosted agent do the job for pipeline build&release

my Agent belongs to namespace 'default'

My issue is related to Keda which failed because of certificate

ERROR   Failed to create new HPA resource   {"controller": "scaledobject", "controllerGroup": "keda.sh", "controllerKind": "ScaledObject", "scaledObject": {"name":"azure-pipelines-scaledobject","namespace":"default"}, "namespace": "default", "name": "azure-pipelines-scaledobject", "reconcileID": "76554c6b-3876-4e83-8ce2-b6966e9b10ec", "HPA.Namespace": "default", "HPA.Name": "keda-hpa-azure-pipelines-scaledobject", "error": "error parsing azure Pipelines metadata: Get \"https://myazuredevops.mydomain.lan/MyCollection/_apis/distributedtask/pools?poolName=My-pool\": x509: certificate signed by unknown authority"}

As you can see keda-operator tries to join my Azuredevops instance with name 'myazuredevops.mydomain.lan' but failed because of certificate.

I try to setup my custom certificate as described here https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority but i am not sure to doing things good.

Is there any member who succedeed to setup keda with AzureDevopsServer ? How do you solve certificate issue ?

My understanding is that we could configure a certificate at AKS cluster and then any pod could beneficiate it ? Is it how it works ? If yes how can achieve that?

Thx


问:
Comparing Three Cell Values
I’m wanting to be able to automatically highlight cells That are blank in the intersection of 2 other cells if their value is 0

Like say B10 = 1
and i8 =1

the intersection of those would be cell I10 and if that is 0 I’m wanting the box to be highlighted

however say B10 = 1  and J8 equals 0
j10 would be left alone.

comparing the Values From I8-P8 to check if they are >0 and if B10-B309 >0 Then check if the intersection from B’s Row against whichever columns row 8. is 0 and if so highlights. Hopefully that made sense.

I did get it to work with conditional formatting, however. I'd have to adjust the formula for each and every cell in 8 Columns times 300 rows... It gets tedious, especially as I’m looking into expanding the document past 300.

The current formula I used is

```<code>=and($B10>0, I$8>0, I10=0)
</code>```

I'm not sure if I should use VBA to do this instead of conditional formatting.

Title: Comparing Three Cell Values

Body:
I’m wanting to be able to automatically highlight cells That are blank in the intersection of 2 other cells if their value is 0

Like say B10 = 1
and i8 =1

the intersection of those would be cell I10 and if that is 0 I’m wanting the box to be highlighted

however say B10 = 1  and J8 equals 0
j10 would be left alone.

comparing the Values From I8-P8 to check if they are >0 and if B10-B309 >0 Then check if the intersection from B’s Row against whichever columns row 8. is 0 and if so highlights. Hopefully that made sense.

I did get it to work with conditional formatting, however. I'd have to adjust the formula for each and every cell in 8 Columns times 300 rows... It gets tedious, especially as I’m looking into expanding the document past 300.

The current formula I used is

=and($B10>0, I$8>0, I10=0)

I'm not sure if I should use VBA to do this instead of conditional formatting.


问:
Sagepay/Opayo PHP 7.4 integration without mcrypt
I use a PHP class to generate the crypt field for SagePay/Opayo but it uses mcrypt. My hosting company has now upgraded my webserver to PHP7.4 and mcrypt is no longer supported.

Ideally I'd like to just replace the following two functions with functions that don't use mcrypt (but do the same thing):

protected function encryptAndEncode($strIn) {
$strIn = $this->pkcs5_pad($strIn, 16);
return "@".bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptPassword, $strIn, MCRYPT_MODE_CBC, $this->encryptPassword));
}

protected function decodeAndDecrypt($strIn) {
$strIn = substr($strIn, 1);
$strIn = pack('H*', $strIn);
return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->encryptPassword, $strIn, MCRYPT_MODE_CBC, $this->encryptPassword);
}

*the encryptPassword is my SagePay/Opayo encryption password.

SagePay used to provide example code but they don't do that anymore. They say the crypt string must be encrypted using AES (block size 128-bit) in CBC mode with PKCS#5 padding. Use the provided encryption password as both the key and initialisation vector and encode the result in hex (making sure the letters are in upper case).

Prepend the ‘@’ sign to the beginning of the encoded result.
To decrypt, ensure you remove the ‘@’ sign before using the same procedure in decryption mode.

I did find two similar posts on the forum (Sagepay integration without mcrypt and Sage Pay / Opayo Form integration - replacing mcrypt with openssl), both used openssl but the answer was specific to the code provided by the poster and I couldn't figure out how to modify it to suit my two functions.

If I try the existing code I get this error:

Fatal error:  Uncaught Error: Call to undefined function mcrypt_encrypt()

I hope someone can help.

Thanks,


问:
How to add icons or emoji in django admin buttons
So I have some buttons in django admin and I need to add something like that: ⬅➡↩↪ to my admin buttons, but I have 0 idea how to do this and I feel like I am the first ever person to ask that question on the internet, google didnt help :)) Can you guys suggest something?</p>


问:
Immutables Library Does Not Require Collection Attributes To Be Set
I recently started using the Immutables library, and I'm puzzled by the following behavior:

Given the following abstract value type

```<code>@Value.Immutable
public abstract class Foo {
    public abstract String bar();

    public abstract List<String> baz();
}
</code>```

attempting to build an object like so

```<code>ImmutableFoo.builder()
    .baz(List.of("1", "2", "3"))
    .build()
</code>```

fails because

some of required attributes are not set [bar]

yet

```<code>ImmutableFoo.builder()
    .bar("1, 2, 3")
    .build()
</code>```

is fine, and there is no objection that baz has not been set.

Why do collection attributes receive different treatment?

Body:
I recently started using the Immutables library, and I'm puzzled by the following behavior:

Given the following abstract value type

@Value.Immutable
public abstract class Foo {
    public abstract String bar();

    public abstract List<String> baz();
}

attempting to build an object like so

ImmutableFoo.builder()
    .baz(List.of("1", "2", "3"))
    .build()

fails because

some of required attributes are not set [bar]

yet

ImmutableFoo.builder()
    .bar("1, 2, 3")
    .build()

is fine, and there is no objection that baz has not been set.

Why do collection attributes receive different treatment?


问:
WP: WooCommerce How to create checkout link for multiple products
I have checkout links for adding a product to a cart, like this:

```<code>https://somedomain.com/checkout/?add-to-cart=13&quantity=5
</code>```

and it works fine, but I'm trying to make such links for multiple products(2-5) and I want to get something like this:

```<code>https://somedomain.com/checkout/?add-to-cart=13&quantity=5,add-to-cart=22&quantity=1,add-to-cart=77&quantity=16
</code>```

Any ideas how to make it?

Body:
I have checkout links for adding a product to a cart, like this:

https://somedomain.com/checkout/?add-to-cart=13&quantity=5

and it works fine, but I'm trying to make such links for multiple products(2-5) and I want to get something like this:

https://somedomain.com/checkout/?add-to-cart=13&quantity=5,add-to-cart=22&quantity=1,add-to-cart=77&quantity=16

Any ideas how to make it?


问:
Export selected images from google earth engine to my computer drive
Please ca anyone let me know if it is possible to export (download) images which I have isolated in google earth engine to my computer drive.

Here is the code I have used so far:

```<code>    var l7 = ee.ImageCollection("LANDSAT/LE07/C02/T1_RT"),

    var finneyp = /* color: #009999 */ee.Geometry.Polygon(
        [[[-101.10479068823119, 38.222990984564724],
          [-101.08281803198119, 37.75325690679087],
          [-100.65709781713744, 37.7445700041578],
          [-100.66259098119994, 38.000404636277544],
          [-100.26159000463744, 38.00689732153255],
          [-100.26433658666869, 38.23162142732965],
          [-101.02239322729369, 38.270445746202874],
          [-101.03612613744994, 38.222990984564724]]]),

// filter by my study area
var spatialFiltered = l7.filterBounds(finneyp);
print('spatialFiltered', spatialFiltered);

// filter by my time period
var temporalFiltered = spatialFiltered.filterDate('2001-01-01', '2020-12-31');
print('temporalFiltered', temporalFiltered);

// remove cloud cover
var sorted2 = temporalFiltered.filter(ee.Filter.eq('CLOUD_COVER', 0));
print('NocloudFiltered',sorted2);

// Select only Red and NIR bands from the collection
var image = sorted2.select(['B4', 'B3'])
print('redANDnirBands',image)

// Set to export images for study area.
Export.image.toDrive({
  image: image,
  description: 'image_export',
  folder: 'exported_img',
  region: finneyp,
  scale: 30,
  crs: 'EPSG:3419'
});
</code>```

Body:
Please ca anyone let me know if it is possible to export (download) images which I have isolated in google earth engine to my computer drive.

Here is the code I have used so far:

    var l7 = ee.ImageCollection("LANDSAT/LE07/C02/T1_RT"),

    var finneyp = /* color: #009999 */ee.Geometry.Polygon(
        [[[-101.10479068823119, 38.222990984564724],
          [-101.08281803198119, 37.75325690679087],
          [-100.65709781713744, 37.7445700041578],
          [-100.66259098119994, 38.000404636277544],
          [-100.26159000463744, 38.00689732153255],
          [-100.26433658666869, 38.23162142732965],
          [-101.02239322729369, 38.270445746202874],
          [-101.03612613744994, 38.222990984564724]]]),

// filter by my study area
var spatialFiltered = l7.filterBounds(finneyp);
print('spatialFiltered', spatialFiltered);

// filter by my time period
var temporalFiltered = spatialFiltered.filterDate('2001-01-01', '2020-12-31');
print('temporalFiltered', temporalFiltered);

// remove cloud cover
var sorted2 = temporalFiltered.filter(ee.Filter.eq('CLOUD_COVER', 0));
print('NocloudFiltered',sorted2);

// Select only Red and NIR bands from the collection
var image = sorted2.select(['B4', 'B3'])
print('redANDnirBands',image)

// Set to export images for study area.
Export.image.toDrive({
  image: image,
  description: 'image_export',
  folder: 'exported_img',
  region: finneyp,
  scale: 30,
  crs: 'EPSG:3419'
});


问:
Visual studio - change character size of the "find and replace box"
Thanks to all, I have a problem with the find and replace box: suddenly (probably some strange combination of keys) the size and the fonts of the box reduced, and so is very difficult to use it.
How can I resize the dimensions and font size of the box?

I have serched in the tools --> options, but I have not found what I searching


问:
What makes a log event id unique in ASP.NET Core?
When logging w/ event id's like this: logger.LogInformation(1001, "Getting item {Id}", id);

How do I query a semantic or structured log, for those events?  What are the key(s)?  I'm guessing EventId.Id + SourceContext?  (There's no guarantee the id I want to use isn't used by some other library so I must have to use EventId.Id plus some other field, right?)

When reviewing the official docs, Log event ID, I didn't see any recommendations on this topic.  I only found this:

Some logging providers store the event ID in a field, which allows for filtering on the ID.


问:
dsquery.dll doesn't show all settings for admin user
I'm trying to make a shortcut in windows Server 2016 DC Server. The frequent work is finding users and resetting their passwords. And I want to do it quickly and simply with a shortcut.

I've found a run command that triggers the search window. But there are not all settings in the context menu (right click menu).

The command is:

```<code>rundll32 dsquery.dll openquerywindow
</code>```

It has no "reset password" option in the context menu.(only/ Open Home Page, Send Mail, Properties).

Is there a better way to do this?

Unfortunately, there's no a keyboard shortcut in AD Users and Computers app. Or i'm missing something?

Body:
I'm trying to make a shortcut in windows Server 2016 DC Server. The frequent work is finding users and resetting their passwords. And I want to do it quickly and simply with a shortcut.

I've found a run command that triggers the search window. But there are not all settings in the context menu (right click menu).

The command is:

rundll32 dsquery.dll openquerywindow

It has no "reset password" option in the context menu.(only/ Open Home Page, Send Mail, Properties).

Is there a better way to do this?

Unfortunately, there's no a keyboard shortcut in AD Users and Computers app. Or i'm missing something?


问:
Forms in MS Access that reference the same data will not refresh until the other form is closed or loses focus
I am hoping some VBA/Access guru might just know how to address this because it seems that I am missing something fundamental, yet relatively simple for someone in the know.

I have three separate forms, all of which have separate subforms. On each of the subforms, there is a common piece of data (i.e. points to the same table/field in the database)

I want that if a user updates that common field on any of the three subforms, the other subforms should show that updated value without the user needing to manually refresh.

A note when I click "Refresh":
Even if the user hits the  refresh button, the changes take affect IFF the subform on which the change was made has lost the focus-- And no, the field losing the focus is not enough, the subform must lose the focus. Otherwise, clicking the refresh button doesn't work

I have some "AfterUpdate" code on each of the fields in the subforms that calls .Requery on the other two subforms. The requery syntax is correct. No errors or anything (Assuming the other two forms are open).

I am more than happy to include code if necessary, but literally, the only thing I am doing is calling requery on the other subforms

```<code>Forms("OtherformName1")!subformName1.Form.Requery
Forms("OtherformName2")!subformName2.Form.Requery
</code>```

I have also attempted to run this code using .Refresh (didn't work), and I have tried putting in the "LostFocus" event
Nothing seems to work. Does anyone have any idea what this might be?
It has to be simple because this feels like really basic functionality

Body:
I am hoping some VBA/Access guru might just know how to address this because it seems that I am missing something fundamental, yet relatively simple for someone in the know.

I have three separate forms, all of which have separate subforms. On each of the subforms, there is a common piece of data (i.e. points to the same table/field in the database)

I want that if a user updates that common field on any of the three subforms, the other subforms should show that updated value without the user needing to manually refresh.

A note when I click "Refresh":
Even if the user hits the  refresh button, the changes take affect IFF the subform on which the change was made has lost the focus-- And no, the field losing the focus is not enough, the subform must lose the focus. Otherwise, clicking the refresh button doesn't work

I have some "AfterUpdate" code on each of the fields in the subforms that calls .Requery on the other two subforms. The requery syntax is correct. No errors or anything (Assuming the other two forms are open).

I am more than happy to include code if necessary, but literally, the only thing I am doing is calling requery on the other subforms

Forms("OtherformName1")!subformName1.Form.Requery
Forms("OtherformName2")!subformName2.Form.Requery

I have also attempted to run this code using .Refresh (didn't work), and I have tried putting in the "LostFocus" event
Nothing seems to work. Does anyone have any idea what this might be?
It has to be simple because this feels like really basic functionality