蓝咒

文章 评论 浏览 33

蓝咒 2025-02-20 18:17:59
  1. 如评论中所建议的,您可以使用__内置__dir(__内置__)将为您提供所有内置对象的名称列表。您需要该列表的下部,这是功能所在的位置。

  2. 至于正则...您可以按照(1)中建议的构建内置列表,然后在这样的正则态度中使用它:

import re

rex = re.compile(f"({'|'.join(builtins)})\s*\(")

使用以下事实:函数名称必须跟随开放的括号。构建结果列表时,您可以在稍后添加括号。

  1. As was suggested in the comments you can use __builtins__. dir(__builtins__) will give you a list of names of all builtin objects. You'll need the lower portion of that list, which is where the functions are.

  2. As for the regex... You can build a list of builtins as suggested in (1) and then use it in a regex like this:

import re

rex = re.compile(f"({'|'.join(builtins)})\s*\(")

That uses the fact that a function name must be followed by an opening parenthesis. The closing parenthesis you can add later, when building the resulting list.

我必须定义一个python函数,该功能返回python问题数据集中存在的所有内置python方法和函数的列表

蓝咒 2025-02-19 23:08:25

一种方法可能是在时间戳上使用一些算术,然后将时间戳转换回日期:

date -d "@$(( $(date +%s) - 3 * 24 * 60 * 60 ))"

鉴于

docker run --rm alpine:3.14 sh -c 'date; 
  date -d "@$(( $(date +%s) - 3 * 24 * 60 * 60 ))"'

它会产生:

Tue Jul  5 11:51:31 UTC 2022
Sat Jul  2 11:51:31 UTC 2022

A way to do it could be to use a bit of arithmetic on a timestamp, then translate the timestamp back into a date:

date -d "@$(( $(date +%s) - 3 * 24 * 60 * 60 ))"

Given

docker run --rm alpine:3.14 sh -c 'date; 
  date -d "@$(( $(date +%s) - 3 * 24 * 60 * 60 ))"'

It would yield:

Tue Jul  5 11:51:31 UTC 2022
Sat Jul  2 11:51:31 UTC 2022

从今天的BusyBox日期开始三天的日期

蓝咒 2025-02-19 12:07:33

此页面使用 http live streaming 部署 m3U8 文件格式。获得指向M3U8文件的链接后,可以将其下载并与其他软件诽谤一起转换并支持HLS(例如播放器或 ffmpeg ffmpeg -i“ https://4.m3u8?…” output.mp4)。

您可以使用Chrome Dev工具提取.m3U8 URL,这使您可以在浏览器中浏览加载的资源:

日志网络活动

重新加载页面。网络面板记录网络日志中的所有网络活动

- 文档› chrome devtools› Chrome devtools›网络

一旦打开 f12 ,您可以按 f5 重新加载所有资源并使用搜索m3U8的过滤选项:

”在此处输入图像说明”

This page uses HTTP Live Streaming deploying the M3U8 file format. After obtaining the link to the M3U8 file, it can be downloaded and converted with other software libaries also supporting HLS (e.g. VLC media player or ffmpeg ffmpeg -i "https://….m3u8?…" output.mp4).

You can extract the .m3u8 URL using Chrome Dev Tools, which allow you to browse loaded resources in your browser:

Log network activity

Reload the page. The Network panel logs all network activity in the Network Log.

enter image description here

Documentation › Chrome DevTools › Network

Once opened with F12, you can press F5 to reload all resources and use the search option to filter for m3u8:

enter image description here

下载在线视频JS

蓝咒 2025-02-19 07:53:34

我发现的一种解决方案是修改 main.js 因此,看起来:

import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

require( "../node_modules/leaflet-polylinedecorator/dist/leaflet.polylineDecorator.js" );

new Vue({
  render: h => h(App),
}).$mount('#app')

添加需要解决了问题。

如果有的话,我会对替代解决方案感兴趣。

A solution I found was to modify main.js so it looks like:

import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

require( "../node_modules/leaflet-polylinedecorator/dist/leaflet.polylineDecorator.js" );

new Vue({
  render: h => h(App),
}).$mount('#app')

Adding the require resolved the problem.

I would be interested in alternative solutions, if there are any.

我如何将传单螺旋式Ecorator与VUE应用程序一起使用

蓝咒 2025-02-19 07:29:56

基础R解决方案。从 tarjae的答案

在第一个说明中,正则言论与塔吉的差距几乎相同,有两个区别:

  1. 匹配的第一个时期被逃脱了;
  2. 字符串的末端被显式。

然后,唯一的时期被破折号“ _”取代。

row.names(df) <- sub('^([^.]+\\.[^.]+).*


创建

使上述代码为单线。

sub('^([^.]+)\\.([^.]+).*', '\\1-\\2', rownames(df))
#> [1] "GTEX-1117F" "GTEX-111FC" "GTEX-1128S" "GTEX-117XS" "GTEX-1192X"

, '\\1', row.names(df)) row.names(df) <- sub('\\.', '-', row.names(df)) row.names(df) #> [1] "GTEX-1117F" "GTEX-111FC" "GTEX-1128S" "GTEX-117XS" "GTEX-1192X"


创建

使上述代码为单线。

A base R solution. Data borrowed from TarJae's answer.

In the first instruction, the regex is almost identical to TarJae's, with two differences:

  1. The first period to be matched is escaped;
  2. the end of string is made explicit.

Then the only period is replaced by a dash "_".

row.names(df) <- sub('^([^.]+\\.[^.]+).*

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


Edit

onyambu's comment makes the above code a one-liner.

sub('^([^.]+)\\.([^.]+).*', '\\1-\\2', rownames(df))
#> [1] "GTEX-1117F" "GTEX-111FC" "GTEX-1128S" "GTEX-117XS" "GTEX-1192X"

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

, '\\1', row.names(df)) row.names(df) <- sub('\\.', '-', row.names(df)) row.names(df) #> [1] "GTEX-1117F" "GTEX-111FC" "GTEX-1128S" "GTEX-117XS" "GTEX-1192X"

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


Edit

onyambu's comment makes the above code a one-liner.

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

如何使用sub或gsub命令在R中编辑Rownames

蓝咒 2025-02-19 06:38:46

还请确保您不要将一个(...)able(...)渲染方法混淆。

  • 一个(...)将期望获得特定的东西渲染
  • 所有(...)将采用一个具有内在内容

所以我只是在猜测,但是您可能想要一个ALL 基本上是用于Wysiwyg设置的,编辑器在其中手动将他们想要的任何应用程序添加到Wysiwyg字段中。

检查博客应用程序以查看它。

Please also make sure you don't confuse the One(...) with the All(...) render methods.

  • One(...) will expect to get a specific thing to render
  • All(...) will take an entity which has Inner Content

So I'm just guessing, but you probably want One. All is basically for WYSIWYG setups, where the editor manually adds any app they want into a WYSIWYG field.

Check the blog app to see it in action.

应用程序2SXC中的嵌套应用程序13.12.0

蓝咒 2025-02-19 00:11:56

请记住,时间。Sleep(5)正在阻止,而异步。
因此,当您处于“异步def”函数中时,建议使用asyncio.sleep,因此异步动作可以更好地融合在一起。

PS您是否尝试将屏幕快照的“等待”键“等待”?我指的是start()函数定义的第三行?

Please remember that time.sleep(5) is blocking, and asyncio.sleep(5) is non-blocking.
Therefore when you are in an "async def" function it is advised to use asyncio.sleep so the asynchronous actions can better blend together.

P.S. have you tried to put the key phrase "await" infront of screenshot()? I am refering to the 3rd to last line of the start() function definition?

discord.py runtime warnning:coroutine&#x27;命令。__调用__&#x27;从未等待过

蓝咒 2025-02-18 08:04:55

一种解决方案是使用许多可用插件之一禁用JavaScript。

另一个是简单地打开开发人员工具并导航到该元素。有几种方法可以这样做:

  • f12 (适用于Windows,Mac,Linux)
  • 菜单→工具→工具→开发人员工具
  • ctrl + shift shift + i (工作方式 f12
  • 如果在macos上,请按 i i

我使用了此答案供参考,但改进了。

One solution would be to disable Javascript using one of many available plugins.

Another is to simply open developer tools and navigate to that element. There are few ways to do it:

  • press F12 (Works for Windows, Mac, Linux)
  • Menu → Tools → Developer tools
  • press Ctrl+Shift+I (works same way F12)
  • If on MacOS, press I

I used this answer for reference, but improved.

当右键单击打开网站上的菜单时,如何检查元素

蓝咒 2025-02-18 05:53:56
  1. viewa是您的viewmodel viewb。因此,viewa的名称应为viewBViewModel

  2. class/struct名称应以大写字母开头。

  3. 在您的viewmodel(在这种情况下,在viewa中)只需在您的发布的属性中设置一个值,它将自动更新所有内容视图在哪里使用。在这种情况下:

      class Viewa:observableObject {
        @Publised var idd:string =“”
    
        func addNote() - &gt;细绳 {
    
       //一些代码
    
            self.idd = idd //在此处设置IDD,将自动更新(因为它是已发布的变量) 
    //查看@StateObject属性包装器正在用于实例化Viewa
    //(实际上是ViewModel)。
    
        }
    }
     
  1. viewA is your viewModel for viewB. So the name of viewA should be ViewBViewModel.

  2. class/struct names should start with Capital letters.

  3. In your viewModel (in this case in viewA) just set a value to your Published property , it will be auto updated throughout all the Views where it is being used. In this case:

    class viewA: ObservableObject{
        @Published var idd: String = ""
    
        func addNote()-> String {
    
       // some Code
    
            self.idd = idd // setting idd here, which will be auto updated (since its a published variable) in the 
    //views where @Stateobject property wrapper is being used to instantiate viewA
    // (which is a viewModel actually).
    
        }
    }
    

无法将返回的值从viewb传递到swiftui中的viewa

蓝咒 2025-02-18 05:31:31

我最终只是这样做了,似乎比以前更简单,更有效。

Range("'Handling Units'!HUNUM01").FormulaR1C1 = "=IFERROR((WHNUMB&REPT(0,14-LEN(STARTNUMB))&STARTNUMB+(RC[-1]-1)),"""")"
Range("'Handling Units'!HUNUM01").AutoFill Destination:= Range("B5:B" & Range("A" & Rows.Count).End(xlUp).Row)

I ended up just going with this, seems simple enough and more effective than what I had before.

Range("'Handling Units'!HUNUM01").FormulaR1C1 = "=IFERROR((WHNUMB&REPT(0,14-LEN(STARTNUMB))&STARTNUMB+(RC[-1]-1)),"""")"
Range("'Handling Units'!HUNUM01").AutoFill Destination:= Range("B5:B" & Range("A" & Rows.Count).End(xlUp).Row)

VBA工作表功能

蓝咒 2025-02-17 06:07:22

使用您的情况(最多之间),它可以正常工作:
如果您在stack中具有值:1,4,5,3,2,1 - 然后。并执行案例2:将留下stack带有1,2,5,3,2MaxStack不会被弹出,所以仍然有5个作为顶级元素。

但是,使用的顺序1,2,3,5,5删除查询将从stackmaxstack中执行POP(),它导致:

stack - &gt; 1,2,3,5

maxstack - &gt; 1,2,3

我认为这是逻辑中的缺陷。

With you case (max in between) it works fine:
If you have values in the stack: 1,4,5,3,2,1 - then maxStack will contain 5 as the top element. And executing case 2: will leave stack with 1,2,5,3,2 and maxStack will not be popped so still have 5 as top element.

However with the sequence of 1,2,3,5,5 delete query will execute pop() from both stack and maxStack which leads to:

stack -> 1,2,3,5

maxStack -> 1,2,3

Which I believe is a flaw in the logic.

Peek()如何工作?

蓝咒 2025-02-16 19:03:09

描述

有两个部分。使用模板html,其中testcsv2()在服务器上运行以及传递data在显示HTML之前并使用google> google> google> google> google.script.run.testcsv3( )从服务器获取数据。

code.gs

function onOpen() {
  var menu = SpreadsheetApp.getUi().createMenu("Test");
  menu.addItem("Show Test", "showSidebar").addToUi();
}

function showSidebar() {
  var html = HtmlService.createTemplateFromFile("HTML_Test");
  html.data = "greetings";
  html = html.evaluate();
  SpreadsheetApp.getUi().showSidebar(html);
}

function testCSV2() {
  return "hello";
}

function testCSV3() {
  return "goodbye";
}

html_test

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    Hello, world! <input type="button" value="Answers" onclick="answers()" />
    <H2 id="myTitle"></H2><br><br>
    <?!= data ?><br>
    <?!= testCSV2() ?>
    <script>
      function answers() {
        google.script.run.withSuccessHandler( 
          function (data) {
            document.getElementById("myTitle").innerText = data;
          }
        ).testCSV3();
      }
    </script>
  </body>
</html>

参考

Description

There are two part to this. Using templated HTML in which testCSV2() is run on the server as well as passing data before the HTML is displayed and using google.script.run.testCSV3() to get data from the server.

Code.gs

function onOpen() {
  var menu = SpreadsheetApp.getUi().createMenu("Test");
  menu.addItem("Show Test", "showSidebar").addToUi();
}

function showSidebar() {
  var html = HtmlService.createTemplateFromFile("HTML_Test");
  html.data = "greetings";
  html = html.evaluate();
  SpreadsheetApp.getUi().showSidebar(html);
}

function testCSV2() {
  return "hello";
}

function testCSV3() {
  return "goodbye";
}

HTML_Test

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    Hello, world! <input type="button" value="Answers" onclick="answers()" />
    <H2 id="myTitle"></H2><br><br>
    <?!= data ?><br>
    <?!= testCSV2() ?>
    <script>
      function answers() {
        google.script.run.withSuccessHandler( 
          function (data) {
            document.getElementById("myTitle").innerText = data;
          }
        ).testCSV3();
      }
    </script>
  </body>
</html>

References

Google Apps脚本,Google Sheep-模板Scriplets不工作

蓝咒 2025-02-16 15:39:41

接口无法扩展联合。这就是错误消息的含义。

例如:

type A = { foo: 1 } | { bar: 2 }
interface B extends A { baz: 3 } // error

但是,您可以使用与相交的类型别名 &amp;

type A = { foo: 1 } | { bar: 2 }
type C = A & { baz: 3 } // fine

Which means this should work as you expect:

type ReactProps = RouteProps & {
  element: React.ReactNode
  feature?: string
  role?: string
  fallback?: React.ReactNode | string
}

See playground

And interface cannot extend a union. That's what the error message means.

For example:

type A = { foo: 1 } | { bar: 2 }
interface B extends A { baz: 3 } // error

However, you can use a type alias with an intersection &.

type A = { foo: 1 } | { bar: 2 }
type C = A & { baz: 3 } // fine

Which means this should work as you expect:

type ReactProps = RouteProps & {
  element: React.ReactNode
  feature?: string
  role?: string
  fallback?: React.ReactNode | string
}

See playground

我如何破坏React道具和我的自定义道具的混合物?

蓝咒 2025-02-15 07:11:03

您可以使用Handler推迟工作。

 android.os.Handler(Looper.getMainLooper()).postDelayed({
         // This will execute after 5 seconds(5000 milliseconds)
         // val intent  = Intent(context, Destination::class.java)
         // startActivity(intent) 
         // finish()   
      }, 5000)

You can use handler to have deferred work queued.

 android.os.Handler(Looper.getMainLooper()).postDelayed({
         // This will execute after 5 seconds(5000 milliseconds)
         // val intent  = Intent(context, Destination::class.java)
         // startActivity(intent) 
         // finish()   
      }, 5000)

如何自动意图与其他活动一样,例如使用计时器到其他活动?

蓝咒 2025-02-14 20:17:19

您可以创建这样的组件并传递固定文本。尝试这样的尝试:

html:

<div class="custom-editor">
  <span id="fixedText">Fixed text</span>
  <textarea style="padding-top:{{ fixedTextHeight }}px" 
  (change)="onValueChange($event)"></textarea>
</div>

ts:

  fixedTextHeight ;

  constructor(private cd: ChangeDetectorRef) {  }

  ngAfterViewInit() {
    var el = document.getElementById('fixedText');

    var elHeight =
      el.clientHeight || el.offsetHeight || el.getBoundingClientRect().height;

    this.fixedTextHeight = elHeight + 5;
    console.log('Height: ' + this.fixedTextHeight);

    this.cd.detectChanges();
  }

 onValueChange(evt) {
    this.modifiedText = this.myText + ' ' + evt.target.value;
 }

css:

.custom-editor {
  display: inline-block;
  position: relative;
}

.custom-editor span {
  position: absolute;
  left: 5px;
  top: 3px;
  color:gray
}

工作demo

You can create a component like this and pass the fixed text. Try like this:

HTML:

<div class="custom-editor">
  <span id="fixedText">Fixed text</span>
  <textarea style="padding-top:{{ fixedTextHeight }}px" 
  (change)="onValueChange($event)"></textarea>
</div>

TS:

  fixedTextHeight ;

  constructor(private cd: ChangeDetectorRef) {  }

  ngAfterViewInit() {
    var el = document.getElementById('fixedText');

    var elHeight =
      el.clientHeight || el.offsetHeight || el.getBoundingClientRect().height;

    this.fixedTextHeight = elHeight + 5;
    console.log('Height: ' + this.fixedTextHeight);

    this.cd.detectChanges();
  }

 onValueChange(evt) {
    this.modifiedText = this.myText + ' ' + evt.target.value;
 }

CSS:

.custom-editor {
  display: inline-block;
  position: relative;
}

.custom-editor span {
  position: absolute;
  left: 5px;
  top: 3px;
  color:gray
}

Working Demo

如何实现无法更改现有值的文本区域?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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