眼眸里的快感

文章 评论 浏览 30

眼眸里的快感 2025-02-21 02:04:15

部分更新非常常用,但与您描述的更新不同。

最常用的情况是您拥有Bootloade+应用程序的位置,并且仅更新了应用程序。

当应用程序彼此完全分开时,此方法是合适的。

您描述的情况意味着每个功能都需要相互通信或与主应用程序进行通信。在这种情况下,尝试将功能分离为单独的闪光区域将是太多麻烦。

您必须为每个“功能”提供一个单独的闪存段,从而导致空白(浪费空间),同时希望您的功能不会超越分配的空间。此外,您必须担心如何在不同功能之间实施通信,保持兼容性等...

只需将所有内容链接在一起并立即更新所有内容。

Partial update is used very commonly, but in a different way than the one you have described.

The most common used case is where you have a bootloade+application and only the application is updated.

This approach is suitable when the applications are completely separate from each other.

The case that you are describing implies that each feature need to communicate with each other or with the main application. In this case, it would be way too much trouble to try and separate the features into separate flash regions.

You'd have to give a separate flash segment for each "feature", resulting in gaps (wasted space), while hoping that your feature does not outgrow the allocated space. Additionally, you'd have to worry about how to implement communication between different features, maintaining compatibility etc...

Just link everything together and update everything at once.

进行嵌入式软件更新时,您应该擦除整个应用程序代码,还是仅部分更新应用程序?

眼眸里的快感 2025-02-21 01:10:41

您不能将道具从孩子传递给父母,这只是一种方式(从父母到孩子)。

您都应该:

  • 将状态放在父组件中,并通过在道具中传递固定器功能
  • 使用redux工具包来创建一个全局状态,从而从子组件中操纵它。

You can't pass props from child to parent in React, it's only one way (from parent to child).

You should either:

  • Put the state in the parent component and manipulate it from the child component by passing the setter function in the props
  • Use something like Redux Toolkit to create a global state that all components can have access to

将道具通过react中的父母成分形成父母

眼眸里的快感 2025-02-21 01:07:31

您的代码在chmodrec中不检查err参数。这是官方文档的摘录:

Walkdir在两种情况下用非nil Err参数调用该函数。

首先,如果根目录上的初始fs.Stat失败,则Walkdir
将路径设置为root,d设置为nil的函数,然后将ERR设置为
fs.Stat。

的错误

第二,如果目录的readdir方法失败,Walkdir呼叫
将路径设置为目录路径的功能,d设置为
fs.direntry描述目录,而err设置为从
readdir。在第二种情况下,该功能与
目录的路径:第一个呼叫是在目录读取之前
尝试并已设置为零,使功能有机会
返回skipdir,完全避免使用readdir。第二个电话是
失败后,ReadDir并报告了ReadDir的错误。 (如果readdir
成功,没有第二个电话。)

将此代码添加到函数的开头。它可以给您一个提示:

func ChmodRec(path string, di fs.DirEntry, err error) error {
        if err != nil {
            log.Fatal(err)
        }

Your code does not check err argument in ChmodRec. This is an extract from official documentation:

WalkDir calls the function with a non-nil err argument in two cases.

First, if the initial fs.Stat on the root directory fails, WalkDir
calls the function with path set to root, d set to nil, and err set to
the error from fs.Stat.

Second, if a directory's ReadDir method fails, WalkDir calls the
function with path set to the directory's path, d set to an
fs.DirEntry describing the directory, and err set to the error from
ReadDir. In this second case, the function is called twice with the
path of the directory: the first call is before the directory read is
attempted and has err set to nil, giving the function a chance to
return SkipDir and avoid the ReadDir entirely. The second call is
after a failed ReadDir and reports the error from ReadDir. (If ReadDir
succeeds, there is no second call.)

Add this code to the beginning of the function. It can give you a hint:

func ChmodRec(path string, di fs.DirEntry, err error) error {
        if err != nil {
            log.Fatal(err)
        }

Golang Chmod文件和目录递归

眼眸里的快感 2025-02-21 00:49:38

重要的是要指出,就像其他人一样, mysql 或://en.wikipedia.org/wiki/mariadb“ rel =” nofollow noreferrer“> mariadb 使用其他语法。此外,它也支持使用语法非常方便的(与T/SQL相反)。内在联接也是加入的代名词。因此,原始问题中最好的查询将在MySQL中最好地实现:

UPDATE
    Some_Table AS Table_A

JOIN
    Other_Table AS Table_B USING(id)

SET
    Table_A.col1 = Table_B.col1,
    Table_A.col2 = Table_B.col2

WHERE
    Table_A.col3 = 'cool'

我还没有看到其他答案中问问题的解决方案,因此我的两分钱。
(在php 7.4.0 Mariadb 10.4.10上测试)

It is important to point out, as others have, that MySQL or MariaDB use a different syntax. Also it supports a very convenient USING syntax (in contrast to T/SQL). Also INNER JOIN is synonymous with JOIN. Therefore the query in the original question would be best implemented in MySQL thusly:

UPDATE
    Some_Table AS Table_A

JOIN
    Other_Table AS Table_B USING(id)

SET
    Table_A.col1 = Table_B.col1,
    Table_A.col2 = Table_B.col2

WHERE
    Table_A.col3 = 'cool'

I've not seen the a solution to the asked question in the other answers, hence my two cents.
(tested on PHP 7.4.0 MariaDB 10.4.10)

如何从SQL Server中的选择中更新?

眼眸里的快感 2025-02-20 18:05:08

您将需要创建一些东西来区分不同类型的游戏对象。一种方法是将脚本(Monobehaviour)附加到每个GameObject上,并为其颜色提供公共变量。例如:

public string color;

您会看到此选项将显示为具有脚本的任何GameObject的编辑器。现在,您可以使用相同的脚本给每个对象的不同颜色。您现在可以访问它并使用它来确定发生的事情。

if (color = "green") { }

要从其他脚本中访问它并使用以下操作:

x.GetComponent<TheNameOfYourScript>().color

如果您需要对GameObject进行引用,将脚本附加到(不是类型,特定的类型),则可以使用术语“ GameObject”,例如:

return gameObject;

我希望这会有所帮助。

You will need to create something to distinguish between the different types of GameObjects. One way of doing this is to attach a script (monobehaviour) to each GameObject and give it a public variable for its colour. such as:

public string color;

You will see that this option will show up in the editor for any gameobject that has the script. Now you can give each object a different colour with the same script. You can now access it and use it to determine what happens.

if (color = "green") { }

To access it from a different script, get the object and use this:

x.GetComponent<TheNameOfYourScript>().color

If you need to get a reference to the GameObject a script is attached to (not the type, the specific one), you can use the term "gameObject" such as:

return gameObject;

I hope this helps.

如何检查脚本附加到的GameObject,以便在多个GameObject上使用相同的脚本?

眼眸里的快感 2025-02-20 06:53:03

iiuc,您可以使用自定义 groupby 使用 ,然后将最小条目和最大条目保留一天,然后计算差异:

out = (df.groupby(['id', pd.Grouper(freq='D', key='date')])['date']
         .agg(['min', 'max']).diff(axis=1)['max']
         .rename('active_time').reset_index())
print(out)

# Output
          id       date     active_time
0  533815001 2016-03-28 0 days 01:13:00
1  533815001 2016-04-01 0 days 01:02:00
2  533815003 2016-04-05 0 days 00:41:00
3  533815003 2016-04-25 0 days 00:45:00

IIUC, you can use groupby with a custom Grouper then keep the min and the max entries for a day and compute the difference:

out = (df.groupby(['id', pd.Grouper(freq='D', key='date')])['date']
         .agg(['min', 'max']).diff(axis=1)['max']
         .rename('active_time').reset_index())
print(out)

# Output
          id       date     active_time
0  533815001 2016-03-28 0 days 01:13:00
1  533815001 2016-04-01 0 days 01:02:00
2  533815003 2016-04-05 0 days 00:41:00
3  533815003 2016-04-25 0 days 00:45:00

计算用户的总小时时间在日期范围内被逗留

眼眸里的快感 2025-02-19 23:00:56

您在添加视图中作为邮政数据提供了product_id,但默认情况下,django视图句柄获取请求。因此,要么更改视图以包括product_id作为参数,此功能将有效或更改功能以处理发布请求。

使用获取方法

def add(request, product_id):
    cart = get_or_create_cart(request)
    producto = Producto.objects.get(pk=product_id)
    cart.productos.add(producto)
    return render(request, 'carts/add.html', {
        'producto': producto
    })

,您的URL模式看起来像

path('<int:product_id>/', add, name='add')

使用Post Request

def add(request):
    if request.method == "POST":
        cart = get_or_create_cart(request)
        producto = Producto.objects.get(pk=request.POST.get('product_id'))
        cart.productos.add(producto)
        return render(request, 'carts/add.html', {
            'producto': producto
        })
    else:
         # something you would like (GET method)

You are supplying product_id in the add views as post data but by default django views handles GET request. So, either change views to include product_id as argument and this function will works or change function to handle post request.

Using GET method

def add(request, product_id):
    cart = get_or_create_cart(request)
    producto = Producto.objects.get(pk=product_id)
    cart.productos.add(producto)
    return render(request, 'carts/add.html', {
        'producto': producto
    })

and your url patterns look like following

path('<int:product_id>/', add, name='add')

Using POST request

def add(request):
    if request.method == "POST":
        cart = get_or_create_cart(request)
        producto = Producto.objects.get(pk=request.POST.get('product_id'))
        cart.productos.add(producto)
        return render(request, 'carts/add.html', {
            'producto': producto
        })
    else:
         # something you would like (GET method)

valueerror:字段&#x27; id&#x27;期待一个数字,但得到了&#x27;&#x27;

眼眸里的快感 2025-02-19 14:59:58

您需要安装django,此错误是因为未安装Django

$ python -m pip install Django

You need to install Django, this error is giving because django is not installed

$ python -m pip install Django

我如何将django导入我的python路径

眼眸里的快感 2025-02-19 07:33:45

您可以使用

[^\s\[\]]*\[*\d*\.?\d+(?:\(\d*\.?\d+\+\d*\.?\d+\))?×(?:\d*\.?\d+)?\]*

regex demo

详细信息

  • [^\ s \ [\]]* - 零或更多的chars和更高的chars and square brackets and whitespace
  • \ [* - 零或零或更多[ chars
  • \ d*\。?\ d+ - int/float号码
  • (?:\(\ d*\。?\ d+\+\ d*\。?\ d+\))? - 一个可选的序列
    • \( - a char
    • \ d*\。?\ d+ - int或float号码
    • \+ - a + char
    • \ d*\。?\ d+ - int或float号码
    • \) - a char
  • × - a × char
  • (?:\ d*\。?\ d+)? - 可选序列匹配int/float号码
  • <代码> \]* - 零或更多] chars。

You can use

[^\s\[\]]*\[*\d*\.?\d+(?:\(\d*\.?\d+\+\d*\.?\d+\))?×(?:\d*\.?\d+)?\]*

See the regex demo.

Details:

  • [^\s\[\]]* - zero or more chars other than square brackets and whitespace
  • \[* - zero or more [ chars
  • \d*\.?\d+ - an int/float number
  • (?:\(\d*\.?\d+\+\d*\.?\d+\))? - an optional sequence of
    • \( - a ( char
    • \d*\.?\d+ - an int or float number
    • \+ - a + char
    • \d*\.?\d+ - an int or float number
    • \) - a ) char
  • × - a × char
  • (?:\d*\.?\d+)? - an optional sequence matching an int/float number
  • \]* - zero or more ] chars.

带有前缀的图案的正则

眼眸里的快感 2025-02-19 01:23:59

我发现首先调整数据可以更轻松地获取所需的绘图。我曾经使用过Seaborn,希望还可以。请查看此代码是否适合您。我认为上面提到的df已经可用。我创建了df2,以使其与您在预期数字中显示的内容保持一致。另外,我将索引用作X轴列,以便维护订单...一些调整以确保XTICK名称对齐,传说在您想要的外面。

代码

vals= []
conf = []
for x, y, z in zip(df.Actual, df.Predicted, df.Confidence):
    vals += [x, y]
    conf += [1, z]
df2 = pd.DataFrame({'Values': vals, 'Confidence':conf}).reset_index()
ax=sns.barplot(data = df2, x='index', y='Confidence', hue='Values',dodge=False)
ax.set_xticklabels(['Actual', 'Predicted']*4)
plt.legend(bbox_to_anchor=(1.0,1))
plt.show()

plot

“在此处输入图像说明”

更新 - 对实际和预测的bar

hi @mohammed 分组我认为没有一种方法可以轻松地使用Seaborn来做到这一点。您需要使用matplotlib并调整条位置,XTICK位置等。下面是将执行此操作的代码。您可以将SET1更改为另一个颜色地图以更改颜色。我还添加了一个黑色轮廓,因为相同的彩色条互相融合在一起。此外,我不得不旋转Xlables,因为它们彼此之间。您可以根据自己的要求更改它。希望这对...

vals = df[['Actual','Predicted']].melt(value_name='texts')['texts']
conf = [1]*4 + list(df.Confidence)
ident = ['Actual', 'Predicted']*4
df2 = pd.DataFrame({'Values': vals, 'Confidence':conf, 'Identifier':ident}).reset_index()

uvals, uind = np.unique(df2["Values"], return_inverse=1)
cmap = plt.cm.get_cmap("Set1")

fig, ax=plt.subplots()
l = len(df2)
pos = np.arange(0,l) % (l//2) + (np.arange(0,l)//(l//2)-1)*0.4
ax.bar(pos, df2["Confidence"], width=0.4, align="edge", ec="k",color=cmap(uind)  )  

handles=[plt.Rectangle((0,0),1,1, color=cmap(i), ec="k") for i in range(len(uvals))]
ax.legend(handles=handles, labels=list(uvals), prop ={'size':10}, loc=9, ncol=8) 

pos=pos+0.2
pos.sort()
ax.set_xticks(pos)

ax.set_xticklabels(df2["Identifier"][:l], rotation=45,ha='right', rotation_mode="anchor")
ax.set_ylim(0, 1.2)
plt.show()

输出图

”在此处输入图像说明”

I have found that adjusting the data first makes it easier to get the plot I want. I have used Seaborn, hope that is ok. Please see if this code works for you. I have considered that the df mentioned above is already available. I created df2 so that it aligns to what you had shown in the expected figure. Also, I used index as the X-axis column so that the order is maintained... Some adjustments to ensure xtick names align and the legend is outside as you wanted it.

Code

vals= []
conf = []
for x, y, z in zip(df.Actual, df.Predicted, df.Confidence):
    vals += [x, y]
    conf += [1, z]
df2 = pd.DataFrame({'Values': vals, 'Confidence':conf}).reset_index()
ax=sns.barplot(data = df2, x='index', y='Confidence', hue='Values',dodge=False)
ax.set_xticklabels(['Actual', 'Predicted']*4)
plt.legend(bbox_to_anchor=(1.0,1))
plt.show()

Plot

enter image description here

Update - grouping Actual and Predicted bars

Hi @Mohammed - As we have already used up hue, I don't think there is a way to do this easily with Seaborn. You would need to use matplotlib and adjust the bar position, xtick positions, etc. Below is the code that will do this. You can change SET1 to another color map to change colors. I have also added a black outline as the same colored bars were blending into one another. Further, I had to rotate the xlables, as they were on top of one another. You can change it as per your requirements. Hope this helps...

vals = df[['Actual','Predicted']].melt(value_name='texts')['texts']
conf = [1]*4 + list(df.Confidence)
ident = ['Actual', 'Predicted']*4
df2 = pd.DataFrame({'Values': vals, 'Confidence':conf, 'Identifier':ident}).reset_index()

uvals, uind = np.unique(df2["Values"], return_inverse=1)
cmap = plt.cm.get_cmap("Set1")

fig, ax=plt.subplots()
l = len(df2)
pos = np.arange(0,l) % (l//2) + (np.arange(0,l)//(l//2)-1)*0.4
ax.bar(pos, df2["Confidence"], width=0.4, align="edge", ec="k",color=cmap(uind)  )  

handles=[plt.Rectangle((0,0),1,1, color=cmap(i), ec="k") for i in range(len(uvals))]
ax.legend(handles=handles, labels=list(uvals), prop ={'size':10}, loc=9, ncol=8) 

pos=pos+0.2
pos.sort()
ax.set_xticks(pos)

ax.set_xticklabels(df2["Identifier"][:l], rotation=45,ha='right', rotation_mode="anchor")
ax.set_ylim(0, 1.2)
plt.show()

Output plot

enter image description here

曲线图在x轴中具有不同参数

眼眸里的快感 2025-02-18 13:43:44

http.send外,我认为没有任何内置可以允许您返回提供相同输入的不同数据。我很想知道! :)

为了回答您的问题,规则/功能在单个查询的范围中被缓存,因此不重新评估对同一规则/函数的多个调用。 http.send indentIn还允许您在查询中缓存结果,在请求很少更新的数据时,这可能非常有用。

说到http.send,这是一个非常有用的内置来测试这样的事物。只需启动本地网络服务器,例如python3 -m http.server,然后具有查询策略的策略:

package policy

my_func(x) {
    http.send({
        "method": "GET",
        "url": "http://localhost:8000",
    })
}

boo := my_func("x")
foo := my_func("x")

然后评估策略:

opa eval -f pretty -d policy.rego data.policy
{
  "boo": true,
  "foo": true
}

检查Web服务器的日志,您将仅看到一个尽管有两个规则呼叫my_func函数,但仍发送请求:

::1 - - [29/Jun/2022 19:27:01] "GET / HTTP/1.1" 200 -

Except for http.send, I don't think there are any builtins that would allow you to return different data provided the same input. I'd be curious to find out though! :)

To answer your question, a rule/function is cached in the scope of a single query, so multiple calls to the same rule/function won't be re-evaluated. The http.send builtin additionally allows you to cache results across queries, which can be very useful when requesting data which is rarely updated.

Speaking of http.send, it's a pretty useful builtin to test things like this. Just fire up a local webserver, e.g. python3 -m http.server and then have a policy that queries that:

package policy

my_func(x) {
    http.send({
        "method": "GET",
        "url": "http://localhost:8000",
    })
}

boo := my_func("x")
foo := my_func("x")

Then evaluate the policy:

opa eval -f pretty -d policy.rego data.policy
{
  "boo": true,
  "foo": true
}

Checking the logs of the web server, you'll see that only one request was sent despite two rules calling the my_func function:

::1 - - [29/Jun/2022 19:27:01] "GET / HTTP/1.1" 200 -

Rego功能调用是否记忆?

眼眸里的快感 2025-02-18 03:27:33

首先,让我们修复您对moments的排序方式:

moments.sort(key = lambda x: (x[0],x[1],x[2]))

使用此代码行,列表,momments将首先按小时,分钟,然后再排序。

但是,由于您的代码中的这个块,因此不必按几分钟和几秒钟进行排序:

while hours in hours_tracker:
    hours = random.randint(0, 23)

此块可防止我们在相同的小时中选择任何两次,因此,如果您想以这种方式保持它,我们可以按这样的方式进行分类:

moments.sort(key = lambda x: x[0])

但是,这意味着我们不需要“先检查时间,然后如果它们相同,则可以进入几分钟,如果不去几秒钟”,因为没有两次会有相同的小时。

无论如何,一旦我们对列表进行排序,首先,索引到哪个索引将有较早的时间:

编辑:

import random

n = 10
moments = []
hours_tracker = set()
for _ in range(n):
    hours = random.randint(0, 23)
    #if you want hours to possibly repeat comment out while loop:
    while hours in hours_tracker:
        hours = random.randint(0, 23)
    hours_tracker.add(hours)

    minutes = random.randint(0, 59)
    seconds = random.randint(0, 59)
    moments.append((hours, minutes, seconds))

for i in range(len(moments)):
   print(str(i) + ": " + str(moments[i]))

print()

t1 = int(input("What first time would you like to select? "))
t2 = int(input("What second time would you like to select? "))

#CHECKING FOR HOURS
if ((moments[t1])[0] < (moments[t2])[0]):
  print(str(moments[t1]) + " occurred before " + str(moments[t2]))
elif ((moments[t1])[0] > (moments[t2])[0]):
  print(str(moments[t2]) + " occurred before " + str(moments[t1]))

#if you want to check for minutes and seconds (in case hours are the same), uncomment the rest of this block:
# CHECKING FOR MINUTES
# else:
#   if ((moments[t1])[1] < (moments[t2])[1]):
#     print(str(moments[t1]) + " occurred before " + str(moments[t2]))
#   elif ((moments[t1])[1] > (moments[t2])[1]):
#     print(str(moments[t2]) + " occurred before " + str(moments[t1]))
#   CHECKING FOR SECONDS
#   else:
#     if ((moments[t1])[2] < (moments[t2])[2]):
#       print(str(moments[t1]) + " occurred before " + str(moments[t2]))
#     elif ((moments[t1])[2] > (moments[t2])[2]):
#       print(str(moments[t2]) + " occurred before " + str(moments[t1]))
#     else:
#       print("You chose two of the same moments :P")

在这里,我们首先检查t1的时间是否小于> t2的小时,反之亦然。如果您选择不重复小时,这就是必要的。

如果您想重复数小时,请删除您的时循环。在这种情况下,我们需要检查几分钟和几秒钟。如果小时相同,则我们检查几分钟,然后检查几秒钟。

编辑:

如果您希望用户在选择之前接收可能的选项,请在收到其输入之前输入以下代码行:

for i in range(len(moments)):
  print(str(i) + ": " + str(moments[i]))

print()

这将通过momments迭代,输出索引和相应的元素。

First, let's fix the way you sort moments:

moments.sort(key = lambda x: (x[0],x[1],x[2]))

With this line of code, the list, moments, will be sorted first by hours, minutes, then seconds.

However, it is unnecessary to sort by minutes and seconds because of this block in your code:

while hours in hours_tracker:
    hours = random.randint(0, 23)

This block prevents us from choosing any two times with the same hour, so if you want to keep it this way, we can just sort like this:

moments.sort(key = lambda x: x[0])

However, this means that we do not need to "check hours first then if they are the same to go to minutes and if not to go to seconds", since no two times will have the same hour.

Regardless, once we sort the list, whichever index comes first will have the earlier time:

EDIT:

import random

n = 10
moments = []
hours_tracker = set()
for _ in range(n):
    hours = random.randint(0, 23)
    #if you want hours to possibly repeat comment out while loop:
    while hours in hours_tracker:
        hours = random.randint(0, 23)
    hours_tracker.add(hours)

    minutes = random.randint(0, 59)
    seconds = random.randint(0, 59)
    moments.append((hours, minutes, seconds))

for i in range(len(moments)):
   print(str(i) + ": " + str(moments[i]))

print()

t1 = int(input("What first time would you like to select? "))
t2 = int(input("What second time would you like to select? "))

#CHECKING FOR HOURS
if ((moments[t1])[0] < (moments[t2])[0]):
  print(str(moments[t1]) + " occurred before " + str(moments[t2]))
elif ((moments[t1])[0] > (moments[t2])[0]):
  print(str(moments[t2]) + " occurred before " + str(moments[t1]))

#if you want to check for minutes and seconds (in case hours are the same), uncomment the rest of this block:
# CHECKING FOR MINUTES
# else:
#   if ((moments[t1])[1] < (moments[t2])[1]):
#     print(str(moments[t1]) + " occurred before " + str(moments[t2]))
#   elif ((moments[t1])[1] > (moments[t2])[1]):
#     print(str(moments[t2]) + " occurred before " + str(moments[t1]))
#   CHECKING FOR SECONDS
#   else:
#     if ((moments[t1])[2] < (moments[t2])[2]):
#       print(str(moments[t1]) + " occurred before " + str(moments[t2]))
#     elif ((moments[t1])[2] > (moments[t2])[2]):
#       print(str(moments[t2]) + " occurred before " + str(moments[t1]))
#     else:
#       print("You chose two of the same moments :P")

Here, we first check if the hours of t1 are smaller than that of t2, and vice versa. This is all that is necessary if you choose to have hours NOT repeat.

If you want to potentially have hours repeat, remove your while loop. In this case, we need to check for minutes and seconds. In the event that the hours are the same, we then check for minutes, and then for seconds.

EDIT:

If you want the user to receive the possible options before selecting, enter these lines of code before you receive their input:

for i in range(len(moments)):
  print(str(i) + ": " + str(moments[i]))

print()

This will iterate through moments, output the index, and the corresponding element.

我想在下面写的十个不同的时刻,我想选择其中两个。看看哪个发生了

眼眸里的快感 2025-02-18 01:09:49

您知道这并不是那么简单:

find ./ -executable

在我的PC上,我会得到以下结果:

./20211214/Logs/2021-02-13.log
./20211214/Logs/2021-02-14.log
./20211214/Logs/2021-02-15.log
./20211214/Logs/2021-02-16.log
./20211214/Logs/2021-02-17.log

...这并不奇怪:

ls -ltra 2021-02-17.log
 -rwxrwxrwx 1 usr usr 441793 Feb 26  2021./2021-02-17.log

您可以看到:一个具有扩展名的“*.log”的文件可以可执行。

It's really not that simple, you know:

find ./ -executable

On my PC, I get following results:

./20211214/Logs/2021-02-13.log
./20211214/Logs/2021-02-14.log
./20211214/Logs/2021-02-15.log
./20211214/Logs/2021-02-16.log
./20211214/Logs/2021-02-17.log

... which is not that surprising:

ls -ltra 2021-02-17.log
 -rwxrwxrwx 1 usr usr 441793 Feb 26  2021./2021-02-17.log

As you can see: a file with extension "*.log" can be executable.

查找所有可执行文件,然后使用bash复制(以及文件夹)到某些虚拟文件夹

眼眸里的快感 2025-02-17 09:54:19

基本方法是使用pyscript.write()。

<html>
    
    <head>
            
        <title>Pyscript - Test</title>
     
    <!-- Load required PyScript packages -->
        <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
        <script defer src="https://pyscript.net/alpha/pyscript.js"onerror=scriptLoadFailure('pyscr ipt.js')></script>

<py-env>
- pandas
</py-env>

    </head>
    
<!-- ------------------------------------------------------------------- -->
    <body>
        
<py-script>
import pandas as pd
def do_it():
    df = pd.DataFrame([[12, 14, 10, 11, 1], [22, 24, 20, 21, 0]])
    pyscript.write('output', df)
    pyscript.write('msg', 'That should be it')
do_it()
</py-script>
        <header id="header_top">Pyscript - Test</header>
        <div id="main1">
            <div id="output">
                Testing div with id="output" 
            </div>
            <div id="msg"></div>
        </div>
    </body>
<!-- ------------------------------------------------------------------- -->
</html>

加载前客的内容时
Pyscript-测试
带有ID =“输出”的测试div

加载完成后,输出div中有PANDAS DF,并且具有ID =“ MSG”的单独div中的其他文本
“应该就是这样” 提示...

The basic way is to use pyscript.write().

<html>
    
    <head>
            
        <title>Pyscript - Test</title>
     
    <!-- Load required PyScript packages -->
        <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
        <script defer src="https://pyscript.net/alpha/pyscript.js"onerror=scriptLoadFailure('pyscr ipt.js')></script>

<py-env>
- pandas
</py-env>

    </head>
    
<!-- ------------------------------------------------------------------- -->
    <body>
        
<py-script>
import pandas as pd
def do_it():
    df = pd.DataFrame([[12, 14, 10, 11, 1], [22, 24, 20, 21, 0]])
    pyscript.write('output', df)
    pyscript.write('msg', 'That should be it')
do_it()
</py-script>
        <header id="header_top">Pyscript - Test</header>
        <div id="main1">
            <div id="output">
                Testing div with id="output" 
            </div>
            <div id="msg"></div>
        </div>
    </body>
<!-- ------------------------------------------------------------------- -->
</html>

While loading the content of the paage is
Pyscript - Test
Testing div with id="output"

After loading has finished there is a pandas df in the output div and additional text in a separate div with id="msg"
"That should be it" Regards...
enter image description here

等到Pyscript软件包满载,然后修改DOM

眼眸里的快感 2025-02-17 08:00:07

不可能从链码内获得。我不确定无论如何您都会想到,因为不同的同行可能处于不同的高度,并且您会获得不同的认可结果,从而导致交易无效。

我建议将客户端查询此信息并将其传递到调用的链码中作为输入。

It is not possible to get from within chaincode. I'm not sure you would want to anyways, because different peers may be at different heights and you would get different endorsement results leading to an invalidation of your transaction.

I'd suggest to have client query this information and pass it into the invoked chaincode as an input.

如何在链码内部获得块哈希超级织物

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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