错爱

文章 评论 浏览 30

错爱 2025-02-21 01:02:58

您的代码不可复制,但这应该做:

filters<-readxl("settings1.xlsx") {settings1 is defined as follows:manufacturer=audi,model="",displ=1.8,year=1999)
data<-mpg  
                                          
ggplot(filtrated data, aes(x = displ, y = cty)) + 
  geom_point(size = 7, colour = "#EF783D", shape = 17) +
  geom_line(color = "#EF783D") +
        ggtitle(paste("Insights : ", na.omit(filters$manufacturer), na.omit(filters$model), na.omit(filters$displ), na.omit(filters$year), sep = ", ")))

Your code is non-reproducible, but this should do:

filters<-readxl("settings1.xlsx") {settings1 is defined as follows:manufacturer=audi,model="",displ=1.8,year=1999)
data<-mpg  
                                          
ggplot(filtrated data, aes(x = displ, y = cty)) + 
  geom_point(size = 7, colour = "#EF783D", shape = 17) +
  geom_line(color = "#EF783D") +
        ggtitle(paste("Insights : ", na.omit(filters$manufacturer), na.omit(filters$model), na.omit(filters$displ), na.omit(filters$year), sep = ", ")))

仅输出r中标题中某些数据列的非空内容?

错爱 2025-02-21 00:06:51

按照官方Microsoft文档

复制活动中的副本并行性程度是指复制活动用来将数据偏见复制到源以增加吞吐量的最大线程数量。

它不会在水槽中生成多个文件。

它只会通过使用我们指定的线程数并同时复制活动来增加活动的吞吐量。

复制活动仅将我们的源表或数据复制到单个文件,尽管 副本平行性的程度增加或降低,因为这两个动作与它们之间没有关系。吞吐量。

如果要从单个Cosmos DB容器中复制多个文件,则可以使用Cosmos DB DataSet的某些输入尝试使用 foreach活动,其中包含复制活动,它复制了输入将每个迭代的foreach的单个文件数据数据。您可以通过将值的价值设置为在此设置 的副本数量。

请通过此 link 来自 azurelib deepak goyal 使用foreach foreach的复制活动进行更多有关并行执行。

As per the Official Microsoft Documentation,

The degree of copy parallelism in the copy activity means the maximum number of threads that copy activity uses to copy the data parallelly from the source to sink to increase the throughput.

It won’t generate multiple files in the sink.

It will only increase the throughput of the activity by copying concurrently using the number of threads we specify.

The copy activity only copies our source table or data to only single file despite the increase or decrease of degree of copy parallelism because these two actions have no relationship between them apart from the throughput.

If you want to copy multiple files from single cosmos db container, you can try a ForEach activity with certain inputs from cosmos db dataset with a copy activity inside it which copies the input data to a single file on each iteration of forEach. You can set the number of copies in this by giving value to Batch count of forEach.

ref1

Please go through this link from azurelib by Deepak Goyal to learn more about Parallel execution of copy activity using ForEach.

增加Azure数据工厂中的平行副本

错爱 2025-02-20 23:17:49

您需要在使用挂钩中设置它,并且具有空依赖性,仅在组件安装时才会运行。

const [langu,setLangua] = useState(language)
useEffect(() => {
let language = ""
if (typeof window !== 'undefined') {
    if ( localStorage.getItem("language")  === null) {
        language = "english"
    }

    if ( localStorage.getItem("language")  !== null) {
        language = localStorage.getItem("language")
    }
}
setLanguage(language)
}, [])

you need set it in useEffect hook, with empty dependences, it will run only when the component mount.

const [langu,setLangua] = useState(language)
useEffect(() => {
let language = ""
if (typeof window !== 'undefined') {
    if ( localStorage.getItem("language")  === null) {
        language = "english"
    }

    if ( localStorage.getItem("language")  !== null) {
        language = localStorage.getItem("language")
    }
}
setLanguage(language)
}, [])

当localstorage值更改时,如何更改状态?

错爱 2025-02-20 21:59:48

尝试将电子版本更新为最后一个版本,例如 23.1.1
它似乎可以在我的环境中解决问题。

Try to update the electron version to the last one like 23.1.1.
It seems to fix the problem in my environment.

无法打开“开发人员工具”在电子应用中

错爱 2025-02-20 19:06:56

更新:改进并简化了一种可能的解决方案,可以通过辅助扩展程序读取任何坐标空间中任何视图的rect。自Xcode 11.1以来的工作,用Xcode 13.3重新测试。

主要部分:

func rectReader(_ binding: Binding<CGRect>, _ space: CoordinateSpace = .global) -> some View {
    GeometryReader { (geometry) -> Color in
        let rect = geometry.frame(in: space)
        DispatchQueue.main.async {
            binding.wrappedValue = rect
        }
        return .clear
    }
}

用法相同

Text("Test").background(rectReader($rect))

或使用新扩展

Text("Test").reading(rect: $rect)

完成

Update: improved and simplified a possible solution to read rect of any view in any coordinate space via helper extension. Works since Xcode 11.1, retested with Xcode 13.3.

Main part:

func rectReader(_ binding: Binding<CGRect>, _ space: CoordinateSpace = .global) -> some View {
    GeometryReader { (geometry) -> Color in
        let rect = geometry.frame(in: space)
        DispatchQueue.main.async {
            binding.wrappedValue = rect
        }
        return .clear
    }
}

Usage the same

Text("Test").background(rectReader($rect))

or with new extension

Text("Test").reading(rect: $rect)

Complete findings and code is here

获得视图

错爱 2025-02-20 18:07:13
<?php
$jsonData = '{
    "type": "donut",
    "name": "Cake",
    "toppings": [
        { "id": "5002", "type": "Glazed" },
        { "id": "5006", "type": "Chocolate with Sprinkles" },
        { "id": "5004", "type": "Maple" }
    ]
}';

// Decode the JSON
$data = json_decode($jsonData, true);

// Access the data
$type = $data['type'];
$name = $data['name'];
$toppings = $data['toppings'];

// Access individual topping details
$firstTopping = $toppings[0];
$firstToppingId = $firstTopping['id'];
$firstToppingType = $firstTopping['type'];

// Print the data
echo "Type: $type\n";
echo "Name: $name\n";
echo "First Topping ID: $firstToppingId\n";
echo "First Topping Type: $firstToppingType\n";
?>

在此示例中,JSON_DECODE()用于将JSON数据解码为PHP关联数组。然后,您可以像任何PHP数组一样访问数组的各个元素。

<?php
$jsonData = '{
    "type": "donut",
    "name": "Cake",
    "toppings": [
        { "id": "5002", "type": "Glazed" },
        { "id": "5006", "type": "Chocolate with Sprinkles" },
        { "id": "5004", "type": "Maple" }
    ]
}';

// Decode the JSON
$data = json_decode($jsonData, true);

// Access the data
$type = $data['type'];
$name = $data['name'];
$toppings = $data['toppings'];

// Access individual topping details
$firstTopping = $toppings[0];
$firstToppingId = $firstTopping['id'];
$firstToppingType = $firstTopping['type'];

// Print the data
echo "Type: $type\n";
echo "Name: $name\n";
echo "First Topping ID: $firstToppingId\n";
echo "First Topping Type: $firstToppingType\n";
?>

In this example, json_decode() is used to decode the JSON data into a PHP associative array. You can then access the individual elements of the array as you would with any PHP array.

如何通过PHP从JSON中提取和访问数据?

错爱 2025-02-19 15:38:57
    @override
  Widget build(BuildContext context) {
    // TODO: implement build
    logger.i('Build Function Executed');
    return Scaffold(
        appBar: AppBar(
          title: Text('My Location'),
        ),
        body: SafeArea(
         child: Expanded(
          child: HereMap(
            onMapCreated: _onMapCreated,
          ),
        )));
  }

添加 safearea 小部件

    @override
  Widget build(BuildContext context) {
    // TODO: implement build
    logger.i('Build Function Executed');
    return Scaffold(
        appBar: AppBar(
          title: Text('My Location'),
        ),
        body: SafeArea(
         child: Expanded(
          child: HereMap(
            onMapCreated: _onMapCreated,
          ),
        )));
  }

add SafeArea widget

这里的地图视图在扑来的App bar顶部覆盖了覆盖层

错爱 2025-02-19 15:04:23

实际上,它与弹性网站上发布的另一种配置一起工作:

filebeat.autodiscover:
  providers:
    - type: kubernetes
      hints.enabled: true
      hints.default_config:
        type: container
        paths:
          - /var/log/containers/*-${data.container.id}.log  # CRI path

https://www.elastic.co/guide/guide/en/beats/filebeat/filebeat/current/configuration-configuration-autodiscover-hints.html

我仍然不确定为什么突然发生这种节点上的Kubernetes的容器运行时更​​改,但我无法访问该检查

Actually it worked with another configuration posted on elastic.co website:

filebeat.autodiscover:
  providers:
    - type: kubernetes
      hints.enabled: true
      hints.default_config:
        type: container
        paths:
          - /var/log/containers/*-${data.container.id}.log  # CRI path

https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover-hints.html

I'm still not sure why this happend suddenly but it the reason might be a container runtime change for kubernetes on the node but I don't have access to check that

FileBeat不用自动发现收集日志

错爱 2025-02-19 14:18:43

您不需要循环计数器,甚至如果使用 select-object 将对象返回使用类似的属性的对象,则不需要循环计数器:

# It's up to you, but personally I would use $today = (Get-Date).Date to set this reference date to midnight
$today  = Get-Date  
$Expiry = Get-ChildItem -Path cert: -Recurse
$Rep = $Expiry | Where-Object { $_.NotAfter -le $today.AddDays(120) -and $_.NotAfter -gt $today |
    Select-Object @{Name = 'Path'; Expression = {$_.PSParentPath}},
                  Issuer, NotAfter,
                  @{Name = 'DaysLeft'; Expression = {($_.NotAfter - $today).Days}}
}

# to know howmany items you now have, use
@($Rep).Count

注意:注意:

  • 我正在使用
  • > select-object 行以 $ rep 在最后一行中 数组,因此您可以使用它 .count 安全属性

You don't need a loop counter for this, or even a loop if you use Select-Object to return objects with the chosen properties like this:

# It's up to you, but personally I would use $today = (Get-Date).Date to set this reference date to midnight
$today  = Get-Date  
$Expiry = Get-ChildItem -Path cert: -Recurse
$Rep = $Expiry | Where-Object { $_.NotAfter -le $today.AddDays(120) -and $_.NotAfter -gt $today |
    Select-Object @{Name = 'Path'; Expression = {$_.PSParentPath}},
                  Issuer, NotAfter,
                  @{Name = 'DaysLeft'; Expression = {($_.NotAfter - $today).Days}}
}

# to know howmany items you now have, use
@($Rep).Count

Note:

  • I'm using calculated properties in the Select-Object line to get the properties you need
  • By surrounding $Rep in the last line with @(), you are forcing the variable to be an array, so you can use its .Count property safely

循环中的powershell中的值

错爱 2025-02-19 13:17:48

您可以只使用 cte

with x as (
  select Quarter, max(Revenue) as Revenue 
  from table
  group by Quarter
)
select t.Company_name, x.Quarter, x.Revenue
from x
join table t
on x.Revenue = t.Revenue
and t.Quarter = x.Quarter;

请参阅

首先,您选择 max Revenue 季度组,然后我 join in返回的表 max(收入)但AS @lemon 在评论中指出,这还不够,因为什么会 happen when there's two revenues on same company but different quarters it will return more rows as shown in this

因此,这就是为什么我需要在季度添加加入,以便每季度只能返回一个结果。


但是,如果您使用的是 mysql 不支持 cte 的版本,则可以使用以下子查询:

select t.Company_name, x.Quarter, x.Revenue
from
(
    select Quarter, max(Revenue) as Revenue
    from test
    group by Quarter
) x
join test t
on x.Quarter = t.Quarter
and x.Revenue = t.Revenue;

You can just use a cte:

with x as (
  select Quarter, max(Revenue) as Revenue 
  from table
  group by Quarter
)
select t.Company_name, x.Quarter, x.Revenue
from x
join table t
on x.Revenue = t.Revenue
and t.Quarter = x.Quarter;

see db<>fiddle.

First you select the max Revenue group by Quarter, then I'm joining to the table on the returned max(Revenue) but as @lemon pointed out in comments that's not enough because what would happen when there's two revenues on same company but different quarters it will return more rows as shown in this db<>fiddle.

So that's why I need to add the join on quarter so it will only return one result per quarter.


But if you're using a version of MySql that doesn't support cte you can use a subquery like:

select t.Company_name, x.Quarter, x.Revenue
from
(
    select Quarter, max(Revenue) as Revenue
    from test
    group by Quarter
) x
join test t
on x.Quarter = t.Quarter
and x.Revenue = t.Revenue;

检索每个季度的顶级公司和相应的收入

错爱 2025-02-19 08:58:14

问题在于,通过使用等待内部 promise.all(),您正在解决提取,而不是让它们并行发生并返回由 Promise包裹的。

您可以参考:

const fetchFruit = async () => {
  const fruitResponse = await fetch(fruitPath);
  const fruitJson: Fruit = await fruitResponse.json();

  const fruitDetails = await Promise.all(
    fruitJson.results.map(async (f: FruitURLs) => fetch(f.url))
  );

  const getFruitDescriptions = await Promise.all(
    fruitDetails.map(async (item: FruitDetails, index: number) =>
      fetch(item.type.url)
    )
  );

  const [fruitDetailsAsJson, getFruitDescriptionsAsJson] = Promise.all([
    fruitDetails.map(async (f) => f.json()),
    getFruitDescriptions.map(async (f) => f.json()),
  ]);

  const full = fruitDetailsAsJson.map((fruit, index) => ({
    ...fruit,
    fruitInfo: getFruitDescriptionsAsJson[index],
  }));

  setFruitDetails(full);
  setLoading(false);
};

使用实践。

The problem is that by using await inside Promise.all(), you are resolving the fetches instead of having them happen in parallel and returning it wrapped by a promise.

You can take a reference:

const fetchFruit = async () => {
  const fruitResponse = await fetch(fruitPath);
  const fruitJson: Fruit = await fruitResponse.json();

  const fruitDetails = await Promise.all(
    fruitJson.results.map(async (f: FruitURLs) => fetch(f.url))
  );

  const getFruitDescriptions = await Promise.all(
    fruitDetails.map(async (item: FruitDetails, index: number) =>
      fetch(item.type.url)
    )
  );

  const [fruitDetailsAsJson, getFruitDescriptionsAsJson] = Promise.all([
    fruitDetails.map(async (f) => f.json()),
    getFruitDescriptions.map(async (f) => f.json()),
  ]);

  const full = fruitDetailsAsJson.map((fruit, index) => ({
    ...fruit,
    fruitInfo: getFruitDescriptionsAsJson[index],
  }));

  setFruitDetails(full);
  setLoading(false);
};

Use this resource to learn about the best practice.

从大量获取的URL中获取数据

错爱 2025-02-19 08:38:47

您只需要此文件的支票权限/var/run/docker.sock
应该是666
chmod 666/var/run/docker.sock

You just need the check permissions for this file /var/run/docker.sock
it should be 666
chmod 666 /var/run/docker.sock

如何修复Docker:获得许可的问题

错爱 2025-02-18 22:52:07

因为我几次访问了此页面,所以我决定发布一个示例(松散)比较测试。

结果:

""         -> false
"0"        -> false
"0.0"      -> true
"1"        -> true
"01"       -> true
"abc"      -> true
"true"     -> true
"false"    -> true
"null"     -> true
0          -> false
0.1        -> true
1          -> true
1.1        -> true
-42        -> true
"NAN"      -> true
0          -> false
NAN        -> true
null       -> false
true       -> true
false      -> false
[]         -> false
[""]       -> true
["0"]      -> true
[0]        -> true
[null]     -> true
["a"]      -> true
{}         -> true
{}         -> true
{"t":"s"}  -> true
{"c":null} -> true

测试代码:

class Vegetable {}

class Fruit {
    public $t = "s";
}

class Water {
    public $c = null;
}

$cases = [
    "",
    "0",
    "0.0",
    "1",
    "01",
    "abc",
    "true",
    "false",
    "null",
    0,
    0.1,
    1,
    1.1,
    -42,
    "NAN",
    (float) "NAN",
    NAN,
    null,
    true,
    false,
    [],
    [""],
    ["0"],
    [0],
    [null],
    ["a"],
    new stdClass(),
    new Vegetable(),
    new Fruit(),
    new Water(),
];

echo "<pre>" . PHP_EOL;

foreach ($cases as $case) {
    printf("%s -> %s" . PHP_EOL, str_pad(json_encode($case), 10, " ", STR_PAD_RIGHT), json_encode( $case == true ));
}

摘要:

  • 完成严格( === )比较时,除 true 返回 false 外,所有其他内容。
  • 一个空字符串(“” )是虚假的
  • 一个字符串,仅包含 0 “ 0” )是虚假的
  • nan
  • 真实
    • 0 in “” (请参阅第三个项目)

Because I've visited this page several times, I've decided to post an example (loose) comparison test.

Results:

""         -> false
"0"        -> false
"0.0"      -> true
"1"        -> true
"01"       -> true
"abc"      -> true
"true"     -> true
"false"    -> true
"null"     -> true
0          -> false
0.1        -> true
1          -> true
1.1        -> true
-42        -> true
"NAN"      -> true
0          -> false
NAN        -> true
null       -> false
true       -> true
false      -> false
[]         -> false
[""]       -> true
["0"]      -> true
[0]        -> true
[null]     -> true
["a"]      -> true
{}         -> true
{}         -> true
{"t":"s"}  -> true
{"c":null} -> true

Test code:

class Vegetable {}

class Fruit {
    public $t = "s";
}

class Water {
    public $c = null;
}

$cases = [
    "",
    "0",
    "0.0",
    "1",
    "01",
    "abc",
    "true",
    "false",
    "null",
    0,
    0.1,
    1,
    1.1,
    -42,
    "NAN",
    (float) "NAN",
    NAN,
    null,
    true,
    false,
    [],
    [""],
    ["0"],
    [0],
    [null],
    ["a"],
    new stdClass(),
    new Vegetable(),
    new Fruit(),
    new Water(),
];

echo "<pre>" . PHP_EOL;

foreach ($cases as $case) {
    printf("%s -> %s" . PHP_EOL, str_pad(json_encode($case), 10, " ", STR_PAD_RIGHT), json_encode( $case == true ));
}

Summary:

  • When a strict (===) comparison is done, everything except true returns false.
  • an empty string ("") is falsy
  • a string that contains only 0 ("0") is falsy
  • NAN is truthy
  • an empty array ([]) is falsy
  • a container (array, object, string) that contains a falsy value is truthy
    • an exception to this is 0 in "" (see the third item)

PHP中的真实/错误工作如何?

错爱 2025-02-18 22:19:54

=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B3); 1; FALSE);1)
=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B4); 1; FALSE);1)

index(数组,[行])

索引在数组中获取n个值,当您传递值1时,它将获得最高的值。

我通过使用 filter 函数创建了一个排序的数组。和 sort 函数。我将其降序排序,仅返回 filter 函数中的日期。

enter image description here

=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B3); 1; FALSE);1)
=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B4); 1; FALSE);1)

INDEX(array, [row])

Index gets the nth value in an array, when you pass in the value 1, it will get the top most value.

I created a sorted array by using the FILTER function. and the SORT function. I sorted it descending and only returned the dates in the FILTER function.

获得最新日期

错爱 2025-02-18 19:44:02

上面使用 plt.subplots_mosaic 的答案是一个很好的答案使用 gridspec_kw

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)
# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)

# Start figure
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(5.5, 5.5), sharex='col', sharey='row', gridspec_kw={'height_ratios': [1, 3], 'width_ratios': [3, 1], 'hspace': 0.05, 'wspace': 0.05})

# Define/name each axes
axScatter = axs[1, 0]  # bottom left
axHistx = axs[0, 0]  # top left
axHisty = axs[1, 1]  # bottom right
new_axis = axs[0, 1]  # new axis - top right

# the scatter plot:
axScatter.scatter(x, y)
axScatter.set_aspect(1.)

# make some labels invisible
axHistx.xaxis.set_tick_params(labelbottom=False)
axHisty.yaxis.set_tick_params(labelleft=False)

# now determine nice limits by hand:
binwidth = 0.25
xymax = max(np.max(np.abs(x)), np.max(np.abs(y)))
lim = (int(xymax/binwidth) + 1)*binwidth

bins = np.arange(-lim, lim + binwidth, binwidth)
axHistx.hist(x, bins=bins)
axHisty.hist(y, bins=bins, orientation='horizontal')

# Hist axes
axHistx.set_yticks([0, 50, 100])
axHisty.set_xticks([0, 50, 100])

plt.draw()
plt.show()

带有新轴 a>。

您可以在Matplotlib的轴教程中找到有关操纵轴的更多信息()。

The answer above using plt.subplots_mosaic is a good answer but I believe suplots_mosaic is currently an experimental/provisional API so I wanted to offer a solution using plt.subplots() and manipulating the axes using gridspec_kw:

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)
# the random data
x = np.random.randn(1000)
y = np.random.randn(1000)

# Start figure
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(5.5, 5.5), sharex='col', sharey='row', gridspec_kw={'height_ratios': [1, 3], 'width_ratios': [3, 1], 'hspace': 0.05, 'wspace': 0.05})

# Define/name each axes
axScatter = axs[1, 0]  # bottom left
axHistx = axs[0, 0]  # top left
axHisty = axs[1, 1]  # bottom right
new_axis = axs[0, 1]  # new axis - top right

# the scatter plot:
axScatter.scatter(x, y)
axScatter.set_aspect(1.)

# make some labels invisible
axHistx.xaxis.set_tick_params(labelbottom=False)
axHisty.yaxis.set_tick_params(labelleft=False)

# now determine nice limits by hand:
binwidth = 0.25
xymax = max(np.max(np.abs(x)), np.max(np.abs(y)))
lim = (int(xymax/binwidth) + 1)*binwidth

bins = np.arange(-lim, lim + binwidth, binwidth)
axHistx.hist(x, bins=bins)
axHisty.hist(y, bins=bins, orientation='horizontal')

# Hist axes
axHistx.set_yticks([0, 50, 100])
axHisty.set_xticks([0, 50, 100])

plt.draw()
plt.show()

Here is the result: Figure with new axes.

You can find more info about manipulating axes in Matplotlib's Axes Tutorial (https://matplotlib.org/stable/tutorials/intermediate/arranging_axes.html).

如何将轴添加到Matplotlib图中?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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