骄傲

文章 评论 浏览 32

骄傲 2025-02-16 05:19:35

这是我在模板中获取键列表的方式(我尝试使用对我不起作用的函数,因此可以改进此coudl)

{{- $env_list:= list }}
{{- range $k,$v:= $.Values.default.environments }}
   {{- $env_list = append $env_list $k }}
{{- end }}
{{- range $service := $.Values.services }}
{{- $environment_names:= ternary $service.environments $env_list (hasKey $service "environments") }}

我可以用 $。$。$。devault.environment_names env_list 替换。

Here is how I got the list of the keys in the template (I tried using functions which did not work for me, so this coudl be improved)

{{- $env_list:= list }}
{{- range $k,$v:= $.Values.default.environments }}
   {{- $env_list = append $env_list $k }}
{{- end }}
{{- range $service := $.Values.services }}
{{- $environment_names:= ternary $service.environments $env_list (hasKey $service "environments") }}

I could replace $.Values.default.environment_names with env_list and it works.

舵:获取地图中的键列表

骄傲 2025-02-16 02:44:55

您可以通过 fork join 实现这一目标。
将每个诺言包裹在a 并放入全球叉。
定义按定义加入叉子等待所有请求已完成

You can achieve that by fork join .
Wrap each promise in a from and put in a global fork.
Fork Join by definition waits for all requests to be completed

如何使可观察的/承诺等待其他诺言首先发生?

骄傲 2025-02-15 22:37:49
library(tidyverse)

anti_join(df1,df2)

Joining, by = c("id", "text")
         id text
1 632592651 asdf



anti_join(df2,df1)

Joining, by = c("id", "text")
           id           text
1   632592651       asdf_xyz
2   636809222      tiger_xyz
3  2004722036           lion
4  2004894388        leopard
5  2005045755        ostrich
6  2005535472       kangaroo
7  2005630542       platypus
8  2005788781           fish
9  2005809679        reptile
10 2005838317        mammals
11 2005866692 amphibians_xyz
library(tidyverse)

anti_join(df1,df2)

Joining, by = c("id", "text")
         id text
1 632592651 asdf



anti_join(df2,df1)

Joining, by = c("id", "text")
           id           text
1   632592651       asdf_xyz
2   636809222      tiger_xyz
3  2004722036           lion
4  2004894388        leopard
5  2005045755        ostrich
6  2005535472       kangaroo
7  2005630542       platypus
8  2005788781           fish
9  2005809679        reptile
10 2005838317        mammals
11 2005866692 amphibians_xyz

比较r中两个数据帧之间的差异

骄傲 2025-02-14 21:30:31

如何定义开始应用程序脚本?
您是否设置node_env =生产?

要仔细检查设置断点或控制台。

How are the start app script defined?
Are you setting the NODE_ENV=production?

To double check set a breakpoint or console.log process.env variable to see what you are getting at the runtime.

如何在生产模式下禁用strapi graphql操场

骄傲 2025-02-14 15:55:19

可能需要使用“ Cassandra CQL的PDO驱动程序实现” ...
在这里一样: https://github.com/orange-opensource/yacassandrapdo

就像 PDO将能够产生CQL语法。

One likely needs to use a "PDO driver implementation for Cassandra CQL" ...
alike this one here: https://github.com/Orange-OpenSource/YACassandraPDO

Only then PDO would be able to produce CQL syntax.

是否可以与Cassandra PHP驱动程序一起使用Pdostatement?

骄傲 2025-02-14 14:57:12

您知道如何使用浏览器检查文档吗?这样做表明,您的段落的大小,主要是由于线的高度和边缘,这大大比文本本身大。

要么不使用段落,要么将其线高度设置为零或其他小值并降低边距。然后,您需要调整附近元素的保证金,以根据需要将它们备份。

.verticalLine {
  border-left: 15px solid #00205b;
  height: 500px;
  margin-left: 40px;
  margin-right: 40px;
  margin-bottom: 0px;
}

table {
  border-spacing: 0;
  border-collapse: collapse;
}

.container {
  display: inline-flex;
}

.table1 {
  margin-right: 20px;
}

body {
  margin: 0;
  font-family: "Fira Sans", ariel;
}

p {
  white-space: nowrap;
  line-height: 0;
  margin: 5px;
}
<body>
  <div class="container">
    <table class="table1">
      <tbody>
        <tr>
          <td><img src="ProfilePic.png" width="344" height="344" alt="profile phoot"></td>
          <td rowspan="2">
            <div class="verticalLine"></div>
          </td>
        </tr>
        <tr>
          <td align="center"><img src="LogoPlaceHolder.png" width="240" alt="korhorn financial group logo"></td>
        </tr>
      </tbody>
    </table>
    <table cellspacing="0">
      <tbody>
        <tr>
          <td>
            <p style="font-size: 75px; color: #00205b;">Employee Name</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px; font-weight: 200;">Employee Role</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>e.</strong> &[email protected]</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>p.</strong>  111-222-3333</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>w.</strong>  www.website.com</p>
          </td>
        </tr>
        <tr>
          <td><img src="mapPin.png" width="45px" height="45px">   <img src="yt.png" width="45px" height="45px">   <img src="facebook.png" width="45px" height="45px">   <img src="Instagram.png" width="45px" height="45px">   
            <img src="Twitter.png" width="45px" height="45px"></td>
        </tr>
      </tbody>
    </table>
  </div>
</body>

Do you know how to inspect a document with your browser? Doing so shows that your paragraphs have a default size, mainly due to line height and margin, that is dramatically larger than the text itself.

Either don't use paragraphs or set their line height to zero or another small value and reduce margin. You'll then need to adjust margin on nearby elements to space them back out as needed.

.verticalLine {
  border-left: 15px solid #00205b;
  height: 500px;
  margin-left: 40px;
  margin-right: 40px;
  margin-bottom: 0px;
}

table {
  border-spacing: 0;
  border-collapse: collapse;
}

.container {
  display: inline-flex;
}

.table1 {
  margin-right: 20px;
}

body {
  margin: 0;
  font-family: "Fira Sans", ariel;
}

p {
  white-space: nowrap;
  line-height: 0;
  margin: 5px;
}
<body>
  <div class="container">
    <table class="table1">
      <tbody>
        <tr>
          <td><img src="ProfilePic.png" width="344" height="344" alt="profile phoot"></td>
          <td rowspan="2">
            <div class="verticalLine"></div>
          </td>
        </tr>
        <tr>
          <td align="center"><img src="LogoPlaceHolder.png" width="240" alt="korhorn financial group logo"></td>
        </tr>
      </tbody>
    </table>
    <table cellspacing="0">
      <tbody>
        <tr>
          <td>
            <p style="font-size: 75px; color: #00205b;">Employee Name</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px; font-weight: 200;">Employee Role</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>e.</strong> &[email protected]</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>p.</strong>  111-222-3333</p>
          </td>
        </tr>
        <tr>
          <td>
            <p style="font-size: 35px;"><strong>w.</strong>  www.website.com</p>
          </td>
        </tr>
        <tr>
          <td><img src="mapPin.png" width="45px" height="45px">   <img src="yt.png" width="45px" height="45px">   <img src="facebook.png" width="45px" height="45px">   <img src="Instagram.png" width="45px" height="45px">   
            <img src="Twitter.png" width="45px" height="45px"></td>
        </tr>
      </tbody>
    </table>
  </div>
</body>

为什么我的桌子排比文本内容高得多?

骄傲 2025-02-14 14:53:07

您可以尝试

autos.index[autos['price'] == 820000]
# or
autos[autos['price'] == 820000].index

You can try

autos.index[autos['price'] == 820000]
# or
autos[autos['price'] == 820000].index

用一定的话打印一行,如果在pd.database中

骄傲 2025-02-14 09:30:13

使用数组#MAP 如下:

const input = [1,8],

      output = [...Array(input[1] - input[0] + 1)]
      .map((_,i) => input[0] + i);
      
      
console.log( output );          

Use Array#map as follows:

const input = [1,8],

      output = [...Array(input[1] - input[0] + 1)]
      .map((_,i) => input[0] + i);
      
      
console.log( output );          

从另一个数组创建一个数组

骄傲 2025-02-13 19:44:18

这种方法怎么样?

internal static class ApplicationExtensions
{
    internal static Style GetStyle<T>(this Application app) where T : VisualElement
    {
        var styles = app.Resources.MergedDictionaries.Last();
        return (Style)styles[typeof(T).FullName];
    }

    internal static bool TryGetStyle<T>(this Application app, out Style? style) where T : VisualElement
    {
        var styles = app.Resources.MergedDictionaries.Last();
        var success = styles.TryGetValue(typeof(T).FullName, out object value);
        style = success ? (Style)value : null;
        return success;
    }
}

用法:

// get the style of a Label in an unsafe way
var labelStyle = Application.Current!.GetStyle<Label>();

// get the style of an Entry in a safe way
if (Application.Current!.TryGetStyle<Entry>(out var style)) 
{
    // do something with the style ...
}

有两种检索样式的方法。如果样式不存在,可能会崩溃的不安全方法。如果您始终确定应用程序资源所包含的内容,则可以安全使用。有第二种安全方法,但是它需要更多的代码(类似于其他尝试*方法。

请注意(1):我从最后一个合并的词典中获取样式

。 2):这里的假设始终应用于 VisualElement 的子类别。

How about this approach?

internal static class ApplicationExtensions
{
    internal static Style GetStyle<T>(this Application app) where T : VisualElement
    {
        var styles = app.Resources.MergedDictionaries.Last();
        return (Style)styles[typeof(T).FullName];
    }

    internal static bool TryGetStyle<T>(this Application app, out Style? style) where T : VisualElement
    {
        var styles = app.Resources.MergedDictionaries.Last();
        var success = styles.TryGetValue(typeof(T).FullName, out object value);
        style = success ? (Style)value : null;
        return success;
    }
}

Usage:

// get the style of a Label in an unsafe way
var labelStyle = Application.Current!.GetStyle<Label>();

// get the style of an Entry in a safe way
if (Application.Current!.TryGetStyle<Entry>(out var style)) 
{
    // do something with the style ...
}

There's 2 methods to retrieve a style. An unsafe method that could crash if the style doesn't exist. Would be safe to use if you are always sure what the App Resources contain. There's a second safe approach, but it requires a bit more code to use (similar to other Try* methods in the C# frameworks.

PLEASE NOTE (1): I get the style from the last merged dictionary. The first merged dictionary contains the colors. The extension could be extended to also return color info from the first merged dictionary with similar code.

PLEASE NOTE (2): The assumption here is that styles are always applied to subclasses of VisualElement. I am not sure this would always be correct, but otherwise the restriction could be loosened.

如何在后面的代码中找到具有密钥的资源? [MAUI]

骄傲 2025-02-13 12:29:35

该代码确实使自己使用等待,因此您不必处理嵌套。然后()()处理程序,并且要处理代码流中的分支更容易。这是为什么发明了等待的经典示例(使这样的代码更简单地编写和调试)。

这假设它在 async 标记函数中:

let contains = 0
let temp = {
    username: `${msg.from.first_name} tg`,
};

const res = await tg_bot.getUserProfilePhotos(msg.from.id);
temp['avatarURL'] = await tg_bot.getFileLink(res.photos[0][0].file_id);
if (msg.text !== undefined) {
    temp['content'] = msg.text;
    contains++;
}
if (msg.photo !== undefined) {
    let link = await tg_bot.getFileLink(msg.photo.slice(-1)[0].file_id);
    temp['files'] = [link];
    contains++;
}
if (contains <= 0) {
    temp['content'] = 'empty';
}
webhookClient.send(temp);

如果您想在没有的情况下进行此工作,请仅使用 .then(),则只需将条件调用链接到 getFileLink()(通过返回其诺言),以便下一个

let contains = 0;
let temp = {
    username: `${msg.from.first_name} tg`,
};
const user_profile = tg_bot.getUserProfilePhotos(msg.from.id);
user_profile.then(function(res) {
    return tg_bot.getFileLink(res.photos[0][0].file_id).then(link => {
        temp['avatarURL'] = link;
    }).then(() => {
        if (msg.text !== undefined) {
            temp['content'] = msg.text;
            contains++;
        }
        if (msg.photo !== undefined) {
            return tg_bot.getFileLink(msg.photo.slice(-1)[0].file_id).then(link => {
                temp['files'] = [link];
                contains++;
            });
        }
    }).then(() => {
        if (contains <= 0) {
            temp['content'] = 'empty';
        }
        console.log(temp);
        webhookClient.send(temp);
    });
});

然后还使嵌套并组合


注意:这两个实现都需要错误处理。第一个需要 try/catch 围绕它捕获任何等待语句的拒绝(或呼叫者需要抓住被拒绝的承诺 async

代码>函数

This code really lends itself to using await so you don't have to deal with nested .then() handlers and it's much easier to deal with branching in your code flow. This is a classic example of why await was invented (to make code like this simpler to write and debug).

This assumes it is inside an async tagged function:

let contains = 0
let temp = {
    username: `${msg.from.first_name} tg`,
};

const res = await tg_bot.getUserProfilePhotos(msg.from.id);
temp['avatarURL'] = await tg_bot.getFileLink(res.photos[0][0].file_id);
if (msg.text !== undefined) {
    temp['content'] = msg.text;
    contains++;
}
if (msg.photo !== undefined) {
    let link = await tg_bot.getFileLink(msg.photo.slice(-1)[0].file_id);
    temp['files'] = [link];
    contains++;
}
if (contains <= 0) {
    temp['content'] = 'empty';
}
webhookClient.send(temp);

If you wanted to make this work without await, using only .then(), then you just have to chain the conditional call to getFileLink() (by returning its promise) so that the next .then() block will wait for it:

let contains = 0;
let temp = {
    username: `${msg.from.first_name} tg`,
};
const user_profile = tg_bot.getUserProfilePhotos(msg.from.id);
user_profile.then(function(res) {
    return tg_bot.getFileLink(res.photos[0][0].file_id).then(link => {
        temp['avatarURL'] = link;
    }).then(() => {
        if (msg.text !== undefined) {
            temp['content'] = msg.text;
            contains++;
        }
        if (msg.photo !== undefined) {
            return tg_bot.getFileLink(msg.photo.slice(-1)[0].file_id).then(link => {
                temp['files'] = [link];
                contains++;
            });
        }
    }).then(() => {
        if (contains <= 0) {
            temp['content'] = 'empty';
        }
        console.log(temp);
        webhookClient.send(temp);
    });
});

Note how I've also flattened the nesting and combined .then() blocks that didn't have to be separate.


Note: both these implementations needs error handling. The first needs a try/catch around it to catch any rejections from any of the await statements (or the caller needs to catch the rejected promise the async function would return.

The second implementation needs a .catch() at the end of the chain.

我可以在这种情况下弄清楚如何正确使用Promise

骄傲 2025-02-13 12:20:28

您可以在每个州找到最大人口的城市,并将其与桌子一起使用,并将其加入。

查询

select s.name as state, c.name as city, c.population
from states s
join cities c
on c.state_code = s.code
join (
  select state_code, max(population) as max_pop
  from cities 
  group by state_code
) as p
on p.state_code = c.state_code 
and p.max_pop = c.population;

You can find the city in each state with the max population and use it in a sub-query and join it with the tables.

Query

select s.name as state, c.name as city, c.population
from states s
join cities c
on c.state_code = s.code
join (
  select state_code, max(population) as max_pop
  from cities 
  group by state_code
) as p
on p.state_code = c.state_code 
and p.max_pop = c.population;

SQL Max是非确定性的吗?

骄傲 2025-02-13 08:21:44

您没有按照自己的意图使用出口。

您想要的是命名导出而不是默认一个。

import axios from "axios";

export const backendApi =  axios.create({
  baseURL: process.env.VUE_APP_API_BASE_URL + "api/",
});

export const anotherApi =  axios.create({
  baseURL: "https://example.com",
});
import { backendApi } from "@/http"

export const userRegister = (context, user) => {
  backendApi
    .post("users/register", user)
    .then((resp) => {
      //
    })
    .catch((err) => {
      //
    })
}

You are not using exports the way you intend to.

What you want is named exports instead of a default one.

import axios from "axios";

export const backendApi =  axios.create({
  baseURL: process.env.VUE_APP_API_BASE_URL + "api/",
});

export const anotherApi =  axios.create({
  baseURL: "https://example.com",
});
import { backendApi } from "@/http"

export const userRegister = (context, user) => {
  backendApi
    .post("users/register", user)
    .then((resp) => {
      //
    })
    .catch((err) => {
      //
    })
}

将Axios配置为可重复使用的模块

骄傲 2025-02-12 03:37:16

您可以编写两个不同的链接脚本,并在建筑物环境中应用一个或另一个脚本(带有-t链接器标志),也可以为您的来源使用变量,并使用-wl,-wl,-defsym =&lt; var_name&gt; = &lt; var_value&gt;

You can write two different linker script and apply one or the other in your building enviroment (with the -T linker flag) or you can use a variable for your ORIGIN and pass it with -Wl,--defsym=<VAR_NAME>=<VAR_VALUE>

链接脚本并更改闪存地址

骄傲 2025-02-11 20:54:40

问题是您试图以两种不同的方式实现您的性状。因此,您将 t 视为同一问题的问题。然后,您可以将案例分开以换成混凝土类型。喜欢以下:

#[derive(Debug)]
struct MyObj(i32);

#[derive(Debug)]
struct RefVec<'a>(Vec<&'a MyObj>);

trait ConvertToRefVec<'a> {
    fn convert(&mut self) -> RefVec<'a>;
}

impl<'a> ConvertToRefVec<'a> for std::slice::Iter<'a, MyObj> 
{
    fn convert(&mut self) -> RefVec<'a> {
        RefVec(self.collect::<Vec<_>>())
    }
}

impl<'a> ConvertToRefVec<'a> for std::slice::IterMut<'a, MyObj>
{
    fn convert(&mut self) -> RefVec<'a> {
        RefVec(self.map(|el| &*el).collect::<Vec<&MyObj>>())
    }
}

fn main() {
    let mut owned = [MyObj(42), MyObj(69)];

    let ref_vec = owned.iter().convert();
    println!("{:?}", ref_vec);

    let ref_vec = owned.iter_mut().convert();
    println!("{:?}", ref_vec);
}

The thing is that you are trying to implement your trait in two different ways for the same type. So the problem that you treat T as the same one. Then you can just split the cases for concrete types. Like to following:

#[derive(Debug)]
struct MyObj(i32);

#[derive(Debug)]
struct RefVec<'a>(Vec<&'a MyObj>);

trait ConvertToRefVec<'a> {
    fn convert(&mut self) -> RefVec<'a>;
}

impl<'a> ConvertToRefVec<'a> for std::slice::Iter<'a, MyObj> 
{
    fn convert(&mut self) -> RefVec<'a> {
        RefVec(self.collect::<Vec<_>>())
    }
}

impl<'a> ConvertToRefVec<'a> for std::slice::IterMut<'a, MyObj>
{
    fn convert(&mut self) -> RefVec<'a> {
        RefVec(self.map(|el| &*el).collect::<Vec<&MyObj>>())
    }
}

fn main() {
    let mut owned = [MyObj(42), MyObj(69)];

    let ref_vec = owned.iter().convert();
    println!("{:?}", ref_vec);

    let ref_vec = owned.iter_mut().convert();
    println!("{:?}", ref_vec);
}

为iTer&lt;&amp;&gt;实施特征和iter&lt;&amp; mut&gt;

骄傲 2025-02-11 15:59:25

如果您使用

更多信息 https://stape.io/blog/blog/avoiding-ingog/avoiding-ingog- Google-Tag-Manager-Blocking-by-Adblockers

您还可以为Web GTM创建自定义加载程序客户端。但是,相关脚本会有问题。那时仍然会阻止ua/ga4,但GTM本身并没有被阻止。

You can easily do this if you use sGTM hosting from https://stape.io
There is a feature called Custom Loader. With it, you can download Web GTM from different paths and all other related scripts will be also downloaded from different URLs, for example, gtag.js for GA4.

More info https://stape.io/blog/avoiding-google-tag-manager-blocking-by-adblockers

You can also create your custom loader client for Web GTM. However, there will be problems with related scripts. UA/GA4 still will be blocked then, but GTM itself not.

服务器端GTM上的Adblockers问题

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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