烟沫凡尘

文章 评论 浏览 30

烟沫凡尘 2025-02-20 18:09:34

我会像这样加入它:

fetch('https://hook.us1.make.com/28c815lw998s1o6ab37e3il7uw957p7g?record_id=' + {{AirtableRecordID}});

另外,您始终可以打开网络选项卡并调试此获取。

I would concatenate it like so:

fetch('https://hook.us1.make.com/28c815lw998s1o6ab37e3il7uw957p7g?record_id=' + {{AirtableRecordID}});

Also, you can always open your network tab and debug this fetch.

这项工作是否应该在Google标签管理器中触发网络钩?

烟沫凡尘 2025-02-20 06:59:12

另一个可能的解决方案,尽管我认为已经

library(lubridate)
library(dplyr)
library(tibble)


rainfall_data <- tibble::tribble(
      ~ date, ~rainfall,
       "1981-01-01",   0,
       "1981-01-02",   0,
       "1981-01-03",   0,
       "1981-01-04",   1,
       "1981-01-05",   0,
       "1981-01-06",   1,
       "1981-01-07",   1,
       "1981-01-08",   1,
       "1981-01-09",   0,
       "1981-01-10",   0,
       "1981-01-11",   1,
       "1981-01-12",   1,
       "1981-01-13",   1,
       "1981-01-14",   1,
       "1981-01-15",   1,
       "1981-01-16",   0
)


rainfall_data %>%
    mutate(
        csum = ave(rainfall, cumsum(rainfall == 0), FUN = cumsum),
        event = ave(csum, cumsum(rainfall == 0), FUN = max)
    ) %>%
    filter(event >= 3) %>%
    distinct(event, .keep_all = TRUE) %>%
    group_by(year = year(ymd(date))) %>%
    summarise(
        No_of_consecutive_wet_days = n(),
        longest_consecutive_wet_days = max(event)
    )
#> # A tibble: 1 × 3
#>    year No_of_consecutive_wet_days longest_consecutive_wet_days
#>   <dbl>                      <int>                        <dbl>
#> 1  1981                          2                            5

由Reprex软件包(v2.0.1)在2022-07-06上创建了更好的解决方案。

Another possible solution, Though I think already better solutions have been suggested

library(lubridate)
library(dplyr)
library(tibble)


rainfall_data <- tibble::tribble(
      ~ date, ~rainfall,
       "1981-01-01",   0,
       "1981-01-02",   0,
       "1981-01-03",   0,
       "1981-01-04",   1,
       "1981-01-05",   0,
       "1981-01-06",   1,
       "1981-01-07",   1,
       "1981-01-08",   1,
       "1981-01-09",   0,
       "1981-01-10",   0,
       "1981-01-11",   1,
       "1981-01-12",   1,
       "1981-01-13",   1,
       "1981-01-14",   1,
       "1981-01-15",   1,
       "1981-01-16",   0
)


rainfall_data %>%
    mutate(
        csum = ave(rainfall, cumsum(rainfall == 0), FUN = cumsum),
        event = ave(csum, cumsum(rainfall == 0), FUN = max)
    ) %>%
    filter(event >= 3) %>%
    distinct(event, .keep_all = TRUE) %>%
    group_by(year = year(ymd(date))) %>%
    summarise(
        No_of_consecutive_wet_days = n(),
        longest_consecutive_wet_days = max(event)
    )
#> # A tibble: 1 × 3
#>    year No_of_consecutive_wet_days longest_consecutive_wet_days
#>   <dbl>                      <int>                        <dbl>
#> 1  1981                          2                            5

Created on 2022-07-06 by the reprex package (v2.0.1)

在R中连续一年中的每日时间序列数据在R中的存在

烟沫凡尘 2025-02-20 05:05:29

经过一些尝试,我弄清楚了这个问题。
外部.js文件(在这种情况下为 generate.js ),不使用nodejs操作。
要解决此问题,我必须在我的 index.js 上添加两行代码。

const createWin = () => {
    win = new BrowserWindow({

//these lines fixed the issue
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false
        }
    })

    win.loadFile('index.html')
}

After some tries I figured out the problem.
The external .js file (in this case generate.js), doesn't operate using NodeJS.
To fix this I had to add two lines of code on my index.js like so.

const createWin = () => {
    win = new BrowserWindow({

//these lines fixed the issue
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false
        }
    })

    win.loadFile('index.html')
}

使用ipcrenderer时,功能无效

烟沫凡尘 2025-02-20 02:37:20

一个仅在那里找到所需的字符串时仅编辑crontab的变体:

CMD="/sbin/modprobe fcpci"
JOB="@reboot $CMD"
TMPC="mycron"
grep "$CMD" -q <(crontab -l) || (crontab -l>"$TMPC"; echo "$JOB">>"$TMPC"; crontab "$TMPC")

A variant which only edits crontab if the desired string is not found there:

CMD="/sbin/modprobe fcpci"
JOB="@reboot $CMD"
TMPC="mycron"
grep "$CMD" -q <(crontab -l) || (crontab -l>"$TMPC"; echo "$JOB">>"$TMPC"; crontab "$TMPC")

如何在没有交互式编辑器的情况下使用BASH创建CRON作业?

烟沫凡尘 2025-02-19 23:40:51

提取&lt; attibute&gt; elemenet的另一个选项:

xmllint --xpath "//*[name()='attribute']/text()" x.xml

输出:

EXTRACT_THIS_PLEASE

Another option to extract the contents of the <attribute> elemenet:

xmllint --xpath "//*[name()='attribute']/text()" x.xml

Output:

EXTRACT_THIS_PLEASE

用XMLLINT -XPATH提取XML

烟沫凡尘 2025-02-19 20:09:07

您可以尝试这个。 IMO更有意义地将负值绘制在Xaxis上。

library(tidyverse)

# some data in the long format (recommended format for ggplot)
data <- mtcars %>% 
  mutate(negdisp=-disp) %>% 
  select(contains("disp")) %>% 
  pivot_longer(everything()) 

data
# A tibble: 64 x 2
   name    value
   <chr>   <dbl>
 1 disp      160
 2 negdisp  -160
 3 disp      160
 4 negdisp  -160

  data %>% 
  ggplot(aes(value, fill = name)) + 
   geom_histogram() 

类的东西来完成使用Yaxis的解决方案

data %>% 
  ggplot(aes(x = abs(value), fill = name)) + 
  stat_bin(aes(y=ifelse(fill == "negdisp", -..count.., ..count..))) 

可以使用

You can try this one. IMO it makes more sense that the negative values are plotted on the xaxis.

library(tidyverse)

# some data in the long format (recommended format for ggplot)
data <- mtcars %>% 
  mutate(negdisp=-disp) %>% 
  select(contains("disp")) %>% 
  pivot_longer(everything()) 

data
# A tibble: 64 x 2
   name    value
   <chr>   <dbl>
 1 disp      160
 2 negdisp  -160
 3 disp      160
 4 negdisp  -160

  data %>% 
  ggplot(aes(value, fill = name)) + 
   geom_histogram() 

enter image description here

The solution with the yaxis can be done using something like

data %>% 
  ggplot(aes(x = abs(value), fill = name)) + 
  stat_bin(aes(y=ifelse(fill == "negdisp", -..count.., ..count..))) 

enter image description here

用GGPLOT绘制负面直方图

烟沫凡尘 2025-02-19 06:53:04

不是最好的解决方案,但这应该完成工作

import module1
import logging

logging.basicConfig(
    filename="main.log",
    format="%(asctime)s , <%(name)s> , %(levelname)s : %(message)s",
    datefmt="%Y-%m-%d %I:%M:%S",
    level=logging.DEBUG
)


def setBasicConfigFormat(format):
    ROOT_LOGGER = logging.getLogger()
    ROOT_LOGGER.handlers[0].setFormatter(logging.Formatter(
        format
    ))


def main(ip):
    lg = logging.getLogger("main")

    newformat = "%(asctime)s , <%(name)s> ,  [" + \
        ip + "] , %(levelname)s : %(message)s"
    setBasicConfigFormat(newformat)

    # do another things
    lg.debug("somthing done...")

    # call func1
    module1.func1()

    lg.debug("service done")


def main2(ip):
    lg = logging.getLogger("main")

    newformat = "%(asctime)s , <%(name)s> ,  [" + \
        ip + "] , %(levelname)s : %(message)s"
    setBasicConfigFormat(newformat)
    # do another things
    lg.debug("somthing done...")

    # call func1
    module1.func1()

    lg.debug("service done")


main("192.168.1.100")
main2("192.168.1.101")

Not the best solution but this should get the job done

import module1
import logging

logging.basicConfig(
    filename="main.log",
    format="%(asctime)s , <%(name)s> , %(levelname)s : %(message)s",
    datefmt="%Y-%m-%d %I:%M:%S",
    level=logging.DEBUG
)


def setBasicConfigFormat(format):
    ROOT_LOGGER = logging.getLogger()
    ROOT_LOGGER.handlers[0].setFormatter(logging.Formatter(
        format
    ))


def main(ip):
    lg = logging.getLogger("main")

    newformat = "%(asctime)s , <%(name)s> ,  [" + \
        ip + "] , %(levelname)s : %(message)s"
    setBasicConfigFormat(newformat)

    # do another things
    lg.debug("somthing done...")

    # call func1
    module1.func1()

    lg.debug("service done")


def main2(ip):
    lg = logging.getLogger("main")

    newformat = "%(asctime)s , <%(name)s> ,  [" + \
        ip + "] , %(levelname)s : %(message)s"
    setBasicConfigFormat(newformat)
    # do another things
    lg.debug("somthing done...")

    # call func1
    module1.func1()

    lg.debug("service done")


main("192.168.1.100")
main2("192.168.1.101")

同一文件中的临时记录格式

烟沫凡尘 2025-02-19 03:28:11

这可能是由于打字稿删除 codingeditor 仅用作类型的导入,因此定义自定义元素的副作用不会发生。

您可以将TS编译器选项设置 importSnotusedAsvalues preserve (请参阅

import '../../app/javascript/components/coding-editor';

nofollow noreferrer“> https://www.typescriptlang.org/tsconfig/#importsnotusedasvalues )或在此处 : https://github.com/microsoft/microsoft/typescript/wiki/wiki/faq#why -are-imports-being-eeldides-my-emit

作为一个侧词,在您链接到的开始示例中,导入类用于 assert.insert.instance.instanceof 作为一个价值,因此它不会被打字稿所吸引。

This is likely due to TypeScript removing the CodingEditor import that's only used as a type so the side effect of defining the custom element is not happening.

You can either set the TS compiler option importsNotUsedAsValues to preserve (See https://www.typescriptlang.org/tsconfig/#importsNotUsedAsValues) or add another import line for the side-effect like

import '../../app/javascript/components/coding-editor';

Additional explanation here too: https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-imports-being-elided-in-my-emit

As a side-note, in the starter example you linked to, the imported class is used in assert.instanceOf as a value so it does not get elided by TypeScript.

打开Web组件测试 / LIT-没有渲染的组件?

烟沫凡尘 2025-02-18 20:19:50

Microsoft文档它说,

Azure Active Directory(Azure AD)或SQL中的身份包含在掩蔽过程中,应访问未掩盖的敏感数据。

也许您将数据访问 SQL Admin Azure AD用户,因此您可以看到敏感数据。

通过在数据库的多层中隐藏不需要的用户的重要信息,您可以防止访问和获得控制。您可以向用户授予或删除UNMASK许可。

Microsoft-documentation 它说,

请允许用户


GRANT UNMASK ON Data.Membership TO USER;

用户下文中的数据


EXECUTE AS USER='USER';

在授予用户许可之后 数据下撤销


REVOKE UNMASK ON Data.Membership FROM USER;

数据

“在此处输入图像说明”

从用户

“在此处输入映像”

从:

使用Azure门户掩盖

授予和撤销许可

As mentioned in Microsoft Document it says,

The identities in Azure Active Directory (Azure AD) or SQL are included in the masking process and should have access to the unmasked sensitive data.

Maybe you are accessing data as SQL admin or Azure AD user because of that you can see sensitive data.

By hiding important information from unwanted users at multiple layers of the database, you may prevent access and gain control. You may give or remove UNMASK permission to a user.

The code taken from Microsoft-documentation it says,

Give UNMASK permission to user


GRANT UNMASK ON Data.Membership TO USER;

To Query the data under the context of user


EXECUTE AS USER='USER';

To revoke UNMASK permissions


REVOKE UNMASK ON Data.Membership FROM USER;

Data after granting permission to user

enter image description here

Data after removing permission from user

enter image description here

Taken Reference from:

SQL Database dynamic data masking with the Azure portal

Granting and Revoking the Permission

您如何动态掩盖通过Azure保存为JSON的数据?

烟沫凡尘 2025-02-18 16:24:24

尝试使用 > and ylim

plt.xlim([0, X.max()])
plt.ylim([0, Y.max()])

Try using matplotlib.pyplot.xlim and matplotlib.pyplot.ylim:

plt.xlim([0, X.max()])
plt.ylim([0, Y.max()])

如何将坐标线一路带到轴线?

烟沫凡尘 2025-02-18 10:50:37
import   {ArrowBackIcon} from './styles';

const App = () => {
...

  const isFirstImageAttachment = (index) => {
     const showEl = filteredImages.length &&
      filteredImages[0]?.uuid === attachments[index]?.uuid;
     return showEl ? 'hidden' : 'visible';
  };

...

  return (
    <div className="App">
     ...

      <ArrowBackIcon
        isfirstimageattachment={isFirstImageAttachment(idx)}
      />

      ...
    </div>
  );
};

)

styles.js

export const ArrowBackIcon = styled(BackArrowIcon)`
  visibility: ${props => props.isfirstimageattachment};
`;

我能够以这种方式动态添加样式!

import   {ArrowBackIcon} from './styles';

const App = () => {
...

  const isFirstImageAttachment = (index) => {
     const showEl = filteredImages.length &&
      filteredImages[0]?.uuid === attachments[index]?.uuid;
     return showEl ? 'hidden' : 'visible';
  };

...

  return (
    <div className="App">
     ...

      <ArrowBackIcon
        isfirstimageattachment={isFirstImageAttachment(idx)}
      />

      ...
    </div>
  );
};

)

styles.js

export const ArrowBackIcon = styled(BackArrowIcon)`
  visibility: ${props => props.isfirstimageattachment};
`;

I was able to add style dynamically this way!

如何使用样式的组件和ReactJ添加自定义CSS?警告:因非树立属性而被收到false

烟沫凡尘 2025-02-18 09:59:42

我不确定为什么您需要 new Object()或 object.assign ,但这使用了这两种:

const MyData =
[
{
_id: '62bab08c10365bb88f81cdf5',
index: 1,
tags: [
  'non laborum cillum commodo velit culpa commodo',
  'nisi aute magna laborum ut cillum velit',
  'in veniam ullamco officia aute deserunt ex',
  'dolor ullamco aliqua laborum ullamco officia mollit',
  'fugiat aliquip nostrud deserunt fugiat veniam veniam',
  'culpa eu irure ullamco ea deserunt ullamco',
  'labore quis quis enim magna duis cupidatat'
]
},
{
_id: 'abcdefghijklmnopqrstuvwx',
index: 2,
tags: [
  'The grand old duke of York',
  'he had ten thousand men',
  'he ran them up that hill',
  'and made a deal with god',
  'to swap our places',
]
}
];


let newObjects = MyData.map(data => 
{
  let newObject = new Object();
  Object.assign(newObject, 
    {
      personal_id : data._id,
      idx : data.index,
      voiceLines : data.tags
    });
   return newObject;
}
);

console.log(newObjects);

I'm not sure why you need new Object() or Object.assign, but this uses both of those:

const MyData =
[
{
_id: '62bab08c10365bb88f81cdf5',
index: 1,
tags: [
  'non laborum cillum commodo velit culpa commodo',
  'nisi aute magna laborum ut cillum velit',
  'in veniam ullamco officia aute deserunt ex',
  'dolor ullamco aliqua laborum ullamco officia mollit',
  'fugiat aliquip nostrud deserunt fugiat veniam veniam',
  'culpa eu irure ullamco ea deserunt ullamco',
  'labore quis quis enim magna duis cupidatat'
]
},
{
_id: 'abcdefghijklmnopqrstuvwx',
index: 2,
tags: [
  'The grand old duke of York',
  'he had ten thousand men',
  'he ran them up that hill',
  'and made a deal with god',
  'to swap our places',
]
}
];


let newObjects = MyData.map(data => 
{
  let newObject = new Object();
  Object.assign(newObject, 
    {
      personal_id : data._id,
      idx : data.index,
      voiceLines : data.tags
    });
   return newObject;
}
);

console.log(newObjects);

为什么在复制JSON数据文件之后,对象分配我的对象数组?

烟沫凡尘 2025-02-18 05:49:05

这是由于导入 netty-all 的依赖项之一。这导致Kqueue软件包被两次进口,并且具有不同的版本。

问题在于我没有完全读取堆栈跟踪:

KQueue.unavailabilityCause().printStackTrace();

在堆栈跟踪的末尾,它说:

Caused by: java.lang.IllegalStateException: Multiple resources found for 'META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib' with different content:
...

之后,我能够找到包裹来自哪里并修复它。然后,我能够在本地运行Java代码以运行域插座并在本地测试。

我使用Intellij在修复后运行它。 (即使修复后,VSCODE也有问题,因此想提及)

It was due to one of the dependencies importing netty-all. This was causing the Kqueue packages to be imported twice and with different versions.

The problem was that I did not fully read the stack trace from:

KQueue.unavailabilityCause().printStackTrace();

In the end of that stack trace, it said:

Caused by: java.lang.IllegalStateException: Multiple resources found for 'META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib' with different content:
...

After that, I was able to find where the package was coming from and fix it. Then I was able to locally run the Java Code to run domain socket and test it locally.

I used IntelliJ to run it after the fix. (VsCode had a problem even after the fix, hence wanted to mention it)

如何在OSX的Java中获得Kqueue?

烟沫凡尘 2025-02-17 23:53:25

实际上,动态渲染一切都是不良的做法,因此表现不佳。您将需要动态导入组件,该组件在第一个构建时间,例如页脚或聊天框。

Actually, dynamically render everything is an bad practice, hence more bad performance. You will want to dynamic import component that doesnt include in the first build time, for example, a footer or chatbox.

NextJS-改进“总阻塞时间”在Google PagesPeed上

烟沫凡尘 2025-02-17 20:00:15

根据API文档,您应在API URI中通过 LAT lng 指定地理坐标。在下面的示例中,我将它们设置为 lat = 36.7201600&amp; lng = -4.4203400

然后,使用 httpclient.getStringasync 方法,我将get请求发送到URI。它以字符串返回响应主体。

接下来,我将字符串对我的dto对象进行了序列化( sunrisesunsetdto )。然后获得日出和日落特性。

这是方法:

   public string GetSunrise()
    {
        HttpClient client = new HttpClient();
        var responce = client.GetStringAsync("https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400").Result;
        var Sunrise = JsonSerializer.Deserialize<SunriseSunsetDto>(responce.ToString()).Results.Sunrise;
        return Sunrise;
    }
    public string GetSunset()
    {
        HttpClient client = new HttpClient();
        var responce = client.GetStringAsync("https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400").Result;
        var Sunset = JsonSerializer.Deserialize<SunriseSunsetDto>(responce.ToString()).Results.Sunset;
        return Sunset;
    }

这是 sunrisesunsetdto class:

public class SunriseSunsetDto
{
    public Results Results { get; set; }
    public string Status { get; set; }
}
public class Results
{
    [JsonPropertyName("sunrise")]
    public string Sunrise { get; set; }
    [JsonPropertyName("sunset")]
    public string Sunset { get; set; }
    [JsonPropertyName("solar_noon")]
    public string SolarNoon { get; set; }
    [JsonPropertyName("day_length")]
    public string DayLength { get; set; }
    [JsonPropertyName("civil_twilight_begin")]
    public string CivilTwilightBegin { get; set; }
    [JsonPropertyName("civil_twilight_end")]
    public string CivilTwilightEnd { get; set; }
    [JsonPropertyName("nautical_twilight_begin")]
    public string NauticalTwilightBegin { get; set; }
    [JsonPropertyName("nautical_twilight_end")]
    public string NauticalTwilightEnd { get; set; }
    [JsonPropertyName("astronomical_twilight_begin")]
    public string AstronomicalTwilightBegin { get; set; }
    [JsonPropertyName("astronomical_twilight_end")]
    public string AstronomicalTwilightEnd { get; set; }
}

According to the API document, you should specify the geographic coordinate by lat and lng in the API Uri. In the following example, I set them lat=36.7201600&lng=-4.4203400.

Then, using HttpClient.GetStringAsync method, I send a GET request to the Uri. It returns the response body as a string.

Next, I deserialize the string to my DTO object (here SunriseSunsetDto). and then get sunrise and sunset properties.

Here is the methods:

   public string GetSunrise()
    {
        HttpClient client = new HttpClient();
        var responce = client.GetStringAsync("https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400").Result;
        var Sunrise = JsonSerializer.Deserialize<SunriseSunsetDto>(responce.ToString()).Results.Sunrise;
        return Sunrise;
    }
    public string GetSunset()
    {
        HttpClient client = new HttpClient();
        var responce = client.GetStringAsync("https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400").Result;
        var Sunset = JsonSerializer.Deserialize<SunriseSunsetDto>(responce.ToString()).Results.Sunset;
        return Sunset;
    }

And here is the SunriseSunsetDto class:

public class SunriseSunsetDto
{
    public Results Results { get; set; }
    public string Status { get; set; }
}
public class Results
{
    [JsonPropertyName("sunrise")]
    public string Sunrise { get; set; }
    [JsonPropertyName("sunset")]
    public string Sunset { get; set; }
    [JsonPropertyName("solar_noon")]
    public string SolarNoon { get; set; }
    [JsonPropertyName("day_length")]
    public string DayLength { get; set; }
    [JsonPropertyName("civil_twilight_begin")]
    public string CivilTwilightBegin { get; set; }
    [JsonPropertyName("civil_twilight_end")]
    public string CivilTwilightEnd { get; set; }
    [JsonPropertyName("nautical_twilight_begin")]
    public string NauticalTwilightBegin { get; set; }
    [JsonPropertyName("nautical_twilight_end")]
    public string NauticalTwilightEnd { get; set; }
    [JsonPropertyName("astronomical_twilight_begin")]
    public string AstronomicalTwilightBegin { get; set; }
    [JsonPropertyName("astronomical_twilight_end")]
    public string AstronomicalTwilightEnd { get; set; }
}

API在C#中获取请求

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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