装纯掩盖桑

文章 评论 浏览 26

装纯掩盖桑 2025-02-15 23:44:26

*是一个元字符,需要逃脱成为常规角色:

/\*\*

VIM将其称为“魔术”:如果模式为“魔术”,则需要逃脱元观念,如果它是“ nomagic”,您没有(这有点过分简化,请参见:help Magic )。

因此,您可以用 \ m 甚至“非常名义”将VIM强制将模式视为“ nomagic”,并使用 \ v

/\V**

它无济于事,此处,但是……

关于为什么/** 突出显示了整个缓冲区,可以在下找到提示:help/star/star

Exception: When "*" is used at the start of the pattern or just after
"^" it matches the star character.
  • 第一个*匹配缓冲区中的星星,
  • 第二个*匹配零或以上原子的零或更多原子,因此,本质上是每个字符。

* is a meta-character that needs to be escaped to become a regular character:

/\*\*

Vim refers to this as "magic": if the pattern is "magic", you need to escape meta-characters, if it is "nomagic", you don't (this is a bit over-simplified, see :help magic).

Therefore, you can force Vim to treat the pattern as "nomagic" with \M or even "very nomagic", with \V:

/\V**

Which doesn't help much, here, but well…

As for why /** highlights the whole buffer, a hint can be found under :help /star:

Exception: When "*" is used at the start of the pattern or just after
"^" it matches the star character.
  • The first * matches (at least some of) the stars in your buffer,
  • The second * matches zero or more of the preceding atom, as many as possible, so, essentially, every character.

如何使用vim中的文件中搜索字符串`**`的所有出现?

装纯掩盖桑 2025-02-15 23:07:25

在您的视频标签中使用预加载属性并将其设置为无。

<video controls preload="none" poster="video-poster.jpg">
  <source src="video-name.webm" type="video/webm">
  <source src="video-name.mp4" type="video/mp4">
</video>

use preload attribute in your video tag and set it to none.

<video controls preload="none" poster="video-poster.jpg">
  <source src="video-name.webm" type="video/webm">
  <source src="video-name.mp4" type="video/mp4">
</video>

停止“加载”视频如果不在视口

装纯掩盖桑 2025-02-15 13:25:43

从熊猫v1.4.0开始,附加被弃用 concat source )。另外,您必须将返回值分配给 final_df 才能查看更改。 附加 concat 不要为您更新数据帧。

import pandas as pd
def my_fun(var):
    temp={"File_Exist":'no',"desc":var,"Bucket":'bucket',"name":'fadsf',"size":'','last_modified':'',"generation":''}
    temp_df=pd.DataFrame(temp,columns=list(temp.keys()), index=['x'])

    return temp_df

final_df = pd.DataFrame()   

final_df = pd.concat([final_df, my_fun('my 1st file')],ignore_index = True)
final_df = pd.concat([final_df, my_fun('my 2nd file')],ignore_index = True)

print(final_df) 

As of pandas v1.4.0, append is deprecated in favor of concat (source). Also, you must assign the return value to final_df in order to see changes; append and concat do not update the data frames for you.

import pandas as pd
def my_fun(var):
    temp={"File_Exist":'no',"desc":var,"Bucket":'bucket',"name":'fadsf',"size":'','last_modified':'',"generation":''}
    temp_df=pd.DataFrame(temp,columns=list(temp.keys()), index=['x'])

    return temp_df

final_df = pd.DataFrame()   

final_df = pd.concat([final_df, my_fun('my 1st file')],ignore_index = True)
final_df = pd.concat([final_df, my_fun('my 2nd file')],ignore_index = True)

print(final_df) 

无法在数据框架中附加数据

装纯掩盖桑 2025-02-15 06:46:44

使用掩码图像属性像该形状和使用位置一样掩盖:绝对和进一步

 -webkit-mask-image: url(---.png);    //use the image shape to mask
 mask-image: url(---.png);
-webkit-mask-size: 70%;
mask-size: 70%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat; 

Use mask image property to mask like that shape and use position:absolute and do Further

 -webkit-mask-image: url(---.png);    //use the image shape to mask
 mask-image: url(---.png);
-webkit-mask-size: 70%;
mask-size: 70%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat; 

图片中的零件切断

装纯掩盖桑 2025-02-15 04:19:15

是,否。如果您使用胶水数据目录来查询雅典娜(默认情况下,您是),则雅典娜支持用10m分区的查询表。但是,它实际上只能一次使用1M。 source

Yes and no. If you are using the Glue data catalog to query Athena (by default, you are), then Athena supports querying tables with 10m partitions. However, it can only actually use 1m of those partitions at a time. source

AWS雅典娜桌自动出现在AWS胶水控制台中

装纯掩盖桑 2025-02-14 18:07:43

请参阅此处: /a>。异步函数将无法从ES2017打开回调参数。看看您正在使用的ES版本。

解决方法是使工人的功能不是“异步”,而是基于“异步”。如果有人知道如何在不转换承诺的情况下修复它,那么将不胜感激。

// async bases
async function worker(opts, callback) { // callback will be undefined}
const q = async.queue(worker)

//promised based
function worker(opts, callback) { // callback will work as expected}
const q = async.queue(worker)

无论我们在哪里接受节点式异步函数,我们也直接接受ES2017异步函数。在这种情况下,异步函数将不会传递最终回调参数,并且任何抛出的错误都将用作隐式回调的错误参数,并且返回值将用作结果值。 (即拒绝退回的承诺成为错误回调参数,而解决的值成为结果。)

See here https://caolan.github.io/async/v3/global.html. Async function won't get the callback argument from ES2017 on. Have a look what ES version you're using.

Workaround is be make the worker function not "async" but promised based. If anyone knows how to fix it without switching to promises, comment would be appreciated.

// async bases
async function worker(opts, callback) { // callback will be undefined}
const q = async.queue(worker)

//promised based
function worker(opts, callback) { // callback will work as expected}
const q = async.queue(worker)

Wherever we accept a Node-style async function, we also directly accept an ES2017 async function. In this case, the async function will not be passed a final callback argument, and any thrown error will be used as the err argument of the implicit callback, and the return value will be used as the result value. (i.e. a rejected of the returned Promise becomes the err callback argument, and a resolved value becomes the result.)

与异步处理程序函数的异步标题 - 回调参数未定义

装纯掩盖桑 2025-02-14 07:41:13

请使用 kubectl 运行您的两个应用程序

    kubectl apply -f Partner1-MyApp.yaml --namespace ingress-basic
    kubectl apply -f Partner2-MyApp.yaml --namespace ingress-basic

,以设置以在YAML文件中进行路由,如果两个应用程序都在Kubernetes群集中运行以在每个应用程序 exterm_ip/static 中路由流量。路由服务,创建一个文件名添加此 yaml代码在下面

   apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: partner-ingress-static
      annotations:
        nginx.ingress.kubernetes.io/ssl-redirect: "false"
        nginx.ingress.kubernetes.io/rewrite-target: /static/$2
    spec:
      ingressClassName: nginx
      rules:
      - http:
          paths:
          - path: /static(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: partner1-myapp
                port: 
                  number: 6669

​azure/aks/indress-basic?tabs = azure-powershell“ rel =“ nofollow noreferrer”>在azure kubernetes服务(AKS)中创建一个入口控制器

Please run your two applications using kubectl

    kubectl apply -f Partner1-MyApp.yaml --namespace ingress-basic
    kubectl apply -f Partner2-MyApp.yaml --namespace ingress-basic

To setup for routing in your YAML file, If both application are running in Kubernetes cluster to route traffic in each application EXTERNAL_IP/static is needed to route the service, create a file name add this YAML code in below

   apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: partner-ingress-static
      annotations:
        nginx.ingress.kubernetes.io/ssl-redirect: "false"
        nginx.ingress.kubernetes.io/rewrite-target: /static/$2
    spec:
      ingressClassName: nginx
      rules:
      - http:
          paths:
          - path: /static(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: partner1-myapp
                port: 
                  number: 6669

enter image description here

To more in detail please refer this link :

Create an ingress controller in Azure Kubernetes Service (AKS)

在AKS中为基于REGEX的路由设置

装纯掩盖桑 2025-02-13 18:05:59

没有捕获异常不确定的行为?

不,明确的定义是,这将导致呼叫 std :: terminate (没有UB),尽管在呼叫之前是否在呼叫之前解开了堆栈,如 [except.thexext.ternation]

在某些情况下,

/1的例外处理被放弃,以减少细微
错误处理技术。

  • [...]
  • 当异常处理机构找不到抛出的处理程序时

/2在这种情况下,函数 std :: terminate 被调用。在
找不到匹配处理程序的情况,
实施定义了堆栈是否在
std :: terminate 被调用。
[...]不允许实现基于确定未列的过程最终会导致函数呼叫 std ::终止

Is not catching an exception undefined behavior?

No, it is well-defined that this will result in a call to std::terminate (with no UB), albeit whether the stack is unwound before the call is implementation-defined, as per [except.terminate]:

/1 In some situations exception handling is abandoned for less subtle
error handling techniques.

  • [...]
  • when the exception handling mechanism cannot find a handler for a thrown exception ([except.handle]), or

/2 In such cases, the function std​::​terminate is called. In the
situation where no matching handler is found, it is
implementation-defined whether or not the stack is unwound before
std​::​terminate is called.
[...] An implementation is not permitted to finish stack unwinding prematurely based on a determination that the unwind process will eventually cause a call to the function std​::​terminate

没有发现例外不确定的行为吗?

装纯掩盖桑 2025-02-13 10:59:39

您将道具定义如下:

const props = defineProps<{
  title: IntArgumentListData;
  content: IntArgumentListData;
}>();

这意味着您可以创建两个道具,一种称为 title ,具有 intargumentListData 的类型 IntargumentListData

在您的类型定义 intargumentListData 您已经定义了 title content

所以您想做的是类似的事情:

const props = defineProps<{
  tabsData: IntArgumentListData[];
}>();

在组件中,您只需要循环 TABSDATA

注意:当使用DefineProps时,Props将在模板中可用,而无需使用props.tabsdata;尽管在脚本设置中,您需要使用props.tabsdata 访问它,

 <TabPanel v-for="tab in tabsData" :key="tab.title" :header="tab.title">

然后将其在父母中使用时将其暴露在组件上。
在那里,您必须将数据绑定到组件调用的道具。

 <ArgumentTabComponent :tab-data="tabsData" />

有用的文档链接:


您可以提供错误的英文翻译吗?

应该导致这样的事情:

<script setup lang="ts">
//import { reactive, ref, computed } from "vue";
import ArgumentTabComponent from "./components/ArgumentTabComponent.vue";
import $t from "@/core/utils/i18n/translate";
import Button from "primevue/button";
import type { IntArgumentListData } from "./types/IntArgumentListData";

const tabsData: IntArgumentListData[] = [
  {
    title: "Argumento 1",
    content: "texto1",
  },
  {
    title: "Argumento 2",
    content: "texto2",
  },
  {
    title: "Argumento 3",
    content: "texto3",
  },
  {
    title: "Argumento 4",
    content: "texto4",
  },
  {
    title: "Argumento 5",
    content: "texto5",
  },
];

const handleRedirect = () => {
  alert("Aceptando!");
};
</script>

<template>
  <br />
  <h1>Argumentarios</h1>
  <div class="">
    <ArgumentTabComponent :tabs-data="tabsData" />
    <hr />
    <Button :label="$t('common.accept')" @click="handleRedirect" />
  </div>
</template>

孩子:

<script setup lang="ts">
import TabView from "primevue/tabview.vue";
import TabPanel from "primevue/tabpanel.vue";

// Lib imports
//import { ref } from "vue";
import type { IntArgumentListData } from "../types/IntArgumentListData";

// Properties
const props = defineProps<{
  tabsData: IntArgumentListData[];
}>();
</script>

<template>
  <br />
  <div class="">
    <TabView>
      <TabPanel v-for="tab in tabsData" :key="tab.title" :header="tab.title">
        <p>{{ tab.content }}</p>
      </TabPanel>
    </TabView>
  </div>
  <br />
</template>

You defined your props as follows:

const props = defineProps<{
  title: IntArgumentListData;
  content: IntArgumentListData;
}>();

Which means you create two props, one called title with a type of IntArgumentListData and one called content with a type of IntArgumentListData.

In your type-definition IntArgumentListData you already defined title and content

So what you want to do is presumably something like this:

const props = defineProps<{
  tabsData: IntArgumentListData[];
}>();

And in your component you only need to loop over tabsData.

NOTE: When using defineProps the props will be available in the template without using props.tabsData; although in the script setup you need to access it with props.tabsData

 <TabPanel v-for="tab in tabsData" :key="tab.title" :header="tab.title">

this prop will then be exposed on the component when used in the parent.
There you will have to bind the data to the prop on component call.

 <ArgumentTabComponent :tab-data="tabsData" />

Helpful documentation links:


Can you provide an english translation of the error?

It should result in something like this:

<script setup lang="ts">
//import { reactive, ref, computed } from "vue";
import ArgumentTabComponent from "./components/ArgumentTabComponent.vue";
import $t from "@/core/utils/i18n/translate";
import Button from "primevue/button";
import type { IntArgumentListData } from "./types/IntArgumentListData";

const tabsData: IntArgumentListData[] = [
  {
    title: "Argumento 1",
    content: "texto1",
  },
  {
    title: "Argumento 2",
    content: "texto2",
  },
  {
    title: "Argumento 3",
    content: "texto3",
  },
  {
    title: "Argumento 4",
    content: "texto4",
  },
  {
    title: "Argumento 5",
    content: "texto5",
  },
];

const handleRedirect = () => {
  alert("Aceptando!");
};
</script>

<template>
  <br />
  <h1>Argumentarios</h1>
  <div class="">
    <ArgumentTabComponent :tabs-data="tabsData" />
    <hr />
    <Button :label="$t('common.accept')" @click="handleRedirect" />
  </div>
</template>

Child:

<script setup lang="ts">
import TabView from "primevue/tabview.vue";
import TabPanel from "primevue/tabpanel.vue";

// Lib imports
//import { ref } from "vue";
import type { IntArgumentListData } from "../types/IntArgumentListData";

// Properties
const props = defineProps<{
  tabsData: IntArgumentListData[];
}>();
</script>

<template>
  <br />
  <div class="">
    <TabView>
      <TabPanel v-for="tab in tabsData" :key="tab.title" :header="tab.title">
        <p>{{ tab.content }}</p>
      </TabPanel>
    </TabView>
  </div>
  <br />
</template>

如何通过Typescript将道具从父级传递到vue3j中的子组件

装纯掩盖桑 2025-02-13 10:15:51

有几种方法可以实现:

  • 您可以在 projects 组件中移动 prosecon 路由,例如:
const Projects = () => {
...other logic
return(
 <Routes>
   <Route path="/individual_project" element={<IndividualProject />} />
 </Routes>
)
}

docs: https://reactrouter.com/docs/docs/en/en/v6/getting-started/overview-started/overview#nested-routes

  • 另外,您还可以创建一个上下文来包装路由。然后,您可以直接从上下文中检索变量:
<Context.Provider value={yourValuesToShare}>
 <Routes>
    <Route path="/" element={<Login navigate={navigate} setOverlays={setOverlays} setToken={setToken} setUser={setUser} />} />
    <Route path="/create-account" element={<CreateAccount />} />
    <Route path="/projects" element={<Projects token={token} name={user.name} jobTitle={user.jobTitle} navigate={navigate} setOverlays={setOverlays} />} />
    <Route path="/individual_project" element={<IndividualProject />} />
 </Routes>
</Context.Provider>

docs: https://reactjs.s.orgg/docss /context.html

There are few ways to achieve that:

  • You can move the individual_project route inside the Projects component like this:
const Projects = () => {
...other logic
return(
 <Routes>
   <Route path="/individual_project" element={<IndividualProject />} />
 </Routes>
)
}

Docs here: https://reactrouter.com/docs/en/v6/getting-started/overview#nested-routes

  • Alternatively, you could also create a context to wrap the routes. Then, you can retrieve the variables directly from the context:
<Context.Provider value={yourValuesToShare}>
 <Routes>
    <Route path="/" element={<Login navigate={navigate} setOverlays={setOverlays} setToken={setToken} setUser={setUser} />} />
    <Route path="/create-account" element={<CreateAccount />} />
    <Route path="/projects" element={<Projects token={token} name={user.name} jobTitle={user.jobTitle} navigate={navigate} setOverlays={setOverlays} />} />
    <Route path="/individual_project" element={<IndividualProject />} />
 </Routes>
</Context.Provider>

Docs here: https://reactjs.org/docs/context.html

React路由器V6路由组件需要另一个路由组件的状态/道具

装纯掩盖桑 2025-02-12 12:01:51

您可以使用 cleaned_data 保存表单。

尝试以下视图:

views.py


def account(request):
    profile_instance = profile.objects.get(user=request.user)
    form = accountForm(instance=profile_instance)
    if request.method == "POST":
        form = accountForm(request.POST, instance=profile_instance)
        if form.is_valid():
            user = request.user
            bio = request.POST.get('bio')
            profile_img = request.POST.get('profile_img')
            location = request.POST.get('location')

            profile.objects.create(
                user=user, bio=bio, profile_img=profile_img, location=location)
            return redirect("sign_in")
    else:
        form = accountForm()

    return render(request, "home/account.html", {'form': form})

确保您已登录,并且配置文件模型不包含两个相同的用户用于上述代码的工作,因为您已将其 foreferkey

注意:模型是用 pascalcase 而不是 Smallcase 编写的,因此,如果您将其命名为配置文件而不是 配置文件 。表单也是如此,如果您编写 accountform 或更多更好的 profileform 而不是 accode> accodeform 。。。 >




尝试以下代码,在其中创建个人配置文件。

Models.py


class profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    # other fields are same...

在实际情况下,最好将用户 a onetoonefield 模型,因为一个人只能拥有一个配置文件,我以为您是第一次创建用户的个人资料,而不是更新现有的配置文件,所以我不会使用
实例在表单中。

views.py

def account(request):
    if request.method == "POST":
        form = accountForm(request.POST)
        if form.is_valid():
            username = request.POST.get('username')
            password = request.POST.get('password1')
            bio = request.POST.get('bio')
            profile_img = request.POST.get('profile_img')
            location = request.POST.get('location')
            created_user = User.objects.create(
                username=username, password=password)

            profile.objects.create(
                user=created_user, bio=bio, profile_img=profile_img, location=location)
            return redirect('sign_in')
    else:
        form = accountForm()

    return render(request, "home/account.html", {'form': form})

forms.py

class accountForm(ModelForm):
    username = forms.CharField(
        widget=forms.TextInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(
        widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(
        widget=forms.PasswordInput(attrs={'class': 'form-control'}))

    def clean(self):
        cleaned_data = super().clean()
        p1 = cleaned_data.get('password1')
        p2 = cleaned_data.get('password2')
        if p1 != p2:
            raise forms.ValidationError('Both the passwords must match')

    class Meta:
        model = profile
        fields = ['username', 'password1',
                  'password2', 'profile_img', 'bio', 'location']
        widgets = {
            # 'fields': forms.TextInput(attrs={'class': "form-control"}),
            'profile_img': forms.FileInput(attrs={'class': 'form-control', 'id': 'inputGroupFile04'}),
            'bio': forms.Textarea(attrs={'class': 'form-control'}),
            'location': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Location'}),

        }

它将直接创建新用户的配置文件,并使用密码验证,这些用户也与 user 模型有关,因此您将不会在中获得字段用户的错误配置文件模型必须是用户实例

You can use cleaned_data to save the form.

Try this view:

views.py


def account(request):
    profile_instance = profile.objects.get(user=request.user)
    form = accountForm(instance=profile_instance)
    if request.method == "POST":
        form = accountForm(request.POST, instance=profile_instance)
        if form.is_valid():
            user = request.user
            bio = request.POST.get('bio')
            profile_img = request.POST.get('profile_img')
            location = request.POST.get('location')

            profile.objects.create(
                user=user, bio=bio, profile_img=profile_img, location=location)
            return redirect("sign_in")
    else:
        form = accountForm()

    return render(request, "home/account.html", {'form': form})

Make sure, you are logged in and profile model does not contain two same users for working of above code, as you have made it Foreignkey.

Note: Models are written in PascalCase not smallcase, so it will be better if you name it as Profile instead of profile. Same goes for forms, better if you write AccountForm, or more better ProfileForm instead of accountForm.




Try below code, in which profile will be created directlty.

models.py


class profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    # other fields are same...

In real scenario, it will be better to make user a OneToOneField in Profile model, as one person can only have one profile, I assumed you are creating users' profile first time, rather than updating the existing profiles, so I'll not use
instance in form.

views.py

def account(request):
    if request.method == "POST":
        form = accountForm(request.POST)
        if form.is_valid():
            username = request.POST.get('username')
            password = request.POST.get('password1')
            bio = request.POST.get('bio')
            profile_img = request.POST.get('profile_img')
            location = request.POST.get('location')
            created_user = User.objects.create(
                username=username, password=password)

            profile.objects.create(
                user=created_user, bio=bio, profile_img=profile_img, location=location)
            return redirect('sign_in')
    else:
        form = accountForm()

    return render(request, "home/account.html", {'form': form})

forms.py

class accountForm(ModelForm):
    username = forms.CharField(
        widget=forms.TextInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(
        widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(
        widget=forms.PasswordInput(attrs={'class': 'form-control'}))

    def clean(self):
        cleaned_data = super().clean()
        p1 = cleaned_data.get('password1')
        p2 = cleaned_data.get('password2')
        if p1 != p2:
            raise forms.ValidationError('Both the passwords must match')

    class Meta:
        model = profile
        fields = ['username', 'password1',
                  'password2', 'profile_img', 'bio', 'location']
        widgets = {
            # 'fields': forms.TextInput(attrs={'class': "form-control"}),
            'profile_img': forms.FileInput(attrs={'class': 'form-control', 'id': 'inputGroupFile04'}),
            'bio': forms.Textarea(attrs={'class': 'form-control'}),
            'location': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Location'}),

        }

It will create new users' profile directly, with password validation and those users also relate to User model, so you'll not get the error of the field user in profile model must be an user instance.

django form.is_valid失败&amp;不保存表格

装纯掩盖桑 2025-02-12 06:08:32

这是一种使用更新带有聚合管道功能的更新操作的方法(需要MongoDB v4.2或更高)。变量 new_events 表示作为文档数组输入的新数据(例如, [{“ eventname”:“ fote”,“ pote”,“ protorid”,“ actorId”:“ 5”,“详细信息”: “ up”},{...},...] )。

db.collection.updateMany(
{ },    // query filter
[
  { 
      $set: { 
          events: {
              $reduce: {
                  input: NEW_EVENTS,
                  initialValue: "$events",
                  in: {
                      $cond: {
                          if: {
                              $eq: [ 
                                  { $size: {
                                      $filter: {
                                          input: "$events",
                                          as: "ev",
                                          cond: {
                                              $and: [
                                                  { $eq: [ "$this.eventName", "$ev.eventName" ] },
                                                  { $eq: [ "$this.actorId", "$ev.actorId" ] }
                                              ]
                                          }
                                      } 
                                  }}, 0
                              ]
                          },
                          then: { $concatArrays: [ "$value", [ "$this" ] ] },
                          else: "$value"
                      }
                  }
              }
          }
      }
  }
])

Here is a way of performing the update operation using Updates With Aggregation Pipeline feature (requires MongoDB v4.2 or higher). The variable NEW_EVENTS represents the new data that is input as an array of documents (e.g., [ { "eventName" : "Vote", "actorId" : "5", "detail" : "up" }, { ... }, ... ] ).

db.collection.updateMany(
{ },    // query filter
[
  { 
      $set: { 
          events: {
              $reduce: {
                  input: NEW_EVENTS,
                  initialValue: "$events",
                  in: {
                      $cond: {
                          if: {
                              $eq: [ 
                                  { $size: {
                                      $filter: {
                                          input: "$events",
                                          as: "ev",
                                          cond: {
                                              $and: [
                                                  { $eq: [ "$this.eventName", "$ev.eventName" ] },
                                                  { $eq: [ "$this.actorId", "$ev.actorId" ] }
                                              ]
                                          }
                                      } 
                                  }}, 0
                              ]
                          },
                          then: { $concatArrays: [ "$value", [ "$this" ] ] },
                          else: "$value"
                      }
                  }
              }
          }
      }
  }
])

MongoDB-如何根据特定字段确保数组中的唯一项目?

装纯掩盖桑 2025-02-11 15:59:25

所以。服务器端GTM正是它所说的。它在服务器上执行。它听取网络请求。它没有任何接触前端发生的事情。前端没有任何线索,即服务器端GTM。好吧,除非有明确调用其端点,否则您可以在需要时与后端镜子代理。

您所经历的是Adblockers阻止您的前端GTM容器。尽管理论上可以跟踪您所需的一切,包括使用服务器端GTM的前端事件,但它被认为是使用GTMS和流前端事件通过前端GTM进行后端GTM的最佳实践。

当然,这会让您依赖Adblockers,因为它们会阻止您的前端GTM。避免这种情况的一种方法是...好吧,不要使用前端GTM,并且在没有阻止的标签管理器中实现了所有跟踪所有前端跟踪并将其发送到后端GTM进行正确处理和分发。

通常,没有TMS实施跟踪太贵了,因为现在您确实必须了解JS,因此只有很酷的孩子才能负担得起这样做。一个很好的例子是亚马逊。

基本上,没有TMS的实施跟踪的费用约为两到五倍(取决于细节),但是Adblockers通常只降低了约10%的流量。 10%对于报告,衡量Funnels的有效性以及什么不是至关重要。无论如何,分析都没有报告所有至关重要的数据。后端是关键数据的真正来源。

So. Server-side gtm is exactly what it says. It's executed on the server. It listens for network requests. It doesn't have any exposure to what happens on the front-end. And the front-end has no clue about there being a server-side GTM. Well, unless there are explicit calls to its endpoint, which you can proxy with your backend mirrors when needed.

What you experience is adblockers blocking your front-end GTM container. Even though it's theoretically possible to track all you need, including front-end events with server-side GTM, it's considered to be the best practice to use both GTMs and stream front-end events to back-end GTM through front-end GTM.

This, of course, makes you dependant on adblockers since they will block your front-end GTM. A way to avoid it is... Well, not to use the front-end GTM and have all your tracking implemented either in a tag manager that is not blocked (I doubt there is one) or just have your own custom javascript library doing all the front-end tracking and sending it to the backend GTM to be properly processed and distributed.

Generally, it's too expensive to implement tracking with no TMS, since now you really have to know your JS, so only the cool kids can afford to do this. A good example would be Amazon.

Basically, it would cost about two to five times more (depending on particulars) to implement tracking with no TMS, but adblockers typically cut only about 10% of traffic. 10% is not vital for reporting, measuring effectiveness of funnels and what not. All the critically important data is not being reported on by analytics anyway. Backend is the real source of critical data.

服务器端GTM上的Adblockers问题

装纯掩盖桑 2025-02-11 11:30:39

您可以将 new_timestamp 绑定到现有对象中,然后返回整个对象

const notifications = [                            
  {
    _id: "12934193c51a231b0165425a",
    userid: '62921df1c14a2eea0efa9399',
    timestamp: 1653817696599,
  },
  {
    _id: "11934193c51a231b0165425a",
    userid: '62921df1c14a2eea0efa9399',
    timestamp: 1653817696600,
  }
];

const newNotifications = notifications.map((element) => {
    element['new_timestamp'] = new Date(element.timestamp).toString()
  return element;
});

console.log(newNotifications);

You can bind the new_timestamp into the existing object nd then return the whole object :

const notifications = [                            
  {
    _id: "12934193c51a231b0165425a",
    userid: '62921df1c14a2eea0efa9399',
    timestamp: 1653817696599,
  },
  {
    _id: "11934193c51a231b0165425a",
    userid: '62921df1c14a2eea0efa9399',
    timestamp: 1653817696600,
  }
];

const newNotifications = notifications.map((element) => {
    element['new_timestamp'] = new Date(element.timestamp).toString()
  return element;
});

console.log(newNotifications);

如何合并映射过程生成的两个对象?

装纯掩盖桑 2025-02-11 04:21:14

要在给定位置(0&lt; = loc&lt; =列数)中插入一个新列,只需使用dataframe.insert:

DataFrame.insert(loc, column, value)

因此,如果要添加列 e < /em> 在数据框架的末尾称为 df ,您可以使用:

e = [-0.335485, -1.166658, -0.385571]    
DataFrame.insert(loc=len(df.columns), column='e', value=e)

value 可以是一个系列,一个整数(在这种情况下,所有单元格都被此值填充),或类似数组的结构

https://pandas.pydata.org/pandas-docs/stable/reference/reference/reference/pandabal/panda/pandas.dataframe.insert.insert.insert.html

to insert a new column at a given location (0 <= loc <= amount of columns) in a data frame, just use Dataframe.insert:

DataFrame.insert(loc, column, value)

Therefore, if you want to add the column e at the end of a data frame called df, you can use:

e = [-0.335485, -1.166658, -0.385571]    
DataFrame.insert(loc=len(df.columns), column='e', value=e)

value can be a Series, an integer (in which case all cells get filled with this one value), or an array-like structure

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.insert.html

如何在现有数据框架中添加新列

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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