林空鹿饮溪

文章 评论 浏览 27

林空鹿饮溪 2025-02-20 18:09:01

您需要将self作为参数添加到add_link()函数:

def add_link(self, data):
     if(self.Next == None):
          self.Next = node(data)
          newnode = self.Next
     else:
         newnode.Next = node(data)
         newnode = newnode.Next

You need to add self as an argument to the add_link() function:

def add_link(self, data):
     if(self.Next == None):
          self.Next = node(data)
          newnode = self.Next
     else:
         newnode.Next = node(data)
         newnode = newnode.Next

使用Python创建链接列表的错误

林空鹿饮溪 2025-02-20 02:44:00

好的,事实证明:

如果我检查行阵列的长度是否长度; 0它解决了问题。在Else语句中,我只需记录一个错误消息即可说该用户不存在。这看起来像这样:

if (!rows.length > 0) return res.status(400).send('User doensnt exist!');
const password = rows[0].password;
// Declaring the variable after I know it exists.

感谢@danblack的答案!

Ok it turns out:

If I check if the length of the rows Array > 0 it fixes the problem. In the else statement I can just log out an error message to say the user does not exist. This could look something like this:

if (!rows.length > 0) return res.status(400).send('User doensnt exist!');
const password = rows[0].password;
// Declaring the variable after I know it exists.

Thanks to @danblack for this answer!

检查MySQL中的价值存在

林空鹿饮溪 2025-02-20 01:32:23

您可以尝试的一件事是添加一些内容以在文件delete2.php中删除。

$ sql =“ delete from nametable”;您缺少应删除的数据。

delete中,您必须添加应删除的数据。

如果要删除所有内容,请尝试以下操作:

$sql = "DELETE * FROM nametable";

One thing you can try is to add something to delete in your file delete2.php.

$sql = "DELETE FROM nametable"; you are missing the data that should be deleted.

Between DELETE and FROM you have to add the data that should be deleted.

if you want to delete everything try this:

$sql = "DELETE * FROM nametable";

如何使用一个按钮从多个数据库删除记录

林空鹿饮溪 2025-02-19 23:23:51

-l <​​/code>对应于localforward关键字。

Host cassandra-khatkesh
  User ubuntu
  Hostname ip_addr2
  ProxyCommand ssh ubuntu@ip_addr -W %h:%p
  LocalForward port ip_addr3:port

请注意,本地和远程端点是单独指定的,而不是单个 delimited字符串。

-L corresponds to the LocalForward keyword.

Host cassandra-khatkesh
  User ubuntu
  Hostname ip_addr2
  ProxyCommand ssh ubuntu@ip_addr -W %h:%p
  LocalForward port ip_addr3:port

Note that the local and remote endpoints are specified separately, not as single :-delimited string.

为SSH命令创建一个配置文件

林空鹿饮溪 2025-02-19 14:54:33

实际上,您可以在“ barchartgroupdata”参数中设置“ barsspace”。

nofollow

noreferrer默认值
x的位置x在水平轴上
Barchtroddata的巴罗德列表是条线[]
barsspace,组的Barrods之间的空间第2
显示了Barrods的ToolTipIndicators索引,以在其顶部显示工具提示[]

Actually, you could set up "barsSpace" in the parameter of "BarChartGroupData".

Example from fl_chart

BarChartGroupData

PropNameDescriptiondefault value
xx position of the group on horizontal axisnull
barRodslist of BarChartRodData that are a bar line[]
barsSpacethe space between barRods of the group2
showingTooltipIndicatorsindexes of barRods to show the tooltip on top of them[]

如何使用fl_chart的barchartroddata

林空鹿饮溪 2025-02-19 06:20:52

您不能将状态导出到另一个组件中,您要么需要使用状态管理库,例如redux,要么创建使状态可用于所有其他组件的上下文

You can't export a state to another component you either need to use a state management library like redux or create a context which make the state available for all the other components

从动态导入的组件中导入变量

林空鹿饮溪 2025-02-19 02:26:49

对于em @poplectic的答案不起作用,所以我对其进行了调整。它仍然是自定义钩。

import {Theme, useTheme } from '@mui/material/styles' // or @mui/joy/styles
import useMediaQuery from "@mui/material/useMediaQuery";
import {Breakpoint} from "@mui/system";

/**
 * taken from https://material-ui.com/components/use-media-query/#migrating-from-withwidth
 *
 * Be careful using this hook. It only works because the number of
 * breakpoints in theme is static. It will break once you change the number of
 * breakpoints. See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
 */
type BreakpointOrNull = Breakpoint | null

export const useWidth = (): Breakpoint => {
    const theme: Theme = useTheme()
    const keys: readonly Breakpoint[] = [...theme.breakpoints.keys]
    console.log(keys);
    return (
        keys.reduce((output: BreakpointOrNull, key: Breakpoint) => {
            // eslint-disable-next-line react-hooks/rules-of-hooks
            const matches = useMediaQuery(theme.breakpoints.up(key))
            return matches ? key : output
        }, null) ?? 'xs'
    )
}

用法

const breakpoint = useWidth()

For em @Apoplectic's answer was not working so I adapted it. It is still a custom hook.

import {Theme, useTheme } from '@mui/material/styles' // or @mui/joy/styles
import useMediaQuery from "@mui/material/useMediaQuery";
import {Breakpoint} from "@mui/system";

/**
 * taken from https://material-ui.com/components/use-media-query/#migrating-from-withwidth
 *
 * Be careful using this hook. It only works because the number of
 * breakpoints in theme is static. It will break once you change the number of
 * breakpoints. See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
 */
type BreakpointOrNull = Breakpoint | null

export const useWidth = (): Breakpoint => {
    const theme: Theme = useTheme()
    const keys: readonly Breakpoint[] = [...theme.breakpoints.keys]
    console.log(keys);
    return (
        keys.reduce((output: BreakpointOrNull, key: Breakpoint) => {
            // eslint-disable-next-line react-hooks/rules-of-hooks
            const matches = useMediaQuery(theme.breakpoints.up(key))
            return matches ? key : output
        }, null) ?? 'xs'
    )
}

Usage

const breakpoint = useWidth()

获取当前材料UI断点名称

林空鹿饮溪 2025-02-18 20:44:00

您可以使用.NET的数据合同属性来自定义序列化,例如:

[DataContract]
public class MailgunWebhookListenerRequest : IReturn<string>
{
    [DataMember]
    public MailgunWebhookSignature Signature { get; set; }

    [DataMember(Name="event-data")]
    public List<Dictionary<string, string>> EventData { get; set; }
}

You can use .NET's DataContract attributes to customize serialization, e.g:

[DataContract]
public class MailgunWebhookListenerRequest : IReturn<string>
{
    [DataMember]
    public MailgunWebhookSignature Signature { get; set; }

    [DataMember(Name="event-data")]
    public List<Dictionary<string, string>> EventData { get; set; }
}

属性包含破折号的ServiceStack请求对象?

林空鹿饮溪 2025-02-18 14:25:36

使用实体框架6您可以执行以下之类的操作

创建模态类作为

Public class User
{
        public int Id { get; set; }
        public string fname { get; set; }
        public string lname { get; set; }
        public string username { get; set; }
}

执行RAW DQL SQL命令如下:

var userList = datacontext.Database.SqlQuery<User>(@"SELECT u.Id ,fname , lname ,username FROM dbo.Users").ToList<User>();

With Entity Framework 6 you can execute something like below

Create Modal Class as

Public class User
{
        public int Id { get; set; }
        public string fname { get; set; }
        public string lname { get; set; }
        public string username { get; set; }
}

Execute Raw DQL SQl command as below:

var userList = datacontext.Database.SqlQuery<User>(@"SELECT u.Id ,fname , lname ,username FROM dbo.Users").ToList<User>();

RAW SQL查询无DBSET-实体框架核心

林空鹿饮溪 2025-02-18 13:43:14

如果要检查重复并删除它们。首先,将每个元素转换为str然后在结束时使用set使用 ast.literal_eval ,然后将它们返回到原来如下:

lst = [('admin', '', {'type': 'telnet'}), ('admin', '', {'type': 'telnet'}), 
       ('admn', '', {'type': 'telnet'}), ('admn', '', {'type': 'telnet'}),
# --------^^^-----------------------------^^^ duplicated
       ('admin', '', {'typ': 'telnet'}),('admin', '', {'typ': 'telnet'})]
------------------------^^^----------------------------^^^ duplicated
import ast
list(map(ast.literal_eval, set(map(str,lst))))

输出:输出:

[('admin', '', {'type': 'telnet'}),
 ('admn', '', {'type': 'telnet'}),
 ('admin', '', {'typ': 'telnet'})]

If you want check duplicated and remove them. First, convert each element to str then use set at the end use ast.literal_eval and back them to original like below:

lst = [('admin', '', {'type': 'telnet'}), ('admin', '', {'type': 'telnet'}), 
       ('admn', '', {'type': 'telnet'}), ('admn', '', {'type': 'telnet'}),
# --------^^^-----------------------------^^^ duplicated
       ('admin', '', {'typ': 'telnet'}),('admin', '', {'typ': 'telnet'})]
------------------------^^^----------------------------^^^ duplicated
import ast
list(map(ast.literal_eval, set(map(str,lst))))

output:

[('admin', '', {'type': 'telnet'}),
 ('admn', '', {'type': 'telnet'}),
 ('admin', '', {'typ': 'telnet'})]

从dicts列表中删除重复项,例外?

林空鹿饮溪 2025-02-18 05:36:49

当您使用诸如sum或count之类的聚合函数并且不通过组指定组时,它将将所有行聚集在一起。诸如M.Merk之类的字段可能会在汇总的行之间有所不同任意价值。

听起来您打算将I.Bank,M.Merk 组成一个组,尽管您不在选定的字段中不包含银行。

When you use an aggregation function such as SUM or COUNT and you do not specify a GROUP BY, it will aggregate all rows together. Fields such as M.Merk that could vary between the rows being aggregated will have a value taken from an arbitrary one of the rows being aggregated, though modern versions of mysql default to an ONLY_FULL_GROUP_BY mode where selecting such a field will result in an error instead of an arbitrary value.

It sounds like you intend to have a GROUP BY I.Bank, M.Merk, though it is confusing that you don't include the bank in your selected fields.

mysql-拆分选择查询(其中in)分为两行

林空鹿饮溪 2025-02-18 02:09:04

您可以使用回调来检查每个时期的时间。

class TimeCallback(keras.callbacks.Callback):
    def on_train_begin(self, logs={}):
        self.times = []

    def on_epoch_begin(self, epoch, logs={}):
        self.epoch_time_start = time.time()

    def on_epoch_end(self, epoch, logs={}):
        self.times.append(time.time() - self.epoch_time_start)
        print(self.times[epoch])

然后将其作为回调将其传递到model.fit函数下面的功能如下

cb=TimeCallback()
model1.fit(x=train_batch,validation_data=valid_batch,epochs=10,verbose=2,callbacks=cb)

如下

Epoch 1/10
162.60295152664185
57/57 - 163s - loss: 38.3437 - accuracy: 0.5433 - val_loss: 7.4644 - val_accuracy: 0.5890 - 163s/epoch - 3s/step
Epoch 2/10
161.40023803710938
57/57 - 161s - loss: 3.3678 - accuracy: 0.6856 - val_loss: 3.4822 - val_accuracy: 0.6160 - 161s/epoch - 3s/step 

You can use Callbacks to check the time per each epoch.

class TimeCallback(keras.callbacks.Callback):
    def on_train_begin(self, logs={}):
        self.times = []

    def on_epoch_begin(self, epoch, logs={}):
        self.epoch_time_start = time.time()

    def on_epoch_end(self, epoch, logs={}):
        self.times.append(time.time() - self.epoch_time_start)
        print(self.times[epoch])

And then pass this as a callback to the model.fit function like below

cb=TimeCallback()
model1.fit(x=train_batch,validation_data=valid_batch,epochs=10,verbose=2,callbacks=cb)

The output will be as follows

Epoch 1/10
162.60295152664185
57/57 - 163s - loss: 38.3437 - accuracy: 0.5433 - val_loss: 7.4644 - val_accuracy: 0.5890 - 163s/epoch - 3s/step
Epoch 2/10
161.40023803710938
57/57 - 161s - loss: 3.3678 - accuracy: 0.6856 - val_loss: 3.4822 - val_accuracy: 0.6160 - 161s/epoch - 3s/step 

TensorFlow运行时间检测

林空鹿饮溪 2025-02-17 13:45:05

我终于能够解决这个问题。我使用的方法提供了在这里
必须在Pythonoperator内部执行另一个操作员(Bashoperator)。否则我将无法使用XCOM_PULL值准备SQL

I am finally able to solve the issue. I have used approach provided here.
Had to execute another operator (BashOperator) inside PythonOperator. Otherwise I wasnt able to prepare SQL using xcom_pull values

将气流XCOM的值插入BigQuery

林空鹿饮溪 2025-02-17 09:33:42
/// <summary>
/// Returns the call that occurred just before the "GetCallingMethod".
/// </summary>
public static string GetCallingMethod()
{
   return GetCallingMethod("GetCallingMethod");
}

/// <summary>
/// Returns the call that occurred just before the the method specified.
/// </summary>
/// <param name="MethodAfter">The named method to see what happened just before it was called. (case sensitive)</param>
/// <returns>The method name.</returns>
public static string GetCallingMethod(string MethodAfter)
{
   string str = "";
   try
   {
      StackTrace st = new StackTrace();
      StackFrame[] frames = st.GetFrames();
      for (int i = 0; i < st.FrameCount - 1; i++)
      {
         if (frames[i].GetMethod().Name.Equals(MethodAfter))
         {
            if (!frames[i + 1].GetMethod().Name.Equals(MethodAfter)) // ignores overloaded methods.
            {
               str = frames[i + 1].GetMethod().ReflectedType.FullName + "." + frames[i + 1].GetMethod().Name;
               break;
            }
         }
      }
   }
   catch (Exception) { ; }
   return str;
}
/// <summary>
/// Returns the call that occurred just before the "GetCallingMethod".
/// </summary>
public static string GetCallingMethod()
{
   return GetCallingMethod("GetCallingMethod");
}

/// <summary>
/// Returns the call that occurred just before the the method specified.
/// </summary>
/// <param name="MethodAfter">The named method to see what happened just before it was called. (case sensitive)</param>
/// <returns>The method name.</returns>
public static string GetCallingMethod(string MethodAfter)
{
   string str = "";
   try
   {
      StackTrace st = new StackTrace();
      StackFrame[] frames = st.GetFrames();
      for (int i = 0; i < st.FrameCount - 1; i++)
      {
         if (frames[i].GetMethod().Name.Equals(MethodAfter))
         {
            if (!frames[i + 1].GetMethod().Name.Equals(MethodAfter)) // ignores overloaded methods.
            {
               str = frames[i + 1].GetMethod().ReflectedType.FullName + "." + frames[i + 1].GetMethod().Name;
               break;
            }
         }
      }
   }
   catch (Exception) { ; }
   return str;
}

如何找到称为当前方法的方法?

林空鹿饮溪 2025-02-17 06:42:56

我通过还原启动音量并从中创建新实例来解决此问题。我使用相同的SSH公共密钥创建了新实例,并且与旧实例完全相同。这项工作的原因是,在对主目录许可进行这些更改之前,我得到了备份。

I solved this by restoring a backup of my boot volume and creating a new instance from it. I created the new instance with the same SSH public key and it worked exactly the same as the old one. The reason that this worked is that I had a backup from before I made those changes to the home directory permissions.

`修改我的服务器上的用户后,拒绝(publicKey)`

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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