爱人如己

文章 评论 浏览 29

爱人如己 2025-02-21 01:49:06

使用:

df2.loc[~df2['col1'].isin(df1['col1']), 'col1'].unique()

输出:数组(['xyz','pqr'],dtype = object)

or sets:oumpts:

set(df2['col1']) - set(df1['col1'])

output: {'pqr','xyz'} >

Use:

df2.loc[~df2['col1'].isin(df1['col1']), 'col1'].unique()

output: array(['XYZ', 'PQR'], dtype=object)

Or, with sets:

set(df2['col1']) - set(df1['col1'])

output: {'PQR', 'XYZ'}

通过比较两个dataframes pandas中的列来获取唯一值的有效方法

爱人如己 2025-02-20 21:11:07

要澄清,我有同样的问题:

在Vercel上托管Express.js文件,并使用< script type = module src = ...></script>

该文件的内容(位于./ assets中)已加载,但由Vercel更改。因此,代替:

import { _wcl } from './common-lib.js';
import { _wccss } from './common-css.js';

生成:它

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MscCircleProgress = void 0;
var _commonLib = require("./common-lib.js");
var _commonCss = require("./common-css.js");

在JavaScript模块中不起作用( https://developer.mozilla.org/en-us/docs/web/javascript/guide/modules

To clarify, I have the same problem:

hosting an express.js file on vercel and using a <script type=module src=...></script>

The contents of that file (located in ./assets) are loaded but changed by vercel. So instead of:

import { _wcl } from './common-lib.js';
import { _wccss } from './common-css.js';

It generates:

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MscCircleProgress = void 0;
var _commonLib = require("./common-lib.js");
var _commonCss = require("./common-css.js");

Which is not working in javascript modules (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)

Vercel在部署时正在更改JS文件的内容

爱人如己 2025-02-20 17:47:57

Blogposts类型与后期重新影响之间存在明显的类型检查不一致。

用于

$any((blogPosts | async)...

避免在不纠正类型不一致的情况下进行类型检查错误。

至于$ ANY的可读性,以下是

在某些情况下使用$ ANY()类型式函数以选择退出
对表达式的一部分进行类型检查

There is obvious type checking incoherence between the Blogposts type and re-affectation later in the code.

use

$any((blogPosts | async)...

to avoid type-checking error without correcting the type incoherence.

As for the legibility of $any, here is what is in the doc:

Use the $any() type-cast function in certain contexts to opt out of
type-checking for a part of the expression

错误的“对象是类型未知”。当在角度应用中使用GraphQl-codegen

爱人如己 2025-02-20 17:10:20

您可以尝试Gunicorn的-PythonPath论点:

--pythonpath STRING   A comma-separated list of directories to add to the Python path.

You could try gunicorn's --pythonpath argument:

--pythonpath STRING   A comma-separated list of directories to add to the Python path.

如何在枪支中设置文件夹和文件的路径?

爱人如己 2025-02-20 09:25:18

因此,我刚刚用CDN在我的Sitecore环境中实施了此功能,真是太棒了!这些是我的步骤:

上面的图像链接是一个屏幕快照,它具有您需要在CDN中创建的规则的参数。默认情况下,CustomAccept是Dianoga所说的自定义标头。该值是在您的CDN配置中设置的,您可以将其更改为任何想要的或离开它,都不重要。唯一重要的是,配置中的设置值匹配您在CDN规则中的目标。

如果您有任何疑问,除此之外,真正帮助我的事情实际上是在Dianoga的Github页面上阅读了Readme。 请回答您的其余问题(以及图像链接上方链接的文章),

如果您在没有CDN的情况下执行此操作, 请确保在应用程序数据中删除MediaCache文件夹。 Dianoga在他们的GitHub页面上的步骤中谈到了这一点。由于Sitecore从缓存中拉出,即使WebP可以工作并已创建,它也会将图像拉到那里。您必须擦拭它,以便WebP是其中唯一的东西。如果您使用CDN,则不必担心这一点,也许最糟糕的是擦拭CDN缓存。

So I just implemented this on my Sitecore environment with a CDN and it's awesome! These are my steps:

The image link above is a screenshot that has the parameters of the rule you need to create in your CDN. By default CustomAccept is what Dianoga calls the custom header. That value is set in your CDN config and you can change it to whatever you want or leave it, doesn't matter. The only thing that matters is that the setting value in your config matches what you target in your CDN rule.

If you have any questions beyond this what really helped me is actually reading the readMe on Dianoga's github page. That should answer the rest of your questions (as well as the article linked above the image link)

IF YOU'RE DOING THIS WITHOUT A CDN MAKE SURE TO DELETE THE MEDIACACHE FOLDER IN APP DATA. Dianoga talks about this in their steps on their github page. Since sitecore pulls from cache, it will pull images already there even if webP works and gets created already. You have to wipe it so that webP is the only thing in there. If you use a CDN you don't have to worry about this and maybe the worst is wiping your CDN cache.

SITECORE- WebP图像未使用Dianoga工具从CDN生成

爱人如己 2025-02-20 07:17:53

来自 wikidata的文档

尽管它实现了映射[entityID,对象],但[ entity ]实际上是多范围的。另请参见GetList()方法。

这意味着您可以做:

>>> [c.label for c in entity.getlist(child_prop)]
[m'Joe Hill', m'Owen King', m'Naomi King']

From the docs for Wikidata:

Although it implements Mapping[EntityId, object], it [entity] actually is multidict. See also getlist() method.

Which means you can do:

>>> [c.label for c in entity.getlist(child_prop)]
[m'Joe Hill', m'Owen King', m'Naomi King']

如何获取Python Wikidata中的实体列表

爱人如己 2025-02-20 00:04:13

让点消费捕获(无求出)。

.*,([^,]+),

在Regex101上查看此演示

显然,这只有在字符串中发生了两个逗号时才在Lesat中进行。

How about letting the dot consume and capture (no lookarounds).

.*,([^,]+),

See this demo at regex101

Obviously this only makes if at lesat two commas occure in the string.

正则逆向搜索字符串

爱人如己 2025-02-19 22:51:52

在您的查询中, = 符号仅获取与create_at完全匹配的记录。例如,您在日期25-06-2022 TIME 04:15:33创建记录。

当您的命令每分钟执行时,它将在04:15:00执行&amp; 04:16:00,这些只会获得与时间匹配的记录,而您创建的记录则在之间不匹配,因此它将返回 null/empty
要访问记录,您必须在查询中使用大于或相等的符号&gt; = 以获取20分钟前创建的任何记录。

     $allUsers = User::where('created_at' >= now()->addMinutes(20))

使用一些标志来保留已经发送电子邮件的用户记录否则,您的代码将发送电子邮件给所有已发送或未发送的电子邮件之前创建的所有用户

In you query = sign only get record which exactly match with created_at. For example you create a record on date 25-06-2022 time 04:15:33.

As your command execute every minute so it will execute on 04:15:00 & 04:16:00, these will get only records that match with time and your created record is between these as seconds are not matching therefore it will return Null/empty.
To access records you must use greater-than or equal sign >= in your query to get any record which is created before 20 minutes.

     $allUsers = User::where('created_at' >= now()->addMinutes(20))

Use some flag to keep record of users already sent email otherwise your code will send email to all users created before 20 minutes either email already sent or not.

Laravel从创建时间录制所有记录20分钟

爱人如己 2025-02-19 22:01:28

首先,您需要从位置导入徽标,

import logo from '../img/logo-color.png';

然后您需要像以下

<img src={logo} className="App-logo" alt="logo" />

First of all, You need to import the logo from the location,

import logo from '../img/logo-color.png';

Then You need to use it like below,

<img src={logo} className="App-logo" alt="logo" />

如何在React JS中导入徽标图像?

爱人如己 2025-02-19 17:32:05
"java": "cd $dir && javac $fileName && java -cp . $fileName",

在“代码跑步者&gt;&gt; settings&gt; code-runner:executor map&gt; edit in steratings.json”中尝试以上行。

"java": "cd $dir && javac $fileName && java -cp . $fileName",

Try above line in "Code Runner >> settings >> Code-runner: Executor Map >> Edit in settings.json"

&#x27; Code Runner&#x27;扩展显示“找不到或加载Main Class”。在包装/文件夹中运行Java程序时。 (VSCODE)

爱人如己 2025-02-19 12:04:59

这是评估串联公式字符串的工作技巧。使用公式单元作为目标单元的数据验证源。也许这不是完全自动化的解决方案。但是评估刷新的配方已被删除至一键。当必要时,您只需要从验证框重新选择值即可。非常感谢@aurielle Perlmann和 @user3626588 为这个想法。

例如,当您在另一个表中设置了以下公式的动态多重串联时,这将与选择验证选项相当。

就我而言,按两次按ENTER不是用户友好。

=({FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/edit"; "EXPENSES!A2:P"); INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/edit"; "EXPENSES!A2:P"); 0; 1) <> ""); FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/edit"; "EXPENSES!A2:P"); INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/edit"; "EXPENSES!A2:P"); 0; 1) <> "");过滤器(InporTrange(“ https://docs.google.com/spreadsheets/d/cccccccccccccccccccccccccccccccccccccccccccccccccccccccedccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccced/edit一下,”;索引(InporTrange(“ https://docs.google.com/spreadsheets/d/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccced/edit一下”;“支出!a2:p”); 0; 0; 1); 1)&lt;&gt;&gt;

[在此处输入图像描述] “
[在这里输入图像描述] “

Here is the working trick to evaluate the concatenated formula string. Use the formula cell as a data validation source for the target cell. Maybe it is not a fully automated solution. But evaluating refreshed formulas has been stripped down to just one click. You just need to reselect the value from the validation box when it is necessary. Many thanks to @Aurielle Perlmann and @user3626588 for the idea.

As an example, when you have set up dynamic multiple concatenations of such below formula in another sheet, this will work well with selecting validation option.

In my case, pressing enter twice is not userfriendly.

=({FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/edit"; "EXPENSES!A2:P"); INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/edit"; "EXPENSES!A2:P"); 0; 1) <> ""); FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/edit"; "EXPENSES!A2:P"); INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/edit"; "EXPENSES!A2:P"); 0; 1) <> ""); FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/cccccccccccccccccccccccccccccccccccccccccc/edit"; "EXPENSES!A2:P"); INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/cccccccccccccccccccccccccccccccccccccccccc/edit"; "EXPENSES!A2:P"); 0; 1) <> "")})

[enter image description here]1
[enter image description here]2

有没有办法评估存储在单元格中的公式?

爱人如己 2025-02-18 20:10:22

如果您想避免需要数字索引每个dataFrames,但宁愿能够直接以其名称访问它们:

import pandas as pd

table_names = ['df1', 'df2', 'df3']
for name in table_names:
  exec('%s = pd.DataFrame()' % name, locals(), locals())

print(df1)

此方法使用 exec ,基本上像Python代码一样运行字符串。我只是将每个预定的名称格式化为前面的字符串。

If you want to avoid needing to numerically index each of the DataFrames, but would rather be able to access them directly by their name:

import pandas as pd

table_names = ['df1', 'df2', 'df3']
for name in table_names:
  exec('%s = pd.DataFrame()' % name, locals(), locals())

print(df1)

This approach uses exec, which essentially runs a string as if it were python code. I'm just formatting each of the predetermined names into the string in a for-loop.

是否有一种更优雅的方法来初始化空数据框

爱人如己 2025-02-18 08:38:02

与其在数组中存储罢工 - 直通字符串,不如创建一个 class 让两个成员a 字符串 boolean ,然后使布尔值<代码> True 您要敲击的字符串。

class Message {
    private String str;
    private boolean strike;

    public Message (String str, boolean strike) {
        this.str = str;
        this.strike = strike;
    }
    
    // getters and setters
}

当您在屏幕上显示它

ArrayList<Message> arr = new ArrayList<>();
for (Message msg: arr) {
    if (arr.getStrike()) {
        // make string strikethrough
    } else {
        // keep as it is
    }
}

屏幕上显示琴弦

  • 以通过TextView 方法1
textView.setText("I want like that")
textView.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
  • 方法2:在 时,请通过String罢工。文本然后使用
String str = "I want like that";
SpannableStringBuilder builder = new SpannableStringBuilder(str);
StrikethroughSpan strikethroughSpan = new StrikethroughSpan();
builder.setSpan(
        strikethroughSpan,
        0, // Start
        4, // End (exclusive)
        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE // Text changes will not reflect in the strike changing
);
textView.setText(spanBuilder);
  • 方法3:如果要在字符串中击中文本。xml
<string name="yourName"><strike>I want like that</strike></string>

引用: [1]

Instead of storing a strike-through string inside the array, Create a class having two members a String and a boolean, and make the boolean true for the string you want to strike through.

class Message {
    private String str;
    private boolean strike;

    public Message (String str, boolean strike) {
        this.str = str;
        this.strike = strike;
    }
    
    // getters and setters
}

and make string strike through when you're showing it on the screen

ArrayList<Message> arr = new ArrayList<>();
for (Message msg: arr) {
    if (arr.getStrike()) {
        // make string strikethrough
    } else {
        // keep as it is
    }
}

To strike through a string in TextView

  • Method 1
textView.setText("I want like that")
textView.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
  • Method 2: If you want to strike through only a part of the text then use
String str = "I want like that";
SpannableStringBuilder builder = new SpannableStringBuilder(str);
StrikethroughSpan strikethroughSpan = new StrikethroughSpan();
builder.setSpan(
        strikethroughSpan,
        0, // Start
        4, // End (exclusive)
        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE // Text changes will not reflect in the strike changing
);
textView.setText(spanBuilder);
  • Method 3: If you want to strike through text in strings.xml
<string name="yourName"><strike>I want like that</strike></string>

references: [1]

如何在字符串上罢工?不是textview,EditText或视图。但是像字符串a ='我的文字;然后将其作为字符串传递到Sqlite

爱人如己 2025-02-18 08:26:38

链接的Hello World示例是使用 @Wasmer/wasi/wasi

您需要降级版本或跟随最新文档

That linked hello world example is using an old version of @wasmer/wasi.

You need to either downgrade your version, or follow the up-to-date docs

无法解决@wasmer/wasi/lib/bindings/browser&#x27;来自&#x27 ;/ index.js&#x27;

爱人如己 2025-02-18 02:50:12

程序Oracle SQL开发人员本身不会自动化它,但是有很多选择可以完成。

基本上,某些计算机需要具有可以唤醒并完成工作的调度程序。有些人使用Windows计划的任务,CRON作业或第三方程序使用自己的计算机为此。

但是,您的计算机将运行什么“任务”?该任务基本上是要连接到数据库,进行身份验证,发送查询文本,在内存中检索结果,然后将其导出为文件。很多人会为此使用Python,因为它可以处理所有这些步骤。

您会注意到,我们已经处于2个外部“事物”可能失败的情况。
(1)您的计算机,
(2)您的Python代码。

一个更简单的选择是Oracle数据库本身。是在始终运行的远程服务器上吗?如果是这样,您可能会利用这一点,并拥有 完成所有工作。

您正在查看几个步骤,但我认为它们更容易(尽管您可能必须从管理员那里获得权限)。

指定文件位置 - 请记住,这在服务器上,而不是您的计算机

create or replace directory csv_dir as '/destination/for/results';

创建存储过程 - 像SQL Logic的容器一样。

create or replace procedure write_file is
  file_handle UTL_FILE.file_type;
begin
  file_handle := utl_file.fopen('CSV_DIR', 'csv_filename.csv', 'w', 32767);
  for rws in (
    select * from t -- your query here
  ) loop
    utl_file.put_line(file_handle, 
      rws.c1 || ',' || rws.c2 || ',' || rws.c3 -- your columns here
    );
  end loop;
  utl_file.fclose(file_handle);
end write_file;

创建调度程序作业 - 运行存储过程。这是您的Oracle服务器的功能。

BEGIN
  DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'EXPORT_CSV_J',
    job_type => 'PLSQL_BLOCK',
    job_action => 'begin write_file; end;',
    number_of_arguments => 0,
    start_date => NULL,
    repeat_interval => 'FREQ=DAILY',
    end_date => NULL,
    enabled => FALSE,
    auto_drop => FALSE);

  DBMS_SCHEDULER.SET_ATTRIBUTE( 
    name => 'EXPORT_CSV_J', 
    attribute => 'logging_level', 
    value => DBMS_SCHEDULER.LOGGING_RUNS);
  
  DBMS_SCHEDULER.enable(
    name => 'EXPORT_CSV_J');
END;

我从这个网站自从我自己做这件事已经有一段时间了。

如果由于某种原因,您的数据库实际上不是Oracle(我知道有些人使用Oracle SQL开发人员即使他们的实际数据库有所不同),那么步骤将是相似的,但是代码会有所不同。

The program Oracle SQL Developer itself won't automate it, but there are plenty of options to get it done.

Basically, some computer somewhere needs to have a scheduler that can wake it up and do the work. Some people use their own computers for this, using windows scheduled tasks, cron jobs, or 3rd party programs.

But what "tasks" will your computer run? The task is basically to connect to the database, authenticate, send the Query text, retrieve the results in memory, and then export them as a file. Lot's of people will use python for this, because it can handle all of those steps.

You'll notice that we're already at 2 external "things" that could fail.
(1) your computer,
(2) your python code.

A simpler option, is the oracle database itself. Is it on a remote server that's always running? If so, you might take advantage of that and have it do all the work.

You're looking at a few steps, but I think they are easier (you might have to get permissions from an admin, though).

Specify a file location - remember, this is on the server, not your computer

create or replace directory csv_dir as '/destination/for/results';

Create a stored procedure - acts like a container for your SQL logic.

create or replace procedure write_file is
  file_handle UTL_FILE.file_type;
begin
  file_handle := utl_file.fopen('CSV_DIR', 'csv_filename.csv', 'w', 32767);
  for rws in (
    select * from t -- your query here
  ) loop
    utl_file.put_line(file_handle, 
      rws.c1 || ',' || rws.c2 || ',' || rws.c3 -- your columns here
    );
  end loop;
  utl_file.fclose(file_handle);
end write_file;

Create a scheduler job - runs the stored procedure. This is a feature of your Oracle server.

BEGIN
  DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'EXPORT_CSV_J',
    job_type => 'PLSQL_BLOCK',
    job_action => 'begin write_file; end;',
    number_of_arguments => 0,
    start_date => NULL,
    repeat_interval => 'FREQ=DAILY',
    end_date => NULL,
    enabled => FALSE,
    auto_drop => FALSE);

  DBMS_SCHEDULER.SET_ATTRIBUTE( 
    name => 'EXPORT_CSV_J', 
    attribute => 'logging_level', 
    value => DBMS_SCHEDULER.LOGGING_RUNS);
  
  DBMS_SCHEDULER.enable(
    name => 'EXPORT_CSV_J');
END;

I borrowed this code from this website since it has been a while since I did this myself.

If for some reason your database isn't actually Oracle (I know some people use Oracle SQL Developer even though their actual database is something different) then the steps will be similar but the code will be different.

如何自动化Oracle SQL开发人员每天一次将查询导出到CSV/XLSX

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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