枫以

文章 评论 浏览 28

枫以 2025-02-12 08:35:35

而且,当我尝试使用时:

$doc->loadHTMLFile("https://zh.wikipedia.org/wiki/亞馬遜公司");

它似乎是在显示结果时起作用的,但仅在结果的顶部,我会得到这样的错误:

Warning: DOMDocument::loadHTMLFile(): Tag wbr invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 77 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag wbr invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 77 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1140 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1158 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1175 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1202 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1219 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1277 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1294 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1310 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1326 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1342 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1359 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag footer invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1378 in C:\laragon\www\test.php on line 210

我真的需要您的帮助。请。

And also when I try to use:

$doc->loadHTMLFile("https://zh.wikipedia.org/wiki/亞馬遜公司");

It seems to work as the result is displayed but just at the top of the result I get errors like this:

Warning: DOMDocument::loadHTMLFile(): Tag wbr invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 77 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag wbr invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 77 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1140 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1158 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1175 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1202 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1219 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1277 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1294 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1310 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1326 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1342 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag nav invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1359 in C:\laragon\www\test.php on line 210

Warning: DOMDocument::loadHTMLFile(): Tag footer invalid in https://zh.wikipedia.org/wiki/%E4%BA...85%AC%E5%8F%B8, line: 1378 in C:\laragon\www\test.php on line 210

I really need your help. Please.

为什么``domdocument''的“ load”方法向我展示了“警告domdocument :: load()的错误”当我加载法语和中文页面时?

枫以 2025-02-11 19:20:17

您可以尝试这样的事情: -

x = "0b1"
y = 0b1

#type of x and y before change
print(type(x))
print(type(y))


x,y=y,x
print(bin(x))
print(y)

#type of x and y after change
print(type(x))
print(type(y))

You can try something like this : -

x = "0b1"
y = 0b1

#type of x and y before change
print(type(x))
print(type(y))


x,y=y,x
print(bin(x))
print(y)

#type of x and y after change
print(type(x))
print(type(y))

如何转换字符串“ 0bxxxx”到二进制?

枫以 2025-02-11 02:23:41

如何使用毫秒而不是秒?

select current_timestamp, current_timestamp + INTERVAL '1 MILLISECONDS';

How about using MILLISECONDS instead of SECONDS?

select current_timestamp, current_timestamp + INTERVAL '1 MILLISECONDS';

https://docs.snowflake.com/en/sql-reference/data-types-datetime.html#supported-date-and-time-parts-for-intervals

我想使用间隔功能将雪花的当前日期添加到当前日期

枫以 2025-02-11 01:42:34

在搜索了此问题之后,我找到了以下解决方案的解决方案:

我更改了 omrconfig.json per omrconfig.ts forow此模型

export default {
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'root',
  database: 'test',
  synchronize: false,
  logging: true,
  "entities": [
      "src/typeorm/**/*.ts"
  ],
  "migrations": [
       "typeorm/migrations/**/*.ts"
  ],
  "subscribers": [
      "src/subscriber/**/*.ts"
  ],
  "cli": {
      "entitiesDir": "src/typeorm",
      "migrationsDir": "typeorm/migrations",
      "subscribersDir": "src/typeorm"
  }
};

,然后我使用

<<代码> NPM I -G Typeorm

并在 package.json 中添加两个脚本,第一个是:

“ typeorm”:“ TS -Node -R TSCONFIG PATHS/寄存器。 /node_modules/typeorm/cli.js -config server/emoverments/migrations.ts“

,第二个是:

“迁移:create”:“ typeorm迁移:创建\” ./ typeorm/typeorm/migrations/typeorm/migrations/ “

因此,我设法将迁移保存在typeorm/typal命令

npm运行迁移中的typeorm/迁移中,create -n {migrationName}

此typeorm版本为0.3.6

After searching about this problem, i found the solution making the fix below:

I changed omrconfig.json per omrconfig.ts folow this model

export default {
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'root',
  database: 'test',
  synchronize: false,
  logging: true,
  "entities": [
      "src/typeorm/**/*.ts"
  ],
  "migrations": [
       "typeorm/migrations/**/*.ts"
  ],
  "subscribers": [
      "src/subscriber/**/*.ts"
  ],
  "cli": {
      "entitiesDir": "src/typeorm",
      "migrationsDir": "typeorm/migrations",
      "subscribersDir": "src/typeorm"
  }
};

Then I installed the typeorm CLI global with

npm i -g typeorm

And add two scripts in package.json, the first is:

"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config server/environments/migrations.ts"

And the second is:

"migrate:create": "typeorm migration:create \"./typeorm/migrations/"

So I managed to save the migrations in the chosen folder inside typeorm/migrations with the terminal command

npm run migrate:create -n {migrationName}

This typeORM version is 0.3.6

typeorm不要将迁移保存在正确的文件夹中

枫以 2025-02-10 07:43:02

不确定Python代码,但是在Snowflake SQL中,您可以检查一下个人两个是一个空的对象:

create or replace table t1 as select parse_json($
{
    "Input1": {
        "address": "",
        "phone": "123-345-6789",
        "city": "",
        "class": "",
        "name": "test",
        "no_call": true,
        "state": "",
        "zip": ""
    },
    "Input2": {    
        "person": {}
    }
}$) as v;

select v:Input2:person = parse_json('{}') as PERSON_MISSING from t1;

实际上,它看起来好像是为了进行比较,因此甚至无需使用 parse_json 。如果Python代码挂在单引号上,则可以尝试使用备用的字符串终止器尝试:

select v:Input2:person = ${}$ as PERSON_2_MISSING from t1;

Not sure about the Python code, but in Snowflake SQL you can check to see if person two is an empty object like this:

create or replace table t1 as select parse_json($
{
    "Input1": {
        "address": "",
        "phone": "123-345-6789",
        "city": "",
        "class": "",
        "name": "test",
        "no_call": true,
        "state": "",
        "zip": ""
    },
    "Input2": {    
        "person": {}
    }
}$) as v;

select v:Input2:person = parse_json('{}') as PERSON_MISSING from t1;

Actually, it looks as if it's stringified to compare, so it's not even necessary to use parse_json. If the Python code is getting hung up on the single quotes you can try with alternate string terminators like this:

select v:Input2:person = ${}$ as PERSON_2_MISSING from t1;

如何在雪花中检查空的json

枫以 2025-02-10 04:49:28

我认为您要么需要删除 src/,要么将其移动到前

  • “ prod”:“ nwbuild -platforms osx64 -builddir dist/“
  • ” prod”:“ nwbuild src/ - platforms osx64 - builddir dist/”

,请删除或更改 node-remote 。当前已设置它,以便Internet上的任何网页都具有完整的控制来运行节点,这意味着他们可以轻松地读取计算机上所有文件的内容,下载 virus.exe ,删除所有文件,实际上是什么。不要那样做。

Node-remote 几乎专门用于指向 http:// localhost:8080 或其他端口,用于本地WebServer您的应用程序运行。您的 main 指向本地文件,而不是网络服务器,因此您可能根本不需要 node-remote

您可能想将根的“图标” 移动到“ window” sub对象中。

I think you either need to remove your src/ or move it to the front

  • "prod": "nwbuild --platforms osx64 --buildDir dist/"
  • "prod": "nwbuild src/ --platforms osx64 --buildDir dist/"

Also, either remove or change your node-remote. It is currently set up so that any webpage on the internet has complete control to run Node, meaning they can easily read the contents of all files on the computer, download virus.exe, delete all files, whatever, literally anything. Don't do that.

node-remote is almost exclusively used to point to http://localhost:8080, or some other port, for a local webserver your app runs on. Your main is pointing to a local file, not a webserver, so you likely do not need node-remote at all.

You probably want to move the "icon" at the root into the "window" sub object.

nwjs-“没有匹配的文件”尝试打包应用程序时出错

枫以 2025-02-10 02:25:09

防止您的组件呈现图表,直到可用数据为止。最好的方法是添加以下条件:

{ regime.length && <Chart>...</Chart>}

Prevent you component from rendering the chart until the data is available. The best way is to add an if condition like below:

{ regime.length && <Chart>...</Chart>}

JSON文件返回空,但随后返回数据,但我会收到图表的错误

枫以 2025-02-09 21:02:33

在阅读我的答案之前,请检查 https:// git-git- scm.com/book/en/v2/customizing-git-git--tributes

它有效地告诉您您有一个 .git/info/attributes 的文件,或者您可能有一个文件 .gitattributes 在某个地方文件。

您可以通过单击“转到文件”按钮

”

,然后输入您要搜索的文件( .gitattributes) 在这种情况下):

”“在此处输入图像说明”

如果您找到了文件,很好!如果没有,那么您将需要(对不起)来克隆您的项目,并检查是否有 git/info/属性/文件,看看是否有任何属性这与您的目标相矛盾。您可以在root文件夹中创建 .gitattributes 文件(如果不存在)和 git push it。

Before you read my answer, kindly check https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

It effectively tells you that you either have a file of .git/info/attributes or you might have a .gitattributes file somewhere.

You can search for any files (including .gitattributes) via clicking on the Go To File button

enter image description here

and then typing in the file you are searching for (.gitattributes in this case):

enter image description here

If you find your file, good! If not, then you will need (sorry !) to clone your project and check whether there is a .git/info/attributes/ file and see whether there are any attributes that are contradicting your aim. You can create a .gitattributes file (if it doesn't exist) in your root folder and git push it.

如何在github.com上找到.gitattributes的位置?

枫以 2025-02-09 14:18:40

您可以写一个自定义远程电视可以防止遥测发送到应用程序见解:

public class CustomTelemetryFilter : ITelemetryProcessor
{
    private readonly ITelemetryProcessor _next;

    public CustomTelemetryFilter(ITelemetryProcessor next)
    {
        _next = next;
    }

    public void Process(ITelemetry item)
    {
        // Example: process all telemetry except requests to favicon
        var isFavIconUrl = item is RequestTelemetry request && request.Url.ToString().EndsWith("favicon.ico");

        if (!isFavIconUrl)
            _next.Process(item); // Process the item only if it is not the request for favicon
    }
}

最后一步是注册您的过滤器,请参阅 docs 关于如何在特定的运行时执行此操作。

You can write a custom TelemetryFilter that prevents telemetry from being send to application insights:

public class CustomTelemetryFilter : ITelemetryProcessor
{
    private readonly ITelemetryProcessor _next;

    public CustomTelemetryFilter(ITelemetryProcessor next)
    {
        _next = next;
    }

    public void Process(ITelemetry item)
    {
        // Example: process all telemetry except requests to favicon
        var isFavIconUrl = item is RequestTelemetry request && request.Url.ToString().EndsWith("favicon.ico");

        if (!isFavIconUrl)
            _next.Process(item); // Process the item only if it is not the request for favicon
    }
}

The last step is to register your filter, see the docs on how to do that for your specific runtime.

Azure应用程序见解禁用Favicon检查

枫以 2025-02-09 13:44:07

单个环境变量

 "scripts": {
    "start": "set NODE_ENV=production&& node server.js"
 }

对于多个环境变量的

 "scripts": {
    "start": "set NODE_ENV=production&& set PORT=8000&& node server.js"
 }

For single environment variable

 "scripts": {
    "start": "set NODE_ENV=production&& node server.js"
 }

For multiple environment variables

 "scripts": {
    "start": "set NODE_ENV=production&& set PORT=8000&& node server.js"
 }

如何从package.json内部设置环境变量?

枫以 2025-02-09 07:02:50

只需要添加WebPack设置

devServer: {
  contentBase: './dist',
  port: 3000,
  historyApiFallback: true, // its enable SPA routing through historyApi
}

Just need to add webpack settings

devServer: {
  contentBase: './dist',
  port: 3000,
  historyApiFallback: true, // its enable SPA routing through historyApi
}

使用历史API的香草JS的路由器?

枫以 2025-02-08 22:03:55

相反,使用用户代理给我带来了结果。

使用 pip install pyyaml ua-parser用户代理nake-useragent 安装facke_useragent

from fake_useragent import UserAgent

def extract_listing_html(url):
    
    opts = Options()
    ua = UserAgent()
    userAgent = ua.random
    print(userAgent)
    opts.add_argument(f'user-agent={userAgent}')
    driver = webdriver.Chrome(service = Service(driver_path), options = opts)
    driver.get(url)  
    time.sleep(5)
    html = driver.page_source
    soup = BeautifulSoup(html, "html.parser")
    
    return soup

Using a user-agent instead has given me results.

Use pip install pyyaml ua-parser user-agents fake-useragent to install fake_useragent

from fake_useragent import UserAgent

def extract_listing_html(url):
    
    opts = Options()
    ua = UserAgent()
    userAgent = ua.random
    print(userAgent)
    opts.add_argument(f'user-agent={userAgent}')
    driver = webdriver.Chrome(service = Service(driver_path), options = opts)
    driver.get(url)  
    time.sleep(5)
    html = driver.page_source
    soup = BeautifulSoup(html, "html.parser")
    
    return soup

使用硒代理无法获得正确的结果

枫以 2025-02-08 21:46:36

您已经有太多*,只需铸造 d1 d2 to struct dir_item* and derference:

int compare(const void *d1, const void *d2)
{
    return (strcmp(((struct dir_item *)d1)->name,
                   ((struct dir_item *)d2)->name));
}

demo

You've got too many *, simply cast d1 and d2 to struct dir_item* and dereference:

int compare(const void *d1, const void *d2)
{
    return (strcmp(((struct dir_item *)d1)->name,
                   ((struct dir_item *)d2)->name));
}

Demo

分割故障11使用qsort中的比较函数()

枫以 2025-02-08 19:34:54

我发现了一种方法,不确定这是否是最佳实践,但似乎很好。我注意到 mapmvcattributeroutes 方法可以将 iDirectRouteProvider 作为参数。

它花了一点猜测,但我能够编写一个从框架的 defaultDirectRouteprovider 衍生的类,并覆盖GetRoutepRefix方法:

public class CheckoutPrefixRouteProvider : DefaultDirectRouteProvider
{
    protected override string GetRoutePrefix(ControllerDescriptor controllerDescriptor)
    {
        return "Checkout/" + base.GetRoutePrefix(controllerDescriptor);
    }
}

然后,我可以使用以下方式使用此新类:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapMvcAttributeRoutes(new CheckoutPrefixRouteProvider());
    }
}

我希望这很有帮助:

I found out a way to do it, not sure if it's best practice but it seems to work just fine. I noticed that the MapMvcAttributeRoutes method can take an IDirectRouteProvider as an argument.

It took a bit of guesswork but I was able to write a class that derives from the framework's DefaultDirectRouteProvider and overrides the GetRoutePrefix method:

public class CheckoutPrefixRouteProvider : DefaultDirectRouteProvider
{
    protected override string GetRoutePrefix(ControllerDescriptor controllerDescriptor)
    {
        return "Checkout/" + base.GetRoutePrefix(controllerDescriptor);
    }
}

I can then use this new class as follows:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapMvcAttributeRoutes(new CheckoutPrefixRouteProvider());
    }
}

I hope this is helpful :)

可变的RoutePreFix配置

枫以 2025-02-08 15:50:51

这三种方法中的任何一种( np.Where 应用 mask )似乎有效:

df['where'] = np.where(df.country=='CA', df.x, df.y)
df['apply'] = df.apply(lambda row: row.x if row.country == 'CA' else row.y, axis=1)
mask = df.country=='CA'
df.loc[mask, 'mask'] = df.loc[mask, 'x']
df.loc[~mask, 'mask'] = df.loc[~mask, 'y']

完整测试代码:

import pandas as pd
import numpy as np
df = pd.DataFrame({'country':['CA','US','CA','UK','CA'], 'x':[1,2,3,4,5], 'y':[6,7,8,9,10]})
print(df)

df['where'] = np.where(df.country=='CA', df.x, df.y)
df['apply'] = df.apply(lambda row: row.x if row.country == 'CA' else row.y, axis=1)
mask = df.country=='CA'
df.loc[mask, 'mask'] = df.loc[mask, 'x']
df.loc[~mask, 'mask'] = df.loc[~mask, 'y']
print(df)

输入:

  country  x   y
0      CA  1   6
1      US  2   7
2      CA  3   8
3      UK  4   9
4      CA  5  10

输出

  country  x   y  where  apply  mask
0      CA  1   6      1      1   1.0
1      US  2   7      7      7   7.0
2      CA  3   8      3      3   3.0
3      UK  4   9      9      9   9.0
4      CA  5  10      5      5   5.0

Any of these three approaches (np.where, apply, mask) seems to work:

df['where'] = np.where(df.country=='CA', df.x, df.y)
df['apply'] = df.apply(lambda row: row.x if row.country == 'CA' else row.y, axis=1)
mask = df.country=='CA'
df.loc[mask, 'mask'] = df.loc[mask, 'x']
df.loc[~mask, 'mask'] = df.loc[~mask, 'y']

Full test code:

import pandas as pd
import numpy as np
df = pd.DataFrame({'country':['CA','US','CA','UK','CA'], 'x':[1,2,3,4,5], 'y':[6,7,8,9,10]})
print(df)

df['where'] = np.where(df.country=='CA', df.x, df.y)
df['apply'] = df.apply(lambda row: row.x if row.country == 'CA' else row.y, axis=1)
mask = df.country=='CA'
df.loc[mask, 'mask'] = df.loc[mask, 'x']
df.loc[~mask, 'mask'] = df.loc[~mask, 'y']
print(df)

Input:

  country  x   y
0      CA  1   6
1      US  2   7
2      CA  3   8
3      UK  4   9
4      CA  5  10

Output

  country  x   y  where  apply  mask
0      CA  1   6      1      1   1.0
1      US  2   7      7      7   7.0
2      CA  3   8      3      3   3.0
3      UK  4   9      9      9   9.0
4      CA  5  10      5      5   5.0

结合if语句与python中的申请

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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