百合的盛世恋

文章 评论 浏览 32

百合的盛世恋 2025-02-20 23:21:06

两个问题是:
1/动态  url的良好写作: 

https://yourapp.page.link/?link=https://yourapp.com/test=12345&isi=14602xxxxx&ibi=com.xxxx.yourapp

这是创建Info.plist中XCode中的url

2/参数的好方法很重要: 

<key>FirebaseDynamicLinksCustomDomains</key>
    <array>
        <string>https://yourapp.com/link</string>
    </array>

the two problems were :
1/ the good writing of the dynamical url : 

https://yourapp.page.link/?link=https://yourapp.com/test=12345&isi=14602xxxxx&ibi=com.xxxx.yourapp

This is the good way to create the url

2/ The parameter in info.plist in Xcode is important : 

<key>FirebaseDynamicLinksCustomDomains</key>
    <array>
        <string>https://yourapp.com/link</string>
    </array>

iOS/Swift:如何通过在控制台Firebase上配置一个链接来获得来自App Store的安装的动态深链接?

百合的盛世恋 2025-02-20 08:21:26

复制构造函数和分配构造函数之间的区别是:

  1. 如果复制构造函数,则创建一个新对象。(&lt; className&gt;&lt; o1&gt; =&lt; =&lt; o2&gt;
  2. )分配构造函数它不会创建任何对象,意味着它应用于已经创建的对象(&lt; o1&gt; =&lt; o2&gt; )。

并且两者的基本功能都是相同的,它们将将数据从O2复制到成员。

the difference between a copy constructor and an assignment constructor is:

  1. In case of a copy constructor it creates a new object.(<classname> <o1>=<o2>)
  2. In case of an assignment constructor it will not create any object means it apply on already created objects(<o1>=<o2>).

And the basic functionalities in both are same, they will copy the data from o2 to o1 member-by-member.

分配运算符和复制构造函数之间的区别是什么?

百合的盛世恋 2025-02-19 19:01:04

如果我正确理解问题,您想根据更改新值动态更改选择。

If I correctly understand the problem you want to dynamically change the select based on a change new value.

Here is example in Guriddo jqGrid, but it should work in free-jqgrid. This is just a idea how you can do this.

从显示中编辑后,动态更改填充选择列表

百合的盛世恋 2025-02-19 18:31:16

这可能是因为您指的是使用 fastai v2库的代码段。在最新的 fastai 中, mselossflat 函数可以在 fastai.losses 上导入。

但是,由于您正在尝试一个旧的代码段,因此最好重现该代码的执行环境以获得预期的结果。我建议尝试在您的环境上安装 fastai v2并再次执行代码。

This is probably because you are referring to a code snippet that used the fastai v2 library. In the newest fastai, the MSELossFlat function can be imported at fastai.losses.

But since you are trying out an old code snippet, it's best to reproduce the execution enviroment of that code to get an expected result. I would recommend trying to install fastai v2 on your environment and execute the code again.

无法导入名称&#x27; mselossflat&#x27;从fastai.layers&#x27;

百合的盛世恋 2025-02-19 17:25:07

经过相当多的挖掘,由于我正在使用的是使用补丁请求,因此目前与FormData现在仍然无法使用。为了解决它,我们需要通过将补丁方法附加到FormData和我们的Ajax设置来更改以进行更改来欺骗该方法。然后,您将收到控制器内部的所有请求。

参考:

https://laracasts.com/discuss/channels/javascript/axiosajax-http-patch-patch-requests-with-file-not-working

$("#formCropUpdate").on("submit", function (event) {
        event.preventDefault();

        var formId = $('#formId').val();
        var url = '/Form/' + formId;
        var form = this;
        formData = new FormData(form);
        formData.append('_method', 'PATCH');
        console.log(Array.from(formData));

        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        $.ajax({
            type: "POST",
            url: url,
            data:formData,
            cache: false,
            contentType: false,
            processData: false,
            success: function (response) {
                console.log(response);
                return false;
            },
        });
    });

After quite a bit of digging, since what I am doing is using the PATCH request, it's still not working as of now with FormData. To solve it, we need to spoof the method by appending the PATCH method to formData and our AJAX settings to be changed to POST. Then you'll receive all the request inside your controller.

Reference:
https://laracasts.com/discuss/channels/laravel/ajax-formdata-and-put-fails

https://laracasts.com/discuss/channels/javascript/axiosajax-http-patch-requests-with-file-not-working

$("#formCropUpdate").on("submit", function (event) {
        event.preventDefault();

        var formId = $('#formId').val();
        var url = '/Form/' + formId;
        var form = this;
        formData = new FormData(form);
        formData.append('_method', 'PATCH');
        console.log(Array.from(formData));

        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        $.ajax({
            type: "POST",
            url: url,
            data:formData,
            cache: false,
            contentType: false,
            processData: false,
            success: function (response) {
                console.log(response);
                return false;
            },
        });
    });

Laravel -Ajax formdata不会在控制器中显示

百合的盛世恋 2025-02-19 07:26:44

您可以使用 aws iam list-entities-for-policy-policy-arn&lt; arn-of-policy&gt;

for Exaple:

  1. open Cloudshell或您的配置 aws cli cli
  2. <代码> aws $ aws iam list-entities-for-policy-policy-arn ARN:AWS:IAM :: 123456789:策略/服务 - 杆/AWScodePipipipipipipipipipipipipipicerole-central-1-foo

You can use aws iam list-entities-for-policy --policy-arn <arn-of-policy>

For exaple:

  1. Open CloudShell or your configured aws CLI
  2. aws $ aws iam list-entities-for-policy --policy-arn arn:aws:iam::123456789:policy/service-role/AwsCodePipelineServiceRole-central-1-foo

我如何找到使用特定AWS托管政策的IAC

百合的盛世恋 2025-02-19 01:52:04

您肯定可以将前后分开,请记住,Django只是创建终点,并以自己的视图消耗它们,甚至可以同时使用两者。

这是django视图的文档: https://djangoproject.com /en/4.0/#the-view-layer

您可以使用librarie(例如React)作为前端,并连接到API(Django App)并同时使用。

You could definitely separate front and back, remember, django just creates endpoints and consumes them with its own views, you can even use both.

Here is the documentation for django views: https://docs.djangoproject.com/en/4.0/#the-view-layer

You can use a librarie like React as frontend and connect to your api(django app) and use both.

将Django前端分开并使用API​​可行吗?

百合的盛世恋 2025-02-19 00:35:41

在Ubuntu 22.04上禁用Tracker3并避免更新:

sudo apt-mark hold tracker
sudo apt-mark hold tracker-extract
sudo apt-mark hold tracker-miner-fs

sudo chmod -x /usr/libexec/tracker-extract-3
sudo chmod -x /usr/libexec/tracker-miner-fs-3

tracker3 reset --filesystem --rss # Clean all database
tracker3 daemon --terminate

撤消:

sudo apt-mark unhold tracker
sudo apt-mark unhold tracker-extract
sudo apt-mark unhold tracker-miner-fs

sudo chmod +x /usr/libexec/tracker-extract-3
sudo chmod +x /usr/libexec/tracker-miner-fs-3

tracker3 daemon --start

此解决方案是解决方法。但这有效。

如果要检查当前用户的Tracker3的所有设置,请运行命令:

gsettings list-recursively | grep Tracker

在此设置中,可以启用或禁用Tracker3的特定目录。

To disable Tracker3 on Ubuntu 22.04 and avoid updates:

sudo apt-mark hold tracker
sudo apt-mark hold tracker-extract
sudo apt-mark hold tracker-miner-fs

sudo chmod -x /usr/libexec/tracker-extract-3
sudo chmod -x /usr/libexec/tracker-miner-fs-3

tracker3 reset --filesystem --rss # Clean all database
tracker3 daemon --terminate

To undo:

sudo apt-mark unhold tracker
sudo apt-mark unhold tracker-extract
sudo apt-mark unhold tracker-miner-fs

sudo chmod +x /usr/libexec/tracker-extract-3
sudo chmod +x /usr/libexec/tracker-miner-fs-3

tracker3 daemon --start

This solution is a workaround. But it works.

If you want to check all settings of Tracker3 for the current user, run the command:

gsettings list-recursively | grep Tracker

In this settings it is possible to enable or disable the Tracker3 for specific directories.

如何在Ubuntu 22.04中禁用文件索引(Tracker3)

百合的盛世恋 2025-02-18 21:42:02

因此,

如果您尝试这两个代码(希望我可以在清晨进行编码!)希望它将显示主要代码的问题出现在哪里:

请记住,请记住更改顶部的变量

Sub copyPaste2()

    ' rename to the sheet where your stuff is
    SheetFrom = "Sheet1"
    ' add a sheet and change this to that sheet name
    SheetTo = "Sheet2"
    ' change this range to cover your data
    RangeStr = "D15:D22"
    
    Dim myArray As Variant
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets(SheetFrom)

    'Create variable to point to your table (reference to the table for replace values
      Set tbl = ThisWorkbook.Sheets("LangLibGT").ListObjects("LangTable2")
    
    'Create an Array out of the Table's Data
      Set TempArray = tbl.DataBodyRange
      
    ' Make into dictionary - with help from https://www.mrexcel.com/board/threads/add-range-to-dictionary.1075087/
    Dim MyDict As Object, i As Long, MyVals As Variant

    Set MyDict = CreateObject("Scripting.Dictionary")
    
    For i = 1 To UBound(TempArray)
        MyDict(TempArray(i, 1)) = TempArray(i, 2)
    Next i
    
    
    myArray = ws.Range(RangeStr).Formula
    
    Sheets(SheetTo).Range(RangeStr).Formula = myArray
    
End Sub

,并且

Sub copyPaste3()

    ' rename to the sheet where your stuff is
    SheetFrom = "Sheet1"
    ' add a sheet and change this to that sheet name
    SheetTo = "Sheet2"
    ' change this range to cover your data
    RangeStr = "D15:D22"
    
    Dim myArray As Variant
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets(SheetFrom)

    'Create variable to point to your table (reference to the table for replace values
      Set tbl = ThisWorkbook.Sheets("LangLibGT").ListObjects("LangTable2")
    
    'Create an Array out of the Table's Data
      Set TempArray = tbl.DataBodyRange
      
    ' Make into dictionary - with help from https://www.mrexcel.com/board/threads/add-range-to-dictionary.1075087/
    Dim MyDict As Object, i As Long, MyVals As Variant

    Set MyDict = CreateObject("Scripting.Dictionary")
    
    For i = 1 To UBound(TempArray)
        MyDict(TempArray(1, i)) = TempArray(2, i)
    Next i
    
    
    myArray = ws.Range(RangeStr).Formula
    
    ' change the values for the dictionary value
    For i = 1 To UBound(myArray)
        For j = 1 To UBound(myArray, 2)
            If myArray(i, j) <> "" Then
                If MyDict.Exists(myArray(i, j)) Then
                    myArray(i, j) = MyDict(myArray(i, j))
                End If
            End If
        Next j
    Next i
    
    Sheets(SheetTo).Range(RangeStr).Formula = myArray
    
End Sub

so I can't replicate the issue

if you try these two codes (hoping I can code this early in the morning!) hopefully it will show where the issue for the main code comes in:

remember to change the variables at the top

Sub copyPaste2()

    ' rename to the sheet where your stuff is
    SheetFrom = "Sheet1"
    ' add a sheet and change this to that sheet name
    SheetTo = "Sheet2"
    ' change this range to cover your data
    RangeStr = "D15:D22"
    
    Dim myArray As Variant
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets(SheetFrom)

    'Create variable to point to your table (reference to the table for replace values
      Set tbl = ThisWorkbook.Sheets("LangLibGT").ListObjects("LangTable2")
    
    'Create an Array out of the Table's Data
      Set TempArray = tbl.DataBodyRange
      
    ' Make into dictionary - with help from https://www.mrexcel.com/board/threads/add-range-to-dictionary.1075087/
    Dim MyDict As Object, i As Long, MyVals As Variant

    Set MyDict = CreateObject("Scripting.Dictionary")
    
    For i = 1 To UBound(TempArray)
        MyDict(TempArray(i, 1)) = TempArray(i, 2)
    Next i
    
    
    myArray = ws.Range(RangeStr).Formula
    
    Sheets(SheetTo).Range(RangeStr).Formula = myArray
    
End Sub

and

Sub copyPaste3()

    ' rename to the sheet where your stuff is
    SheetFrom = "Sheet1"
    ' add a sheet and change this to that sheet name
    SheetTo = "Sheet2"
    ' change this range to cover your data
    RangeStr = "D15:D22"
    
    Dim myArray As Variant
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets(SheetFrom)

    'Create variable to point to your table (reference to the table for replace values
      Set tbl = ThisWorkbook.Sheets("LangLibGT").ListObjects("LangTable2")
    
    'Create an Array out of the Table's Data
      Set TempArray = tbl.DataBodyRange
      
    ' Make into dictionary - with help from https://www.mrexcel.com/board/threads/add-range-to-dictionary.1075087/
    Dim MyDict As Object, i As Long, MyVals As Variant

    Set MyDict = CreateObject("Scripting.Dictionary")
    
    For i = 1 To UBound(TempArray)
        MyDict(TempArray(1, i)) = TempArray(2, i)
    Next i
    
    
    myArray = ws.Range(RangeStr).Formula
    
    ' change the values for the dictionary value
    For i = 1 To UBound(myArray)
        For j = 1 To UBound(myArray, 2)
            If myArray(i, j) <> "" Then
                If MyDict.Exists(myArray(i, j)) Then
                    myArray(i, j) = MyDict(myArray(i, j))
                End If
            End If
        Next j
    Next i
    
    Sheets(SheetTo).Range(RangeStr).Formula = myArray
    
End Sub

如何在执行Worksheet.cells.replace时设置范围

百合的盛世恋 2025-02-18 18:22:39

您需要将适当的约束应用于 WebView 这样的

尝试

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

  <com.google.android.material.appbar.AppBarLayout
      android:id="@+id/appbar"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:theme="?attr/actionBarTheme"
        />

  </com.google.android.material.appbar.AppBarLayout>

  <WebView
      android:id="@+id/webview"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@id/appbar"
      />

</androidx.constraintlayout.widget.ConstraintLayout>

You need to apply proper constraints to your WebView like this

Try this

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

  <com.google.android.material.appbar.AppBarLayout
      android:id="@+id/appbar"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:theme="?attr/actionBarTheme"
        />

  </com.google.android.material.appbar.AppBarLayout>

  <WebView
      android:id="@+id/webview"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@id/appbar"
      />

</androidx.constraintlayout.widget.ConstraintLayout>

Web浏览在工具栏下

百合的盛世恋 2025-02-18 14:44:07

不,没有类型尺寸的标准。标准只要求:

sizeof(short int) <= sizeof(int) <= sizeof(long int)

可以做的最好的事情

#ifdef SYSTEM_X
  #define WORD int
#else
  #define WORD long int
#endif

如果您想要固定尺寸的变量是使用这样的宏:那么您可以使用Word来定义变量, 。这不是我喜欢这个,而是最便携式的方式。

Nope, there is no standard for type sizes. Standard only requires that:

sizeof(short int) <= sizeof(int) <= sizeof(long int)

The best thing you can do if you want variables of a fixed sizes is to use macros like this:

#ifdef SYSTEM_X
  #define WORD int
#else
  #define WORD long int
#endif

Then you can use WORD to define your variables. It's not that I like this but it's the most portable way.

C&#x2B;&#x2B;什么是什么标准说int的大小,长吗?

百合的盛世恋 2025-02-18 02:38:29

首先,您必须将公共政策设置为您的存储桶
您可以使用以下示例

policy = {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": [
                            "s3:GetBucketLocation",
                            "s3:ListBucket",
                            "s3:ListBucketMultipartUploads",
                        ],
                        "Resource": f"arn:aws:s3:::{self.bucket_name}",
                    },
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": [
                            "s3:GetObject",
                            "s3:PutObject",
                            "s3:DeleteObject",
                            "s3:ListMultipartUploadParts",
                            "s3:AbortMultipartUpload",
                        ],
                        "Resource": f"arn:aws:s3:::{self.bucket_name}/*",
                    },
                ],
            }
            client.set_bucket_policy(self.bucket_name, json.dumps(policy))

,然后可以使用从存储桶名和文件名来生成文件路径。

client.fput_object(
            bucket_name,
            file_name,
            file.fileno(),
            content_type=file.content_type,
        )

        return f"{self.endpoint}/{bucket_name}/{file_name}"

at first you must set public policy to your bucket
you can use the following example

policy = {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": [
                            "s3:GetBucketLocation",
                            "s3:ListBucket",
                            "s3:ListBucketMultipartUploads",
                        ],
                        "Resource": f"arn:aws:s3:::{self.bucket_name}",
                    },
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": [
                            "s3:GetObject",
                            "s3:PutObject",
                            "s3:DeleteObject",
                            "s3:ListMultipartUploadParts",
                            "s3:AbortMultipartUpload",
                        ],
                        "Resource": f"arn:aws:s3:::{self.bucket_name}/*",
                    },
                ],
            }
            client.set_bucket_policy(self.bucket_name, json.dumps(policy))

and then you can use from bucket name and file name to generate your file path.

client.fput_object(
            bucket_name,
            file_name,
            file.fileno(),
            content_type=file.content_type,
        )

        return f"{self.endpoint}/{bucket_name}/{file_name}"

生成一个链接,该链接从Python中的Minio下载文件

百合的盛世恋 2025-02-17 07:01:28

一些与这个著名的双重精度问题有关的统计数据。

当使用0.1的步骤(从0.1到100)添加所有值( a + b )时,我们有 〜15%的精度误差的机会。请注意,错误可能导致稍大或更小的值。
以下是一些示例:

0.1 + 0.2 = 0.30000000000000004 (BIGGER)
0.1 + 0.7 = 0.7999999999999999 (SMALLER)
...
1.7 + 1.9 = 3.5999999999999996 (SMALLER)
1.7 + 2.2 = 3.9000000000000004 (BIGGER)
...
3.2 + 3.6 = 6.800000000000001 (BIGGER)
3.2 + 4.4 = 7.6000000000000005 (BIGGER)

当减去所有值时( a -b 其中 a&gt; b )使用0.1的步骤(从100到0.1),我们有 〜〜 34%的精度错误的机会
这里有一些例子:

0.6 - 0.2 = 0.39999999999999997 (SMALLER)
0.5 - 0.4 = 0.09999999999999998 (SMALLER)
...
2.1 - 0.2 = 1.9000000000000001 (BIGGER)
2.0 - 1.9 = 0.10000000000000009 (BIGGER)
...
100 - 99.9 = 0.09999999999999432 (SMALLER)
100 - 99.8 = 0.20000000000000284 (BIGGER)

*15%和34%的确实很大,因此,当精度很重要时,请始终使用BigDecimal。使用2个小数位数(步骤0.01),情况会加剧一些(18%和36%)。

Some statistics related to this famous double precision question.

When adding all values (a + b) using a step of 0.1 (from 0.1 to 100) we have ~15% chance of precision error. Note that the error could result in slightly bigger or smaller values.
Here are some examples:

0.1 + 0.2 = 0.30000000000000004 (BIGGER)
0.1 + 0.7 = 0.7999999999999999 (SMALLER)
...
1.7 + 1.9 = 3.5999999999999996 (SMALLER)
1.7 + 2.2 = 3.9000000000000004 (BIGGER)
...
3.2 + 3.6 = 6.800000000000001 (BIGGER)
3.2 + 4.4 = 7.6000000000000005 (BIGGER)

When subtracting all values (a - b where a > b) using a step of 0.1 (from 100 to 0.1) we have ~34% chance of precision error.
Here are some examples:

0.6 - 0.2 = 0.39999999999999997 (SMALLER)
0.5 - 0.4 = 0.09999999999999998 (SMALLER)
...
2.1 - 0.2 = 1.9000000000000001 (BIGGER)
2.0 - 1.9 = 0.10000000000000009 (BIGGER)
...
100 - 99.9 = 0.09999999999999432 (SMALLER)
100 - 99.8 = 0.20000000000000284 (BIGGER)

*15% and 34% are indeed huge, so always use BigDecimal when precision is of big importance. With 2 decimal digits (step 0.01) the situation worsens a bit more (18% and 36%).

浮点数学破裂了吗?

百合的盛世恋 2025-02-17 05:45:52

代码中的主要问题是因为您正在对 child span 元素进行排序,而不是 parent span elements 。

每个()循环也是冗余的,因为您可以在对其进行排序后 append()将内容返回其原始父。

最后,您应该从 sort()处理程序函数中返回整数值,而不是布尔值:

let $container = $('.bk_slot_div1');

$container.children('span').sort((a, b) => {
  let aId = parseInt($(a).children('span').prop('id'), 10);
  let bId = parseInt($(b).children('span').prop('id'), 10);
  return aId > bId ? 1 : aId < bId ? -1 : 0;
}).appendTo($container);
.bk_slot_div {
  padding: 6px 11px;
  background: #FFFFFF;
  font-size: 14px;
  color: #555555;
  text-align: center;
  border: 1px solid #979797;
  border-radius: 4px;
  cursor: pointer
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div class="col-12 bk_slot_div1 ">
  <span>
    <span class="bk_slot_div" id="8" t-att-data-slot_plans="12:45">12:45</span>
  </span>
  <span>
    <span class="disabled disable_msg" id="7" t-att-data-slot_plans="12:00">12:00</span>
  </span>
</div>

The main issue in your code is because you're sorting the child span elements, not the parent span elements.

The each() loop is also redundant as you can just append() the content back to its original parent after sorting it.

Finally, you should return an integer value from the sort() handler function, not a boolean:

let $container = $('.bk_slot_div1');

$container.children('span').sort((a, b) => {
  let aId = parseInt($(a).children('span').prop('id'), 10);
  let bId = parseInt($(b).children('span').prop('id'), 10);
  return aId > bId ? 1 : aId < bId ? -1 : 0;
}).appendTo($container);
.bk_slot_div {
  padding: 6px 11px;
  background: #FFFFFF;
  font-size: 14px;
  color: #555555;
  text-align: center;
  border: 1px solid #979797;
  border-radius: 4px;
  cursor: pointer
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div class="col-12 bk_slot_div1 ">
  <span>
    <span class="bk_slot_div" id="8" t-att-data-slot_plans="12:45">12:45</span>
  </span>
  <span>
    <span class="disabled disable_msg" id="7" t-att-data-slot_plans="12:00">12:00</span>
  </span>
</div>

jQuery排序跨度

百合的盛世恋 2025-02-15 21:40:44

使用条件聚合:

SELECT COLUMN_01,
       SUM(COLUMN_02 * CASE COLUMN_05 WHEN 'ALFA' THEN 0.05 WHEN 'BETA' THEN 0.45 END) AS SUM_01
FROM tablename
WHERE COLUMN_03 = 1 AND COLUMN_04 = 2 AND (COLUMN_05 IN ('ALFA', 'BETA'))
GROUP BY COLUMN_01;

Use conditional aggregation:

SELECT COLUMN_01,
       SUM(COLUMN_02 * CASE COLUMN_05 WHEN 'ALFA' THEN 0.05 WHEN 'BETA' THEN 0.45 END) AS SUM_01
FROM tablename
WHERE COLUMN_03 = 1 AND COLUMN_04 = 2 AND (COLUMN_05 IN ('ALFA', 'BETA'))
GROUP BY COLUMN_01;

如何使用SQL汇总类似选择的总和值?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文