青衫负雪

文章 评论 浏览 29

青衫负雪 2025-02-17 02:25:39

您应该能够使用 dbutils.notebooks.run但是它和%运行之间存在区别:

  • dbutils.notebooks.run执行另一个笔记本作为单独的作业,因此没有定义等。当前笔记本 - 您可以通过临时视图传达数据,等等

我不确定dbutils.notebooks.run在您的情况下会有所帮助。

PS我个人建议使用仅定义函数,不执行任何计算等的笔记本使用%运行 - 在这种情况下,即使您有%运行这就是t对您当前的上下文产生任何副作用。

You should be able to use dbutils.notebooks.run for calling another notebook, but there is a difference between it and %run:

  • dbutils.notebooks.run executes another notebook as a separate job, so no definitions, etc. is pulled into the context of the current notebook - you can communicated data via temp views, etc.
  • %run execute another notebook and pulls all definitions and sides effects into the context of the current notebook.

I'm not sure if dbutils.notebooks.run will help in your case.

P.S. I personally would recommend to use %run with notebooks that only define functions, not doing any calculations, etc. - in this case, even if you have %run this doesn't cause any side effect on your current context.

使用Databricks中的R调用笔记本

青衫负雪 2025-02-16 14:29:56

为了解决这个问题,我创建了一个API来从字符串或字符串数​​组中提取URL

基础URL - > https://urlsparser.herokuapp.com/

获取

{
  "string" : "More here http://action.mySite.com/trk.php?mclic=P4CAB9542D7F151&urlrv=http%3A%2F%2Fjeu-centerparcs.com%2F%23%21%2F%3Fidfrom%3D8&urlv=517b975385e89dfb8b9689e6c2b4b93d text<br/>And more here http://action.mySite.com/trk.php?mclic=P4CAB9542D7F151&urlrv=http%3A%2F%2Fjeu-centerparcs.com%2F%23%21%2F%3Fidfrom%3D8&urlv=517b975385e89dfb8b9689e6c2b4b93d"
}

{
  "string" : ["string1","string2"....]
}

屏幕截图

“

优势

  1. 具有900多个域扩展[.com] ,.io,....]
  2. 更快的提取物少于20ms

To solve this problem I've created an API to extract URLs from a string or an array of strings

Base Url -> https://urlsparser.herokuapp.com/

GET https://urlsparser.herokuapp.com/url

For a single string

{
  "string" : "More here http://action.mySite.com/trk.php?mclic=P4CAB9542D7F151&urlrv=http%3A%2F%2Fjeu-centerparcs.com%2F%23%21%2F%3Fidfrom%3D8&urlv=517b975385e89dfb8b9689e6c2b4b93d text<br/>And more here http://action.mySite.com/trk.php?mclic=P4CAB9542D7F151&urlrv=http%3A%2F%2Fjeu-centerparcs.com%2F%23%21%2F%3Fidfrom%3D8&urlv=517b975385e89dfb8b9689e6c2b4b93d"
}

For an array of strings

{
  "string" : ["string1","string2"....]
}

Screenshot

2

Advantages

  1. Has more than 900 domain extensions [.com,.io,....]
  2. Faster, extracts result in less than 20ms

如何从不包含https或www的字符串中提取URL

青衫负雪 2025-02-16 12:00:45

Alter Table在图像顶部的语句表明该列最初是char(20),这意味着值是 - 并且仍然是 - 带有空格。

因此,如果您还将字面空间填充到相同的长度:

select ename from employee where job = 'Manager             '

或者如果您使用喜欢,则可以使用通配符(您尝试过的),尽管这可以匹配任何作业标题,否则 您的查询将有效。这只是从“经理”开始:

select ename from employee where job like 'Manager%'

或者如果您在比较之前修剪了列值:

select ename from employee where rtrim(job) = 'Manager'

但是您可能想在转换后以一次性操作删除后尾空间:

alter table employee modify job varchar2(20);
update employee set job = rtrim(job);
select ename from employee where job = 'Manager';

db&lt

; 。

You can read more about

The alter table statement at the top of your image suggests that the column was initially char(20), which means the values were - and still are - padded with spaces.

So your query would work if you also padded the literal with spaces to the same length:

select ename from employee where job = 'Manager             '

Or if you used like with a wildcard character (which is missing from your attempt), though this could match any job title that just start with 'Manager':

select ename from employee where job like 'Manager%'

Or if you trimmed the column value before comparing:

select ename from employee where rtrim(job) = 'Manager'

But you probably want to remove the trailing spaces as a one-off operation after converting:

alter table employee modify job varchar2(20);
update employee set job = rtrim(job);
select ename from employee where job = 'Manager';

db<>fiddle

I've used varchar2 rather than varchar, as Oracle recommend.

You can read more about blank-padded and nonpadded comparison semantics in the documentation.

为什么这不是选择工作经理?

青衫负雪 2025-02-16 08:59:28

谢谢大家的帮助,那些正在寻找匿名函数中捕获异常的人,只需单击“ exception参数”选项卡中的“常见语言运行时异常”复选框(debugging - &gt; windows - &gt;例外参数参数)。
就这样。

Thank you all for your help, those who are looking for an answer to catching exceptions in anonymous functions, just click on the "Common Language Runtime Exceptions" checkbox in the "Exception parameters" tab (Debugging -> Windows -> Exception Parameters).
That's all.

活动停止了一半

青衫负雪 2025-02-16 04:29:07

尝试以下操作:

Future<Widget?> persiting () async {
    late bool hasUsers;
    await FirebaseAuth.instance
        .authStateChanges()
        .listen((User? user) {
      if (user == null) {
        hasUsers = true;
      } else {
        hasUsers = false;
      }
    });
    return hasUsers ? SignUpScreen() : HomeScreen();
  }

try this:

Future<Widget?> persiting () async {
    late bool hasUsers;
    await FirebaseAuth.instance
        .authStateChanges()
        .listen((User? user) {
      if (user == null) {
        hasUsers = true;
      } else {
        hasUsers = false;
      }
    });
    return hasUsers ? SignUpScreen() : HomeScreen();
  }

返回类型&#x27; InbeupScreen&#x27; Isn; ta; ta&#x27; void; void; void; void;

青衫负雪 2025-02-14 13:46:01

您可以使用Excel公式。使用3个辅助列

  • 公式1 countifs(a:a,a2)
  • formula2 countifs($ d $ 2 $ 2:d2,d2,d2)
  • 3 Intervel iwterpal iwter> iwter>如果((e2-quotient(e2-Quotient( e2,3)*3)= 1,1,“”)

“”

You can use Excel formulas. Use 3 helper columns

  • Formula1 COUNTIFS(A:A,A2)
  • Formula2 COUNTIFS($D$2:D2,D2)
  • 3 interval IF((E2-QUOTIENT(E2,3)*3)=1,1,"")

Excel如何在3个相同值的多个中删除重复行

青衫负雪 2025-02-14 12:05:25

我们可以为此使用应用函数。但是首先,您沿着轴1的构造构成了两个框架。我使用的是一个带有三个条目的虚拟表。它可以用于任何数量的行。

import pandas as pd
import numpy as np

# Dummy data
df1 = pd.DataFrame([['a','b','c','d','e'],['a','b','c','d','e'],['a','b','c','d','e']])
df2 = pd.DataFrame([[1,1,1,1,1,0,0,0,0],[1,1,1,1,0,1,0,0,0],[1,1,1,1,0,0,1,0,0]])

# Display dataframe . May not work in python scripts. I used them in jupyter notebooks
display(df1)
display(df2)

# Concat DFs
df3 = pd.concat([df1,df2],axis=1)
display(df3)

# Define function for replacing
def replace(letters,indexes):
    seek =0
    for i in range(len(indexes)):
        if indexes[i]==1:
            indexes[i]=letters[seek]
            seek+=1
    return ''.join(list(map(str,indexes)))

# Applying replace function to dataframe
df4 = df3.apply(lambda x: replace(x[:5],x[5:]),axis=1)

# Display df4
display(df4)

结果是

0    abcde0000
1    abcd0e000
2    abcd00e00
dtype: object

我认为这将解决您的问题

We can use apply function for this. But first you have concat both frames along axis 1. I am using a dummy table with just three entries. It can be applied for any number of rows.

import pandas as pd
import numpy as np

# Dummy data
df1 = pd.DataFrame([['a','b','c','d','e'],['a','b','c','d','e'],['a','b','c','d','e']])
df2 = pd.DataFrame([[1,1,1,1,1,0,0,0,0],[1,1,1,1,0,1,0,0,0],[1,1,1,1,0,0,1,0,0]])

# Display dataframe . May not work in python scripts. I used them in jupyter notebooks
display(df1)
display(df2)

# Concat DFs
df3 = pd.concat([df1,df2],axis=1)
display(df3)

# Define function for replacing
def replace(letters,indexes):
    seek =0
    for i in range(len(indexes)):
        if indexes[i]==1:
            indexes[i]=letters[seek]
            seek+=1
    return ''.join(list(map(str,indexes)))

# Applying replace function to dataframe
df4 = df3.apply(lambda x: replace(x[:5],x[5:]),axis=1)

# Display df4
display(df4)

The result is

0    abcde0000
1    abcd0e000
2    abcd00e00
dtype: object

I think this will solve your problem

用另一个数据框元素替换数据框的元素

青衫负雪 2025-02-14 09:00:47

从我的看来,在这里添加这两条线应在您的代码中起作用。我认为您的Keras安装有问题。

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

为了始终避免添加这些行,我想您应该将其添加到系统中的ENV变量中。

另一个解决方案是删除库中的libiomp5md.dll文件。您可以检查目录中是否存在该文件。

From what I have looked up over here adding these two lines should work in your code. I assume something is wrong with your installation of keras.

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

To always avoid adding these lines I suppose you should add that to env variables in the system.

Another solution is to delete libiomp5md.dll file in your libraries. You could check to see if that file exists in your directories.

图像分类器未显示损失,准确性和培训过程

青衫负雪 2025-02-14 04:37:37

您可以使用JavaScript函数Shiny.setInputValue Shiny提供给客户端。示例:

library(shiny)
ui <- shiny::fluidPage(
                 img(id = 'trigger_image', 
                     src = 'notfound.jpg',
                     height = '100px',
                     width = '100px'
                     ),
                 tags$script('
              document.getElementById("trigger_image").onclick = function(){
              var the_time = new Date().getTime();
              // set input$client_time to the_time:
              Shiny.setInputValue("client_time", the_time)}
        ')
        )

server <- function(input, output) {
    observeEvent(input$client_time,{
        ## do stuff with input$client_time
    })
}

shinyApp(ui, server)

请注意,JavaScript GetTime自1970/1/1以来返回毫秒。

与javascript

闪亮 您必须衡量在客户和用户响应中更新图像之间经过的时间(单击新图像),您可以捕获和计算客户端的两个事件之间的持续时间:

library(shiny)
ui <- shiny::fluidPage(
    tags$script('
    // ------ javascript code ------
    // $(document).ready(...) ensures execution only after document is fully rendered
    // so that events like .onclick can be attached 
    $(document).ready(function(){
        // function to set Shiny input value to current time: 
        const clockEvent = function(inputName){Shiny.setInputValue(inputName, new Date().getTime())}
        // trigger when the value of output id "trigger_image" changes: 
        $(document).on("shiny:value",
               function(event){
                   if (event.target.id === "trigger_image") {clockEvent("displayed_at")}
               }
              )
        // trigger when the image, after being sent or refreshed, is clicked:
        document.getElementById("trigger_image")
                    .onclick = function(){clockEvent("reacted_at")}
    })
    // ------------------------------
    '),
    shiny::imageOutput('trigger_image'),
    actionButton('show_new', 'show new image'),
    textOutput('reaction_time')
)


server <- function(input, output) {
    observeEvent(input$show_new,{
        output$trigger_image <- shiny::renderImage(list(id = 'trigger_image',
                                                        'src' = 'image001.png'
                               ), deleteFile = FALSE)
                               
        output$reaction_time <- renderPrint(paste('reaction time (ms)', input$reacted_at - input$displayed_at))
})
}

shinyApp(ui, server)

You could use the javascript function Shiny.setInputValue supplied by Shiny to the client. Example:

library(shiny)
ui <- shiny::fluidPage(
                 img(id = 'trigger_image', 
                     src = 'notfound.jpg',
                     height = '100px',
                     width = '100px'
                     ),
                 tags$script('
              document.getElementById("trigger_image").onclick = function(){
              var the_time = new Date().getTime();
              // set input$client_time to the_time:
              Shiny.setInputValue("client_time", the_time)}
        ')
        )

server <- function(input, output) {
    observeEvent(input$client_time,{
        ## do stuff with input$client_time
    })
}

shinyApp(ui, server)

Note that Javascript getTime returns milliseconds elapsed since 1970/1/1.

Shiny: Communicating with Javascript

Edit

If you have to measure the time elapsed between updating the image at the client and the user responding (clicking on the fresh image), you can capture and calculate the duration between both events at the client side like this:

library(shiny)
ui <- shiny::fluidPage(
    tags$script('
    // ------ javascript code ------
    // $(document).ready(...) ensures execution only after document is fully rendered
    // so that events like .onclick can be attached 
    $(document).ready(function(){
        // function to set Shiny input value to current time: 
        const clockEvent = function(inputName){Shiny.setInputValue(inputName, new Date().getTime())}
        // trigger when the value of output id "trigger_image" changes: 
        $(document).on("shiny:value",
               function(event){
                   if (event.target.id === "trigger_image") {clockEvent("displayed_at")}
               }
              )
        // trigger when the image, after being sent or refreshed, is clicked:
        document.getElementById("trigger_image")
                    .onclick = function(){clockEvent("reacted_at")}
    })
    // ------------------------------
    '),
    shiny::imageOutput('trigger_image'),
    actionButton('show_new', 'show new image'),
    textOutput('reaction_time')
)


server <- function(input, output) {
    observeEvent(input$show_new,{
        output$trigger_image <- shiny::renderImage(list(id = 'trigger_image',
                                                        'src' = 'image001.png'
                               ), deleteFile = FALSE)
                               
        output$reaction_time <- renderPrint(paste('reaction time (ms)', input$reacted_at - input$displayed_at))
})
}

shinyApp(ui, server)

在Shiny应用中捕获客户的时间点击图像

青衫负雪 2025-02-14 03:18:29

(序言:要安全起见,请备份您的目录的备份副本,或确保您已经在某处拥有该副本)。


您可以初始化一个新的空存储库,将原始中央存储库添加为遥控器,然后运行git reset&lt; lote 没有 - 硬选项)将您的活动提交设置为所需的位置,而无需修改磁盘上的文件:

git init

git remote add origin https://github.com/user/repo # <- add a remote
git fetch origin

# optional: set your current local branch to something other than master
git switch -c my/branch

git reset origin/my/branch   # <- regular reset, *not* 'reset --hard'

(preamble: to be on the safe side, make a backup copy of your directory, or make sure you already have that copy somewhere).


You can initialize a new empty repository, add the original central repo as a remote, and run git reset <some commit> (important note: without the --hard option) to set your active commit to where you want without modifying the files on disk :

git init

git remote add origin https://github.com/user/repo # <- add a remote
git fetch origin

# optional: set your current local branch to something other than master
git switch -c my/branch

git reset origin/my/branch   # <- regular reset, *not* 'reset --hard'

在没有.git的目录中初始化git的目录

青衫负雪 2025-02-14 01:29:24

您的构建中似乎有一个缺少的课程。您解决了所有Android依赖性吗?签到资产 - &GT;插件 - &GT; googlemobileads-unity.aar文件的Android文件夹。如果此文件不存在,请执行以下操作。

尝试强制Android解析器中的Android依赖性 - &GT;力解决。它将在您的构建中包含所有文件。

It seems like there is a missing class in your build. Did you resolve all android dependencies? Check-in Assets -> Plugins -> Android folder for googlemobileads-unity.aar file. if this file is not there then do following.

Try to force resolve android dependency in Android Resolver -> Force Resolve. And it'll include all the files in your build.

AndroidJavaException:Java.lang.ClassNotFoundException:com.google.unity.ads.unitys.unityintyinterstitialadcallback

青衫负雪 2025-02-14 01:24:44

我不明白为什么div.class移动到右下角。

这就是bottom正确 css属性的目的。它们将元素的底部和右侧放置,从底部和右侧计数 - 在这种情况下,由于位置为固定

我真的很想知道“ 0”的含义。

0是许多单位。它可以被指定为0px0pt或其他单位单元。它代表了距视口界框的距离。

,如果我更改(底部:0;右:0;),为什么边界永远不会伸展到右侧(top:0; top:0;右:0; botton; bottom; bottom; 0;左:0;)?

因为宽度:300px规范规定了该元素的宽度,因此渲染必须放弃对:0,因为否则宽度将是不同的。但是,如果您删除width规范,则该元素将占据视口的整个空间:

div.fixed {
  position: fixed;
  _width: 300px;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border: 3px solid #73AD21;
}
<h2>position: fixed;</h2>

<p>An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled:</p>

<div class="fixed">
This div element has position: fixed;
</div>

I don't understand why the div.class moves to the right bottom.

That's what the bottom and right CSS properties are for. They position the bottom and right side of the element, counting from the bottom and right side -- in this case from the viewport, since position is fixed.

I really want to know the meaning of '0' precisely in fixed position.

0 is a number of units. It could have been specified as 0px or 0pt or with another unit, but since it doesn't matter which unit is used, as it is 0 anyway, it is specified without unit. It represents the distance from the bounding box of the viewport.

Why does the border never stretch to the right side if I change (bottom: 0; right: 0;) into (top: 0; right: 0; bottom: 0; left: 0;)?

Because the width: 300px specification stipulates what the width of the element should be, and so the rendering has to give up on right: 0, as otherwise the width would be different. However, if you drop the width specification, the element will take the whole space of the viewport:

div.fixed {
  position: fixed;
  _width: 300px;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border: 3px solid #73AD21;
}
<h2>position: fixed;</h2>

<p>An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled:</p>

<div class="fixed">
This div element has position: fixed;
</div>

正确的是什么:CSS固定位置中的0表示?

青衫负雪 2025-02-13 08:44:53

我有同样的问题。这很奇怪,因为如果您要在GKE中创建PVC,则PV是动态创建的(确实是),因此您可以使用kubectl获取PV,PVC-All-Namespaces和所有内容似乎很正常。但是看来,当创建部署(使用PVC)并且在等待PVC创建时出现错误时出现此错误时,群集会确认并显示警报(创建一些误报警报)。这似乎是一个计时问题。

一个周转是更改storageclassName定义的值。如果代替标准,则使用标准rwo(在存储中显示为默认值中的默认值),问题似乎消失了。结果是,基础磁盘的类型从标准持久磁盘更改为平衡持久磁盘。无论如何,后者的性能更好。

编辑:
这是关于存储类。默认标准类的volumebindingmode是立即。根据 documentation> documentation

直接模式表示音量结合和动态
一旦创建了持久性volumeclaim,就会发生配置。为了
存储后端受拓扑约束,而不是全球
可以从集群中的所有节点访问,persistentvolumes将是
在不了解POD计划的情况下被绑定或准备
要求。这可能会导致不可计划的豆荚。

集群管理员可以通过指定该问题来解决此问题
WaitforfirstConsumer模式将延迟绑定和
配置持久性volume,直到使用
创建了PersistentVolumeClaim。将选择PersistentVolumes
或规定符合由
POD的调度约束。这些包括但不限于
资源需求,节点选择器,POD亲和力和抗亲和力,
和污染和耐受。

因此,如果需要保留标准 的所有属性必须保留,则另一种解决方案是创建另一个storege>存储类

  1. 下载标准 存储类
  2. 更改name定义将
  3. 属性从volumebindingmode更改属性:立即 volumalbindingmode将属性更改:waitforfirstConsumer
  4. 应用它(kubectl应用-f&lt; file Path&gt;
  5. ,在storageclassName PVC的定义中,将其更改为步骤#2的名称

I'm having the same problem. It is weird because if you are creating a PVC in GKE, the PV is created dynamically (and indeed it is), so you go and check with kubectl get pv,pvc --all-namespaces and everything seems normal. But it seems that when a deployment (that uses a PVC) is created and while waiting for the creation of the PVC this error appears and the cluster acknowledges it and displays the alert (creating some false positive alerts). It seems like a timing issue.

One turnaround is to change the value of the storageClassName definition. If instead of standard you use standard-rwo (both appear as default in Storage Classes tab in Storage) the problem seems to disappear. The consequence of this is that the type of the underlying disk changes from Standard persistent disk to Balanced persistent disk. Anyhow, the latter one performs better.

EDIT:
It is about Storage Classes. The volumeBindingMode of the default standard class is Immediate. According to the documentation:

The Immediate mode indicates that volume binding and dynamic
provisioning occurs once the PersistentVolumeClaim is created. For
storage backends that are topology-constrained and not globally
accessible from all Nodes in the cluster, PersistentVolumes will be
bound or provisioned without knowledge of the Pod's scheduling
requirements. This may result in unschedulable Pods.

A cluster administrator can address this issue by specifying the
WaitForFirstConsumer mode which will delay the binding and
provisioning of a PersistentVolume until a Pod using the
PersistentVolumeClaim is created. PersistentVolumes will be selected
or provisioned conforming to the topology that is specified by the
Pod's scheduling constraints. These include, but are not limited to,
resource requirements, node selectors, pod affinity and anti-affinity,
and taints and tolerations.

So, if all the properties of the standard Storage class are required to be kept, another solution would be to create another Storage class:

  1. Download the YAML of the standard Storage class
  2. Change the name definition
  3. Change the property from volumeBindingMode: Immediate to volumeBindingMode: WaitForFirstConsumer.
  4. Apply it (kubectl apply -f <file path> )
  5. And in the storageClassName definition of the PVC, change it to the name of the step #2

gke can can can can cable fy persistentVolume缩放节点

青衫负雪 2025-02-13 08:26:24

这是一个数组,因此应作为json [0] .example访问它

This is an array, so it should be accessible as json[0].example

无法从使用括号的API获取数据

青衫负雪 2025-02-12 20:56:48

spark.read.json(“ s3a:// my-data/data-events/{2020,2021,2022}/*/*/*/*/*”)如何

使其基于动态在current_year上

from datetime import datetime

current_year = datetime.now().year
years_to_query = ",".join([str(x) for x in range(2020, current_year + 1)])
f"s3a://my-data/data-events/{{{years_to_query}}}/*/*/*/*"

,如果您已经对数据进行了分区,例如:
路径本来是my-data/data-events/年= yyyy/soner = mm/day = dd/hour = hh/file.json您可以拥有spark.read.json(“ s3a:// my-data/数据事件”),然后.filter(col(“ Year”)&gt; ='2020'),该过滤器将是按照文件夹路径而不是通过查看JSON本身来运行的。

how about spark.read.json("s3a://my-data/data-events/{2020,2021,2022}/*/*/*/*")

to make it dynamic based on current_year

from datetime import datetime

current_year = datetime.now().year
years_to_query = ",".join([str(x) for x in range(2020, current_year + 1)])
f"s3a://my-data/data-events/{{{years_to_query}}}/*/*/*/*"

Also if you have partitioned your data, e.g:
the path would have been my-data/data-events/year=YYYY/month=MM/day=DD/hour=HH/file.json you could have spark.read.json("s3a://my-data/data-events") and then .filter(col("year") >= '2020'), this filter would have been run against the folders paths and not by looking into the jsons themselves.

Spark.Read.json()如何使用动态年份参数读取文件

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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