不再让梦枯萎

文章 评论 浏览 31

不再让梦枯萎 2025-02-15 21:49:18

continue

IIUC, you can use:

df2 = df1[pd.to_datetime(df1['Acc_end_date'], dayfirst=False)
            .rsub(pd.Timestamp('today')).gt('30d')]

output:

  Acc_id Acc_name Acc_end_date
0  qqq-1    test1   12/31/2021
4  kkk-6    test5   03/16/2022

更改日期和提取以过滤掉

不再让梦枯萎 2025-02-15 21:30:14

对象大小在将对象提供给组件时无关紧要,无论您通过是否作为道具还是通过上下文都重要。始终通过引用传递对象。

使用usecontext而不是将对象作为组件属性传递给对象有一个绩效好处:每次组件都会收到新的属性值(作为参数或通过上下文),它都会重新渲染。如果您有一个复杂的UI,即使对象是通过参考传递的,即使它们的内存占地面积很小,也可以减慢您的应用程序。

如果您通过上下文提供了组件的对象,则只有实际调用USECONTEXT访问这些对象重新渲染的组件。如果将这些对象传递到组件树,则将目标组件的路径上的每个组件都必须重新渲染。

因此,简而言之:儿童组件最好从上下文而不是通过道具接收对象。

The object size does not matter when providing your object to components, not matter whether you pass is as props or via context. Objects are always passed by reference.

There is a performance benefit to using useContext rather than passing down objects as component properties thbough: everytime a component receives new property values (as parameters or via context), it will re-render. If you have a complex UI, this can slow down your app, even if the objects are passed by reference and even if they have a small memory footprint.

If you provide objects to components via context, only the components that actually call useContext to access these objects re-render. If you pass down these objects down the component tree instead, every component on the path to the target component must potentially re-render.

So in short: it is better for the child components to receive the object from the context, not through props.

每次使用React上下文访问对象的新实例,我是否会创建一个新实例?

不再让梦枯萎 2025-02-15 21:22:37

尝试以下操作:

a = [0, 1, 2]

while True:
    print(*a, sep=', ')
    a.append(a[0])
    a.pop(0)

输出:

0, 1, 2
1, 2, 0
2, 0, 1
0, 1, 2
1, 2, 0
2, 0, 1
...

或,pop返回删除元素,因此可以简化

a = [0, 1, 2]

while True:
    print(*a, sep=', ')
    a.append(a.pop(0))

[感谢Shadowranger和Tomerikoo的改进建议。]

Try this:

a = [0, 1, 2]

while True:
    print(*a, sep=', ')
    a.append(a[0])
    a.pop(0)

Output:

0, 1, 2
1, 2, 0
2, 0, 1
0, 1, 2
1, 2, 0
2, 0, 1
...

Or, pop returns the element removed, so it can be simplified

a = [0, 1, 2]

while True:
    print(*a, sep=', ')
    a.append(a.pop(0))

[Thanks ShadowRanger and Tomerikoo for improvement suggestions.]

如何通过+ 1偏移每个循环无限地迭代列表

不再让梦枯萎 2025-02-15 21:10:03

如果冻结了模型,则不得更新相应模块的参数, ie 他们不应需要梯度计算:requientes_grad = false

注:具有 方法:

if freeze_bert == 'True':
    self.bert.requires_grad_(False)

elif freeze_bert == 'False:
    self.bert.requires_grad_(True)

理想情况freeze_bert将是布尔值,您只需做:

self.bert.requires_grad_(not freeze_bert)

If you freeze your model then the parameter of the corresponding modules must not be updated, i.e. they should not require gradient computation: requires_grad=False.

Note nn.Module also has a requires_grad_ method:

if freeze_bert == 'True':
    self.bert.requires_grad_(False)

elif freeze_bert == 'False:
    self.bert.requires_grad_(True)

Ideally freeze_bert would be a boolean and you would simply do:

self.bert.requires_grad_(not freeze_bert)

评估bert模型参数。requires_grad

不再让梦枯萎 2025-02-15 14:05:52

是的,您可以在Azure功能上构建和自定义API。

如果您使用的是c#语言功能应用程序,则可以创建httpclient对象从Azure函数中进行HTTP调用。

您可以使用任何支持的触发器要触发您的功能应用程序,并且您的功能应用程序将进行HTTP调用或api调用。

按照 microsoft-documentation 说,

Azure函数与门户中的Azure API管理集成在一起,使您将HTTP触发功能端点公开为REST API。使用OpenAPI定义描述了这些API。
Azure函数与门户中的Azure API管理集成在一起,使您将HTTP触发函数端点公开为REST API。

缩放Azure功能,每秒处理10,000多个请求
以下是一些博客,可以概述处理10000+请求。
缩放azure函数提出更多请求

https://learn.microsoft.com/en-au/au/au/azure/load-testing/load-testing/overview-what-whit-what-what-what-what-what-rath测试?wt.mc_id = dt-mvp-5001664

有关进一步请参阅-function“> so_thread and msdn-example 有关更多详细信息。

Yes, you can build and customize an API on Azure Functions.

If you are using the C# language function app, you can create the HttpClient object to make HTTP calls from Azure function.

You can use any of the supported triggers to trigger your function app, and your function app will make the HTTP calls or the api calls.

As per Microsoft-Documentation it says,

Azure Functions integrates with Azure API Management in the portal to let you expose your HTTP trigger function endpoints as REST APIs. These APIs are described using an OpenAPI definition.
Azure Functions integrates with Azure API Management in the portal to let you expose your HTTP trigger function endpoints as REST APIs.

Scale an Azure Function to handle 10,000+ requests per second.
Here are some blogs which might give an overview of handling 10000+ requests.
Scaling Azure Functions to make more requests

https://learn.microsoft.com/en-au/azure/load-testing/overview-what-is-azure-load-testing?WT.mc_id=DT-MVP-5001664

For further refer SO_thread and MSDN-Example for more details.

仅适用于API调用可以使用Azure函数吗?

不再让梦枯萎 2025-02-15 01:16:18

这样做的唯一方法是在“ HREF”中删除数据,然后将其更改为JavaScript Onlick,在此设置窗口。将其设置为所需的URL。

<a href="http://www.stackoverflow.com/">Go To SO</a>

成为

<a style="cursor: pointer" onclick="javascript: window.location = 'http://www.stackoverflow.com/';">Go To SO</a>

P.S.通过JavaScript进行操作可能是禁用URL显示的唯一方法,但这提出了为什么? URL显示是有效且重要的事情,并且禁用它不适合用户体验。

The only way to do this is to remove the data in 'href', and change it to a javascript onlick where you set the window.location to the url you want.

<a href="http://www.stackoverflow.com/">Go To SO</a>

becomes

<a style="cursor: pointer" onclick="javascript: window.location = 'http://www.stackoverflow.com/';">Go To SO</a>

p.s. Doing it via JavaScript is probably the only way to disable the URL display, but this raises the question of why? URL display is a valid and important thing, and disabling it is not good for user experience.

有没有办法禁用&lt; a&gt; CSS中的链接预览?

不再让梦枯萎 2025-02-15 01:02:12

如果您在SQL中执行此操作,则可以按照以下方式进行操作。您没有在这里加入。这是简单的过滤。

回复:性能 - 取决于您想做什么?是数据级还是分析级别?如果以后,则肯定会达克斯。如果事先,并且如果您有一个高级工作区,则将数据带到 datamart ,并且可以在此处应用完全合格的SQL。通常,DAX的性能比PQ出色。与SQL/DAX相同的方式,PQ无法扩展大数据。

select 
  * 
from 
  @t1 
where 
  c2 like '%server%' 
  or c2 like '%load%' 
  or c3 like '%server' 
  or c3 like '%load%'

可以在DAX查询中复制

Table =
CALCULATETABLE (
    Devices,
    CONTAINSSTRING ( Devices[Device], "server" )
        || CONTAINSSTRING ( Devices[Device], "load" )
        || CONTAINSSTRING ( Devices[Device], "uk" )
        || CONTAINSSTRING ( Devices[Group], "server" )
        || CONTAINSSTRING ( Devices[Group], "load" )
        || CONTAINSSTRING ( Devices[Group], "uk" )
)

“

或更好地通过措施

maxRow =
CALCULATE (
    MAX ( Devices[Row] ),
    FILTER (
        Devices,
        CONTAINSSTRING ( Devices[Device], SELECTEDVALUE ( CAT[Column1] ) )
            || CONTAINSSTRING ( Devices[Group], SELECTEDVALUE ( CAT[Column1] ) )
    )
)

Measure =
CALCULATE (
    MAX ( Devices[Row] ),
    GENERATE (
        CAT,
        FILTER (
            Devices,
            CONTAINSSTRING ( Devices[Device], CALCULATE ( MAX ( CAT[Column1] ) ) )
                || CONTAINSSTRING ( Devices[Group], CALCULATE ( MAX ( CAT[Column1] ) ) )
        )
    )
)

rel =“ nofollow noreferrer”>

If you do this in SQL you would do it the following way. You are not doing any join here. It is simple filtering.

Re: Performance - Depends on what you want to do? Is the is data-level or analysis-level? If later, then surely DAX. If prior and if you have a premium workspace take your data to datamart and you can apply fully qualified SQL there. In general, DAX has a much superior performance than PQ. PQ is not scalable with large data the same way SQL/DAX is.

select 
  * 
from 
  @t1 
where 
  c2 like '%server%' 
  or c2 like '%load%' 
  or c3 like '%server' 
  or c3 like '%load%'

s1

The same can be replicated in a Dax Query

Table =
CALCULATETABLE (
    Devices,
    CONTAINSSTRING ( Devices[Device], "server" )
        || CONTAINSSTRING ( Devices[Device], "load" )
        || CONTAINSSTRING ( Devices[Device], "uk" )
        || CONTAINSSTRING ( Devices[Group], "server" )
        || CONTAINSSTRING ( Devices[Group], "load" )
        || CONTAINSSTRING ( Devices[Group], "uk" )
)

s2

or better through a measure

maxRow =
CALCULATE (
    MAX ( Devices[Row] ),
    FILTER (
        Devices,
        CONTAINSSTRING ( Devices[Device], SELECTEDVALUE ( CAT[Column1] ) )
            || CONTAINSSTRING ( Devices[Group], SELECTEDVALUE ( CAT[Column1] ) )
    )
)

s3

ALL at once

Measure =
CALCULATE (
    MAX ( Devices[Row] ),
    GENERATE (
        CAT,
        FILTER (
            Devices,
            CONTAINSSTRING ( Devices[Device], CALCULATE ( MAX ( CAT[Column1] ) ) )
                || CONTAINSSTRING ( Devices[Group], CALCULATE ( MAX ( CAT[Column1] ) ) )
        )
    )
)

s4

使用另一个表/列表过滤表,尽管匹配项必须作为包含进行,ie s sql像加入一样。这可以通过JOIN,DAX还是M?

不再让梦枯萎 2025-02-14 19:28:06

您需要使用“单活动 - 消费者”来实现相同的目标。有关更多详细信息,请参考 - https:///wwwww.rabbitmq.com/consumers.htmq.com.htmlls.htmll #单活动 - 消费者

queue = await channel.declare_queue(name=self.queue_name,arguments={"x-single-active-consumer": True})

You need to use "single-active-consumer" to achieve the same. For more detail refer - https://www.rabbitmq.com/consumers.html#single-active-consumer

queue = await channel.declare_queue(name=self.queue_name,arguments={"x-single-active-consumer": True})

单队列,但分发了用于聊天应用程序的消费者

不再让梦枯萎 2025-02-14 13:32:36

我没有您的桌子也没有数据,所以 - 这是基于Scott的样本架构及其部门和员工表的一个示例:

SQL> select d.dname, d.loc, e.ename, e.job, e.sal
  2  from dept d join emp e on e.deptno = d.deptno
  3  order by d.dname;

DNAME          LOC           ENAME      JOB              SAL
-------------- ------------- ---------- --------- ----------
ACCOUNTING     NEW YORK      MILLER     CLERK         1300.1
ACCOUNTING     NEW YORK      KING       PRESIDENT       5000
ACCOUNTING     NEW YORK      CLARK      MANAGER         2450
RESEARCH       DALLAS        ADAMS      CLERK         1100.1
RESEARCH       DALLAS        FORD       ANALYST         3000
RESEARCH       DALLAS        JONES      MANAGER         2975
RESEARCH       DALLAS        SMITH      CLERK          800.1
RESEARCH       DALLAS        SCOTT      ANALYST         3000
SALES          CHICAGO       WARD       SALESMAN      1250.1
SALES          CHICAGO       TURNER     SALESMAN      1500.1
SALES          CHICAGO       ALLEN      SALESMAN      1600.1
SALES          CHICAGO       JAMES      CLERK          950.1
SALES          CHICAGO       BLAKE      MANAGER         2850
SALES          CHICAGO       MARTIN     SALESMAN      1250.1

14 rows selected.

SQL>

如果我正确理解您,您希望将部门作为“主”数据和在该部门工作的员工作为“细节”。如果是这样,请使用JSON_ARRAYAGG

SQL> select
  2    json_object ('OBJ' value json_object
  3                    ('DEPARTMENT' value json_object
  4                        ('NAME' value d.dname,
  5                         'LOCATION'   value d.loc
  6                        )
  7                    ),
  8                  'EMPS' value json_arrayagg
  9                    (json_object ('NAME'   value e.ename,
 10                                  'JOB'    value e.job,
 11                                  'SALARY' value e.sal
 12                                 )
 13                    )
 14                ) obj
 15  from dept d join emp e on e.deptno = d.deptno
 16  group by d.dname, d.loc;

结果:

OBJ
--------------------------------------------------------------------------------
{"OBJ":{"DEPARTMENT":{"NAME":"SALES","LOCATION":"CHICAGO"}},"EMPS":[{"NAME":"WAR
D","JOB":"SALESMAN","SALARY":1250.1},{"NAME":"MARTIN","JOB":"SALESMAN","SALARY":
1250.1},{"NAME":"BLAKE","JOB":"MANAGER","SALARY":2850},{"NAME":"JAMES","JOB":"CL
ERK","SALARY":950.1},{"NAME":"ALLEN","JOB":"SALESMAN","SALARY":1600.1},{"NAME":"
TURNER","JOB":"SALESMAN","SALARY":1500.1}]}

{"OBJ":{"DEPARTMENT":{"NAME":"RESEARCH","LOCATION":"DALLAS"}},"EMPS":[{"NAME":"J
ONES","JOB":"MANAGER","SALARY":2975},{"NAME":"SCOTT","JOB":"ANALYST","SALARY":30
00},{"NAME":"SMITH","JOB":"CLERK","SALARY":800.1},{"NAME":"ADAMS","JOB":"CLERK",
"SALARY":1100.1},{"NAME":"FORD","JOB":"ANALYST","SALARY":3000}]}

{"OBJ":{"DEPARTMENT":{"NAME":"ACCOUNTING","LOCATION":"NEW YORK"}},"EMPS":[{"NAME
":"CLARK","JOB":"MANAGER","SALARY":2450},{"NAME":"MILLER","JOB":"CLERK","SALARY"
:1300.1},{"NAME":"KING","JOB":"PRESIDENT","SALARY":5000}]}


SQL>

如果您取出其中的任何一个并将其复制/粘贴到Eg json formatter和验证器要检查它的真实外观,如果它是有效的,

{
   "OBJ":{
      "DEPARTMENT":{
         "NAME":"SALES",
         "LOCATION":"CHICAGO"
      }
   },
   "EMPS":[
      {
         "NAME":"WARD",
         "JOB":"SALESMAN",
         "SALARY":1250.1
      },
      {
         "NAME":"MARTIN",
         "JOB":"SALESMAN",
         "SALARY":1250.1
      },
      {
         "NAME":"BLAKE",
         "JOB":"MANAGER",
         "SALARY":2850
      },
      {
         "NAME":"JAMES",
         "JOB":"CLERK",
         "SALARY":950.1
      },
      {
         "NAME":"ALLEN",
         "JOB":"SALESMAN",
         "SALARY":1600.1
      },
      {
         "NAME":"TURNER",
         "JOB":"SALESMAN",
         "SALARY":1500.1
      }
   ]
}

那么您会得到有效的JSON。

I don't have your tables nor data, so - here's an example based on Scott's sample schema and its departments and employees table:

SQL> select d.dname, d.loc, e.ename, e.job, e.sal
  2  from dept d join emp e on e.deptno = d.deptno
  3  order by d.dname;

DNAME          LOC           ENAME      JOB              SAL
-------------- ------------- ---------- --------- ----------
ACCOUNTING     NEW YORK      MILLER     CLERK         1300.1
ACCOUNTING     NEW YORK      KING       PRESIDENT       5000
ACCOUNTING     NEW YORK      CLARK      MANAGER         2450
RESEARCH       DALLAS        ADAMS      CLERK         1100.1
RESEARCH       DALLAS        FORD       ANALYST         3000
RESEARCH       DALLAS        JONES      MANAGER         2975
RESEARCH       DALLAS        SMITH      CLERK          800.1
RESEARCH       DALLAS        SCOTT      ANALYST         3000
SALES          CHICAGO       WARD       SALESMAN      1250.1
SALES          CHICAGO       TURNER     SALESMAN      1500.1
SALES          CHICAGO       ALLEN      SALESMAN      1600.1
SALES          CHICAGO       JAMES      CLERK          950.1
SALES          CHICAGO       BLAKE      MANAGER         2850
SALES          CHICAGO       MARTIN     SALESMAN      1250.1

14 rows selected.

SQL>

If I understood you correctly, you want to get departments as "master" data and employees that work in that department as its "details". If that's so, use json_arrayagg:

SQL> select
  2    json_object ('OBJ' value json_object
  3                    ('DEPARTMENT' value json_object
  4                        ('NAME' value d.dname,
  5                         'LOCATION'   value d.loc
  6                        )
  7                    ),
  8                  'EMPS' value json_arrayagg
  9                    (json_object ('NAME'   value e.ename,
 10                                  'JOB'    value e.job,
 11                                  'SALARY' value e.sal
 12                                 )
 13                    )
 14                ) obj
 15  from dept d join emp e on e.deptno = d.deptno
 16  group by d.dname, d.loc;

Result:

OBJ
--------------------------------------------------------------------------------
{"OBJ":{"DEPARTMENT":{"NAME":"SALES","LOCATION":"CHICAGO"}},"EMPS":[{"NAME":"WAR
D","JOB":"SALESMAN","SALARY":1250.1},{"NAME":"MARTIN","JOB":"SALESMAN","SALARY":
1250.1},{"NAME":"BLAKE","JOB":"MANAGER","SALARY":2850},{"NAME":"JAMES","JOB":"CL
ERK","SALARY":950.1},{"NAME":"ALLEN","JOB":"SALESMAN","SALARY":1600.1},{"NAME":"
TURNER","JOB":"SALESMAN","SALARY":1500.1}]}

{"OBJ":{"DEPARTMENT":{"NAME":"RESEARCH","LOCATION":"DALLAS"}},"EMPS":[{"NAME":"J
ONES","JOB":"MANAGER","SALARY":2975},{"NAME":"SCOTT","JOB":"ANALYST","SALARY":30
00},{"NAME":"SMITH","JOB":"CLERK","SALARY":800.1},{"NAME":"ADAMS","JOB":"CLERK",
"SALARY":1100.1},{"NAME":"FORD","JOB":"ANALYST","SALARY":3000}]}

{"OBJ":{"DEPARTMENT":{"NAME":"ACCOUNTING","LOCATION":"NEW YORK"}},"EMPS":[{"NAME
":"CLARK","JOB":"MANAGER","SALARY":2450},{"NAME":"MILLER","JOB":"CLERK","SALARY"
:1300.1},{"NAME":"KING","JOB":"PRESIDENT","SALARY":5000}]}


SQL>

If you take any of these and copy/paste it into e.g. JSON formatter and validator to check how it really looks like and if it is valid, you'd get

{
   "OBJ":{
      "DEPARTMENT":{
         "NAME":"SALES",
         "LOCATION":"CHICAGO"
      }
   },
   "EMPS":[
      {
         "NAME":"WARD",
         "JOB":"SALESMAN",
         "SALARY":1250.1
      },
      {
         "NAME":"MARTIN",
         "JOB":"SALESMAN",
         "SALARY":1250.1
      },
      {
         "NAME":"BLAKE",
         "JOB":"MANAGER",
         "SALARY":2850
      },
      {
         "NAME":"JAMES",
         "JOB":"CLERK",
         "SALARY":950.1
      },
      {
         "NAME":"ALLEN",
         "JOB":"SALESMAN",
         "SALARY":1600.1
      },
      {
         "NAME":"TURNER",
         "JOB":"SALESMAN",
         "SALARY":1500.1
      }
   ]
}

which is a valid JSON.

如何轻松将外部连接的SQL表转换为JSON对象?

不再让梦枯萎 2025-02-14 11:54:08

如果您有一个位置列表,则可以设置数组索引

Collection.ensureIndex({
类型:“ geo”,
字段:[“位置[*]”,
Geojson:是的
}))

If you have a list of locations you can set up an array-index.

collection.ensureIndex({
type: "geo",
fields: [ "locations[*]" ],
geoJson:true
})

如何在多个位置进行Arangodb Geo索引[LAT,LON]

不再让梦枯萎 2025-02-14 10:02:57

您可以使用Timestamo转换内置

 选择时间戳'2022-06-14T13:04:00.610Z'
 
 |时间戳|
| :-------------------------- |
| 2022-06-14 13:04:00.61 |
 选择'2022-06-14T13:04:00.610Z':: TIMESTAMP 
 
 |时间戳|
| :-------------------------- |
| 2022-06-14 13:04:00.61 |

db&lt;&gt;&gt

;

 选择date_trunc('第二',Timestamp'2022-06-14T13:04:00.610Z')
 
 | date_trunc |
| :----------------------- |
| 2022-06-14 13:04:00 |
 选择date_trunc('第二','2022-06-14T13:04:00.610Z':: TIMESTAMP) 
 
 | date_trunc |
| :----------------------- |
| 2022-06-14 13:04:00 |

db&lt;&gt;&gt;

you can use built in timestamo conversion

SELECT timestamp '2022-06-14T13:04:00.610Z'
| timestamp              |
| :--------------------- |
| 2022-06-14 13:04:00.61 |
SELECT '2022-06-14T13:04:00.610Z'::timestamp 
| timestamp              |
| :--------------------- |
| 2022-06-14 13:04:00.61 |

db<>fiddle here

You can use date_trunc

SELECT date_trunc('second',timestamp '2022-06-14T13:04:00.610Z')
| date_trunc          |
| :------------------ |
| 2022-06-14 13:04:00 |
SELECT date_trunc('second','2022-06-14T13:04:00.610Z'::timestamp) 
| date_trunc          |
| :------------------ |
| 2022-06-14 13:04:00 |

db<>fiddle here

Postgres SQL中的时间戳转换

不再让梦枯萎 2025-02-14 08:37:27

从该部分中删除了溢出规则,并从主代码中删除了两个图像,并使用伪元素前后的伪删除了部分。

这样,手机可以在部分本身之外伸出。

定位已从rems转移到%,以使整个响应量更快 - 尽管鉴于手机映像的纵横比,需要对肖像设备上的预期布局有一些思考这个问题的范围。

/* Section-2 */

#section-2 {
  color: white;
  height: 50vh;
  border-radius: 0 10rem 0 10rem;
  position: relative;
  width: 100%;
  top: 10vh;
  /* just so we can see the phone at the top */
}


/* Backgrounds */

#section-2::before,
#section-2::after {
  content: '';
  display: inline-block;
  width: 100%;
  position: absolute;
  left: 0;
  z-index: -1;
  background-repeat: no-repeat;
}

#section-2::before {
  /* opacity: 0.9; Is this required? If so, on which of the parts of the background? */
  height: 100%;
  top: 0;
  border-radius: 0 10rem 0 10rem;
  background-color: #393b59;
  background-image: url(https://i.sstatic.net/catHQ.png);
  background-size: 70% auto;
  background-position: -50% 80%;
}

#section-2::after {
  height: 150%;
  top: -20%;
  background-image: url(https://i.sstatic.net/7xw7Y.png);
  background-size: auto 100%;
  background-position: 20% 0;
}
<section id="section-2">
</section>

The overflow rule is removed from the section and the background colorT he two images are removed from the main code and put behind the section using pseudo before and after elements.

That way the phones can protrude outside the section itself.

Positioning has been moved from rems to % so as to make the whole a bit more responsive - though given the aspect ratio of the phone image there needs to be some thought as to what is the intended layout on portrait devices but that is out of the scope of this question.

/* Section-2 */

#section-2 {
  color: white;
  height: 50vh;
  border-radius: 0 10rem 0 10rem;
  position: relative;
  width: 100%;
  top: 10vh;
  /* just so we can see the phone at the top */
}


/* Backgrounds */

#section-2::before,
#section-2::after {
  content: '';
  display: inline-block;
  width: 100%;
  position: absolute;
  left: 0;
  z-index: -1;
  background-repeat: no-repeat;
}

#section-2::before {
  /* opacity: 0.9; Is this required? If so, on which of the parts of the background? */
  height: 100%;
  top: 0;
  border-radius: 0 10rem 0 10rem;
  background-color: #393b59;
  background-image: url(https://i.sstatic.net/catHQ.png);
  background-size: 70% auto;
  background-position: -50% 80%;
}

#section-2::after {
  height: 150%;
  top: -20%;
  background-image: url(https://i.sstatic.net/7xw7Y.png);
  background-size: auto 100%;
  background-position: 20% 0;
}
<section id="section-2">
</section>

我如何获得电话映像以忽略溢出规则

不再让梦枯萎 2025-02-14 08:05:08

首先,玛丽安(Marian)甚至给了我关于rank()函数的建议。

SELECT orders.Service,
       (CASE
            WHEN `Rank` = 1 THEN (orders.`Cost of Service`)
            ELSE 0 END)                                          AS 'Service Cost',
       orders.`Part Used`,
       orders.Quantity,
       orders.`Cost of Part`,
       SUM(CASE
               WHEN `Rank` = 1 THEN (orders.Quantity * orders.`Cost of Part` + orders.`Cost of Service`)
               ELSE orders.Quantity * orders.`Cost of Part` END) AS `Total Bill`
FROM (SELECT s.name                                                     AS 'Service',
             cost                                                       AS `Cost of Service`,
             p.name                                                     AS `Part Used`,
             quantity                                                   AS `Quantity`,
             price_sold                                                 AS 'Cost of Part',
             RANK() OVER ( PARTITION BY s.name ORDER BY s.name, p.name) AS `Rank`
      FROM work_order
               JOIN client ON client.client_ID = work_order.client_ID
               JOIN vehicle v ON v.vehicle_ID = work_order.vehicle_ID
               JOIN model m ON m.model_ID = v.model_ID
               JOIN completed_work_order cwo ON work_order.work_order_ID = cwo.work_order_ID
               JOIN service s ON s.service_ID = cwo.service_ID
               JOIN model_services ms ON m.model_ID = ms.model_ID AND s.service_ID = ms.service_ID
               JOIN used_parts up ON cwo.completed_work_order_ID = up.completed_work_order_ID
               JOIN part p ON p.part_ID = up.part_ID
      WHERE client.client_ID = 6) AS orders
GROUP BY orders.Service, orders.`Cost of Service`, orders.`Part Used`, orders.Quantity, orders.`Cost of Part`;

诀窍是在我的“服务”中创建一个重复值的等级。然后,我们使用案例来检查排名何时1,那么一切都应正常工作,但对于更高的等级值,将模型服务的成本设置为0,仅计算总账单的零件成本。这就是结果:

First of all, some credit goes to marian for even giving me the suggestion about RANK() function.

SELECT orders.Service,
       (CASE
            WHEN `Rank` = 1 THEN (orders.`Cost of Service`)
            ELSE 0 END)                                          AS 'Service Cost',
       orders.`Part Used`,
       orders.Quantity,
       orders.`Cost of Part`,
       SUM(CASE
               WHEN `Rank` = 1 THEN (orders.Quantity * orders.`Cost of Part` + orders.`Cost of Service`)
               ELSE orders.Quantity * orders.`Cost of Part` END) AS `Total Bill`
FROM (SELECT s.name                                                     AS 'Service',
             cost                                                       AS `Cost of Service`,
             p.name                                                     AS `Part Used`,
             quantity                                                   AS `Quantity`,
             price_sold                                                 AS 'Cost of Part',
             RANK() OVER ( PARTITION BY s.name ORDER BY s.name, p.name) AS `Rank`
      FROM work_order
               JOIN client ON client.client_ID = work_order.client_ID
               JOIN vehicle v ON v.vehicle_ID = work_order.vehicle_ID
               JOIN model m ON m.model_ID = v.model_ID
               JOIN completed_work_order cwo ON work_order.work_order_ID = cwo.work_order_ID
               JOIN service s ON s.service_ID = cwo.service_ID
               JOIN model_services ms ON m.model_ID = ms.model_ID AND s.service_ID = ms.service_ID
               JOIN used_parts up ON cwo.completed_work_order_ID = up.completed_work_order_ID
               JOIN part p ON p.part_ID = up.part_ID
      WHERE client.client_ID = 6) AS orders
GROUP BY orders.Service, orders.`Cost of Service`, orders.`Part Used`, orders.Quantity, orders.`Cost of Part`;

The trick is to create a RANK over the duplicate value which in my case in the 'Service'. Then we use CASE to check when the Rank is 1, then everything should work as normal but for higher rank values, set the cost of model services to 0, and only compute the cost of parts only for total bills. And here is the result:
enter image description here

如何在选择查询中替换重复记录的列?

不再让梦枯萎 2025-02-13 19:16:47

我简化了:

#include <boost/asio.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>

void thread1(std::function<void()> createThread) {
    createThread();
    while (true) {
        std::cout << "Sleeping" << std::endl;
        sleep(1);
    }
}

void thread2() { std::cout << "You made it" << std::endl; }

int main() {
    boost::asio::thread_pool pool;

    post(pool,
         boost::bind(thread1, [&pool]() { post(pool, boost::bind(thread2)); }));

    pool.join();
}

请注意,endl迫使Stdout冲洗,这有助于获得您可以期望的结果。

但是

有一个代码气味:

  • ,当使用螺纹池
  • bind表达式
  • createThread不(创建线程)
  • 将引用传递到执行上下文时, 使用明确的“线程”。相反,通过

执行以下执行者:

#include <boost/asio.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>

using Executor = boost::asio::thread_pool::executor_type;

void task_loop(Executor ex, std::function<void()> task) {
    while (true) {
        post(ex, task);
        sleep(1);
    }
}

void task_function() { std::cout << "Task executes" << std::endl; }

int main() {
    boost::asio::thread_pool pool;

    post(pool, boost::bind(task_loop, pool.get_executor(), task_function));

    pool.join();
}

每秒打印:

Task executes
Task executes
...

I'd simplify:

#include <boost/asio.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>

void thread1(std::function<void()> createThread) {
    createThread();
    while (true) {
        std::cout << "Sleeping" << std::endl;
        sleep(1);
    }
}

void thread2() { std::cout << "You made it" << std::endl; }

int main() {
    boost::asio::thread_pool pool;

    post(pool,
         boost::bind(thread1, [&pool]() { post(pool, boost::bind(thread2)); }));

    pool.join();
}

Note the endl that forces stdout to flush, which helps getting results you can expect.

HOWEVER

There's a code smell with:

  • using explicit "threads" when using a thread-pool
  • nullary bind expressions
  • createThread doesn't (create a thread)
  • passing references to execution contexts. Instead, pass executors

Applying these:

#include <boost/asio.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>

using Executor = boost::asio::thread_pool::executor_type;

void task_loop(Executor ex, std::function<void()> task) {
    while (true) {
        post(ex, task);
        sleep(1);
    }
}

void task_function() { std::cout << "Task executes" << std::endl; }

int main() {
    boost::asio::thread_pool pool;

    post(pool, boost::bind(task_loop, pool.get_executor(), task_function));

    pool.join();
}

Prints each second:

Task executes
Task executes
...

捕获boost :: asio :: thread_pool in lambda函数

不再让梦枯萎 2025-02-13 13:08:17

请不要使用ListView。 ListView已过时,并且不像Recyclerview那样有效。 Here is a good doc

Please don't use ListView. ListView is outdated and not so efficient as RecyclerView. Here is a good doc how to use RecyclerView

将ArrayAdapter的ArrayList值获取Android Studio中的listView

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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