许仙没带伞

文章 评论 浏览 31

许仙没带伞 2025-02-20 23:00:19

在git中,文件没有具有历史记录。 Consits 历史记录,您可以通过选择一个或多个感兴趣的提交来过滤历史记录。

一种方法是说告诉我有关文件x更改的提交。也就是说,git一次查看每个提交,一次,git一直向后倾斜,git始终以:

  • commit 61892BB913DB3E9815914E062439364A333666A78 :在此提交中文件x更改吗? (在两个副本中提取parent and Commit并比较文件x)
  • 提交A9015FBB8599F2F67DA593F89634A728F04EB132 :File x Change x Change在此提交中是否更改? (提取父和提交和比较文件x是两份副本)

每当git遇到一个提交一个comm实例 - git log will display 该提交。

那不是“文件历史记录”,而是“过滤的提交历史记录”,就像 /a>不是Mona Lisa,它是Mona Lisa的图像。没有区别的区别?好吧,也许不是,因为...

git日志 - follow

使用 git log -follow -x ,您告诉 git log 它应该过滤历史记录,这是 git log -x 的方式,但是这次 应该检查是否包含对文件文件的更改文件的可能性是重命名 。如果文件被重命名,则 git log - follow 像之前一样打印提交,但是它停止寻找 x 并开始寻找 o 而不是其中 o 是文件的 old 名称。换句话说,序列中的每个测试现在都是 确实在此提交中更改o更改而不是 dik dik di file x更改此提交

这里有局限性。最大的两个是:

  • 这仅起作用“向后”。您必须知道文件的 new 名称,然后运行 git log -follow -new/path/to/file 实例。

  • 这仅适用于一个文件。

一个较小的(但仍然很大)的限制是,如果更改为 just 重命名,则重命名检测最有效。因此,最好是确保所有内容都持续下去,然后重命名文件,提交,然后进行任何其他更改,然后分别提交。 (如果您需要更改对命名文件的提交中的其他文件,那很好:这不会干扰重命名检测。 Java类文件必须具有与该文件中许多单词的拼写匹配的名称,因此,如果您重命名Java类,则必须将其分为一个重命名commit,以赢得' t构建,然后是一个更新提交解决该文件。它不仅是重命名,而是完全删除,并添加了一个新的和不同的文件。)

目前没有更好的选择。 git的未来版本可能有更好的方法来检测重命名,但是现在可以使用此方法。

In Git, files do not have history. Commits are history, and you can filter the history down by selecting one or more particular commits of interest.

One way to do that is to say tell me about commits in which file X changed. That is, Git looks at each commit, one at a time, backwards through time, the way Git always does:

  • commit 61892bb913db3e9815914e062439364a33366a78: did file X change in this commit? (Extract parent and commit and compare file X in the two copies)
  • commit a9015fbb8599f2f67da593f89634a728f04eb132: did file X change in this commit? (Extract parent and commit and compare file X is the two copies)

Whenever Git comes across a commit in which file X does change—that is, the parent's copy of X is different, or even missing entirely for instance—git log will display that commit.

That's not "file history", that's "filtered commit history", just as this isn't the Mona Lisa, it's an image of the Mona Lisa. A distinction without a difference? Well, maybe not, because ...

git log --follow

Using git log --follow -- X, you tell git log that it should filter history, the way it does for git log -- X, but this time, it should check to see if the change to the file file includes the possibility that the file was renamed. If the file was renamed, git log --follow prints the commit, just as it did earlier—but then it stops looking for X and starts looking for O instead where O is the old name of the file. In other words, each test in the sequence is now did file O change in this commit instead of did file X change in this commit.

There are limitations here. The two biggest are these:

  • This only works "backwards". You must know the new name of the file, and run git log --follow -- new/path/to/file for instance.

  • This only works for one file at a time.

A smaller (but still pretty big) limitation is that the rename detection works best if the change to the file is just the renaming. As such, it's probably best to make sure that everything is committed, then rename the file, commit that, then make any additional changes required, and commit that separately. (If you need to make changes to other files in the commit that renames the file, that's fine: that doesn't interfere with the rename detection at all. What I mean here is that, e.g., a Java class file has to have a name that matches the spelling of a lot of words in the file, so if you're renaming a Java class, you have to split it into one rename commit that won't build, followed by one update commit that fixes the file. If you use a single commit that both renames the class and fixes the file, it's possible that Git's rename detector will think that the file is so different that it wasn't merely renamed but rather deleted entirely, with a new and different file being added.)

There are no better options at this time. A future version of Git might have better ways to detect renames, but this method works now.

将带有历史记录的文件移动到同一存储库中的新文件夹,以便在移动文件中也可以看到旧提交

许仙没带伞 2025-02-20 22:38:56

循环,获取键字符串的首字母 0 ,并将其添加到整个密钥:

foreach($array as $k => $v) {
    $result[strtoupper($k[0])][$k] = $v;
}

Loop, get the first letter 0 of the key string and add to that with the whole key:

foreach($array as $k => $v) {
    $result[strtoupper($k[0])][$k] = $v;
}

小组数组数据由第一个字符并在每个组中创建子阵列

许仙没带伞 2025-02-20 09:21:10

我使用 data_files

data_files = [('', ['negar/data/untouchable.dat'])],

I used data_files

data_files = [('', ['negar/data/untouchable.dat'])],

将数据文件添加到Python Projects setup.py

许仙没带伞 2025-02-20 00:04:01

此调用中的第二个参数表达式

scanf("%s", *(*(p+x)+y));
            ^^^^^^^^^^^

具有 char 的类型,但由于使用了使用的转换规范器 s 该函数期望类型 char *的参数。结果,该程序的行为不确定。

要输入字符串,您只需要一个即可进行循环。

如果要通过字符输入字符而不是输入字符串,则循环可以使用指针来查看以下方式,

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    for ( char *item = *row; item != *row + sizeof( *row ); ++item )
    {
        scanf( " %c", item );
    }
}

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    for ( char *item = *row; item != *row + sizeof( *row ); ++item )
    {
        printf( "%c", *item );
    }
    putchar( '\n' );
}

请注意 scanf 的格式字符串中的领先空间,

scanf( " %c", item );
       ^^^^

它允许跳过白色空间字符为例如新行字符'\ n'

如果要在数组中输入字符串,则循环看起来像

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    scanf( "%19s", *row );
}

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
        printf( "%s\n", *row );
}

The second argument expression in this call

scanf("%s", *(*(p+x)+y));
            ^^^^^^^^^^^

has the type char but due to the used conversion specifier s the function expects an argument of the type char *. As a result the program has undefined behavior.

And to enter strings you need only one for loop.

If you want to enter character by character instead of entering a string then the loops can look the following way using pointers

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    for ( char *item = *row; item != *row + sizeof( *row ); ++item )
    {
        scanf( " %c", item );
    }
}

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    for ( char *item = *row; item != *row + sizeof( *row ); ++item )
    {
        printf( "%c", *item );
    }
    putchar( '\n' );
}

Pay attention to the leading space in the format string in the call of scanf

scanf( " %c", item );
       ^^^^

It allows to skip white space characters as for example the new line character '\n'.

If to enter strings in the array then the loops can look like

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
    scanf( "%19s", *row );
}

for ( char ( *row )[20] = p; row != p + 3; ++row )
{
        printf( "%s\n", *row );
}

我想使用指针和scanf填充2D阵列

许仙没带伞 2025-02-19 14:14:27

您可以使用谓词

try {
    // ...
} catch (e) {
    if (hasData(e)) {
        console.log(e.data);
    }
}

function hasData(object: unknown): object is { data: unknown } {
    return (typeof object === "object" && object?.hasOwnProperty("data")) ?? false
}

[游乐场] [2]

You can use a predicate !

try {
    // ...
} catch (e) {
    if (hasData(e)) {
        console.log(e.data);
    }
}

function hasData(object: unknown): object is { data: unknown } {
    return (typeof object === "object" && object?.hasOwnProperty("data")) ?? false
}

[Playground][2]

如何告诉Typescript“尝试catch”语句中的错误是包含特定属性的对象而无需使用“任何类型”?

许仙没带伞 2025-02-19 09:55:34

draggingEntered cormaldragoperation 是协议的方法 nsdraggingDestination 。如果类不采用协议,Swift不会调用协议方法。 AppDelegate 必须采用 nsdraggingDestination

extension AppDelegate: NSWindowDelegate {
}

extension AppDelegate: NSDraggingDestination {
    
    func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation{
        NSApplication.shared.activate(ignoringOtherApps: true )

        return .copy
    }
    
    func performDragOperation(_ sender: NSDraggingInfo) -> Bool{
        NSApplication.shared.activate(ignoringOtherApps: true )

        return true
    }
}

draggingEntered and performDragOperation are methods of protocol NSDraggingDestination. Swift doesn't call a protocol method if the class doesn't adopt the protocol. AppDelegate must adopt NSDraggingDestination.

extension AppDelegate: NSWindowDelegate {
}

extension AppDelegate: NSDraggingDestination {
    
    func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation{
        NSApplication.shared.activate(ignoringOtherApps: true )

        return .copy
    }
    
    func performDragOperation(_ sender: NSDraggingInfo) -> Bool{
        NSApplication.shared.activate(ignoringOtherApps: true )

        return true
    }
}

macos-drag string到nsstatusitem

许仙没带伞 2025-02-18 22:49:43

从file>设置>语言& fraceworks> dart,

  1. 复选框 - 启用对项目的飞镖支持,
  2. 指定-Dart SDK路径

From File>Settings>Languages&Frameworks>Dart,

  1. Check box - Enable Dart support for the project,
  2. Specify - Dart SDK path
    enter image description here

颤音:更换飞镖SDK

许仙没带伞 2025-02-18 20:06:58

如果性能或大数据框使用 通过重复行的几天差异,counter to_timedelta 和最后对删除重复的分类:

df['d_of_arr'] = pd.to_datetime(df['d_of_arr'])
df['d_of_sty'] = pd.to_datetime(df['d_of_sty'])

df = df.loc[df.index.repeat(df['d_of_sty'].sub(df['d_of_arr']).dt.days.add(1))]
df['dates'] = df['d_of_arr'].add(pd.to_timedelta(df.groupby(level=0).cumcount(), unit='d'))

df1 = df[['Id','dates']].sort_values(['Id','dates']).drop_duplicates(ignore_index=True)

或者如果小型dataframe或ynes thateframe或ynes cormapor note cormes 对于新行:

df['dates'] = [pd.date_range(s, e) for s, e in zip(df['d_of_arr'], df['d_of_sty'])]


df1 = (df.explode('dates')[['Id','dates']]
         .sort_values(['Id','dates'])
         .drop_duplicates(ignore_index=True))
print (df1)
   Id      dates
0   1 2021-12-03
1   1 2021-12-04
2   1 2021-12-05
3   1 2021-12-06
4   2 2021-12-09
5   2 2021-12-10
6   2 2021-12-11

If performance or large DataFrame use Index.repeat by difference by days for duplicate rows, add timedeltas by counter GroupBy.cumcount and to_timedelta and last sorting with remove duplicates:

df['d_of_arr'] = pd.to_datetime(df['d_of_arr'])
df['d_of_sty'] = pd.to_datetime(df['d_of_sty'])

df = df.loc[df.index.repeat(df['d_of_sty'].sub(df['d_of_arr']).dt.days.add(1))]
df['dates'] = df['d_of_arr'].add(pd.to_timedelta(df.groupby(level=0).cumcount(), unit='d'))

df1 = df[['Id','dates']].sort_values(['Id','dates']).drop_duplicates(ignore_index=True)

Or if small DataFrame or performance not important use list comprehension with DataFrame.explode for new rows:

df['dates'] = [pd.date_range(s, e) for s, e in zip(df['d_of_arr'], df['d_of_sty'])]


df1 = (df.explode('dates')[['Id','dates']]
         .sort_values(['Id','dates'])
         .drop_duplicates(ignore_index=True))
print (df1)
   Id      dates
0   1 2021-12-03
1   1 2021-12-04
2   1 2021-12-05
3   1 2021-12-06
4   2 2021-12-09
5   2 2021-12-10
6   2 2021-12-11

使用熊猫创建日期列

许仙没带伞 2025-02-17 13:11:01

在使用gameObject.find时检查是否找到东西。为此,您可能可以使用公共变量并将其设置为Inspector中的对象。

Check if something is found when you are using GameObject.Find. Insted of this you can probably use public variable and set reference to object in inspector.

当已经设置为禁用的对象时,如何设置Active?

许仙没带伞 2025-02-17 11:35:15

扩展@pirSquared的答案 62218881/how-to-to Transpose-a-specif-column-a-a-a-dataframe-a-dataframe and-group-by-python>问题10

问题10.1

dataframe:

d = data = {'A': {0: 1, 1: 1, 2: 1, 3: 2, 4: 2, 5: 3, 6: 5},
 'B': {0: 'a', 1: 'b', 2: 'c', 3: 'a', 4: 'b', 5: 'a', 6: 'c'}}
df = pd.DataFrame(d)

   A  B
0  1  a
1  1  b
2  1  c
3  2  a
4  2  b
5  3  a
6  5  c

output: output:output:

   0     1     2
A
1  a     b     c
2  a     b  None
3  a  None  None
5  c  None  None

使用 df.groupbybyby pd.series.tolist

t = df.groupby('A')['B'].apply(list)
out = pd.DataFrame(t.tolist(),index=t.index)
out
   0     1     2
A
1  a     b     c
2  a     b  None
3  a  None  None
5  c  None  None


使用代码> with

t = df.pivot_table(index='A',values='B',aggfunc=list).squeeze()
out = pd.DataFrame(t.tolist(),index=t.index)

To extend @piRSquared's answer another version of Question 10

Question 10.1

DataFrame:

d = data = {'A': {0: 1, 1: 1, 2: 1, 3: 2, 4: 2, 5: 3, 6: 5},
 'B': {0: 'a', 1: 'b', 2: 'c', 3: 'a', 4: 'b', 5: 'a', 6: 'c'}}
df = pd.DataFrame(d)

   A  B
0  1  a
1  1  b
2  1  c
3  2  a
4  2  b
5  3  a
6  5  c

Output:

   0     1     2
A
1  a     b     c
2  a     b  None
3  a  None  None
5  c  None  None

Using df.groupby and pd.Series.tolist

t = df.groupby('A')['B'].apply(list)
out = pd.DataFrame(t.tolist(),index=t.index)
out
   0     1     2
A
1  a     b     c
2  a     b  None
3  a  None  None
5  c  None  None

Or
A much better alternative using pd.pivot_table with df.squeeze.

t = df.pivot_table(index='A',values='B',aggfunc=list).squeeze()
out = pd.DataFrame(t.tolist(),index=t.index)

如何旋转数据框?

许仙没带伞 2025-02-17 04:08:55

打开您的Xcode项目和Info Info选项卡添加以下设置。

<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        
    </dict>
</dict>

它应该起作用。

Open your Xcode project and under info tab add these settings..

<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        
    </dict>
</dict>

It should work.

React -Native -ios-无法从Local主持那里获取数据

许仙没带伞 2025-02-16 21:04:41

注释(2022-10): Tolocaleformat 已弃用了一段时间,并从版本58开始就从Firefox中删除。请参见 tolocaleformat


我认为您只能使用非标准 date方法 tolocaleformat(formatstring)

格式:

    var today = new Date();
   today.toLocaleFormat('%d-%b-%Y'); // 30-Dec-2011
    

参考:

Note (2022-10): toLocaleFormat has been deprecated for some time and was removed from Firefox as of version 58. See toLocaleFormat

I think you can just use the non-standard Date method toLocaleFormat(formatString)

formatString: A format string in the same format expected by the strftime() function in C.

    var today = new Date();
   today.toLocaleFormat('%d-%b-%Y'); // 30-Dec-2011
    

References:

如何在JavaScript中格式化日期?

许仙没带伞 2025-02-16 13:28:13

unicodedata.normalize 在列表上不起作用,因此列举列表并转换每个单词:

import unicodedata as ud

words = '''âcre âge âgé arriéré arrière bronzé collé congrès coté côte côté crêpe
           crêpé cure curé dès différent diffèrent entré mémé même pâte pâté péché
           pêche pécher pêcher pécheur pêcheur prête prêté relâche relâché retraité
           sublimé vôtre'''.split()

for index, word in enumerate(words):
    words[index] = ''.join(c for c in ud.normalize('NFD', word) if ud.category(c) != 'Mn')

print(words)

输出:

['acre', 'age', 'age', 'arriere', 'arriere', 'bronze', 'colle', 'congres', 'cote', 'cote', 'cote', 'crepe', 'crepe', 'cure', 'cure', 'des', 'different', 'different', 'entre', 'meme', 'meme', 'pate', 'pate', 'peche', 'peche', 'pecher', 'pecher', 'pecheur', 'pecheur', 'prete', 'prete', 'relache', 'relache', 'retraite', 'sublime', 'votre']

unicodedata.normalize doesn't work on a list, so enumerate the list and convert each word:

import unicodedata as ud

words = '''âcre âge âgé arriéré arrière bronzé collé congrès coté côte côté crêpe
           crêpé cure curé dès différent diffèrent entré mémé même pâte pâté péché
           pêche pécher pêcher pécheur pêcheur prête prêté relâche relâché retraité
           sublimé vôtre'''.split()

for index, word in enumerate(words):
    words[index] = ''.join(c for c in ud.normalize('NFD', word) if ud.category(c) != 'Mn')

print(words)

Output:

['acre', 'age', 'age', 'arriere', 'arriere', 'bronze', 'colle', 'congres', 'cote', 'cote', 'cote', 'crepe', 'crepe', 'cure', 'cure', 'des', 'different', 'different', 'entre', 'meme', 'meme', 'pate', 'pate', 'peche', 'peche', 'pecher', 'pecher', 'pecheur', 'pecheur', 'prete', 'prete', 'relache', 'relache', 'retraite', 'sublime', 'votre']

python uncode在单词列表中正常化

许仙没带伞 2025-02-16 08:19:01

它对我来说很好(Ubuntu:20.04.4 LTS,VSCODE:1.68.0),应该以相同的方式用于Linux或Windows。 https://en.wikipedia.org/wikipedia.org/wiki/wiki/wiki/table_of_keykeyboard_shortcuts

当您按Alt时会发生什么?它可以选择菜单栏吗?

It works well for me (Ubuntu: 20.04.4 LTS, VSCode: 1.68.0) and it is supposed to work in the same way for Linux or Windows. https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts.

What happen when you press Alt? Can it select the menu bar?

VSCODE快捷方式要在Linux中选择菜单

许仙没带伞 2025-02-15 05:01:44

您可以在Spring-Boot项目中使用 OpenAPI规范(以前的Swagger Specification) ,在其中,您可以在其中定义API,并与 request/reverse/Response 标题以及任何错误模型,您可能需要返回或要捕获的任何其他自定义字段!

通过定义,您将有特权提及诸如所需,最小值,最大等属性。OpenAPI

插件将负责其余的事情!

转示!

您可以将这些链接 https://www.javainuse.com/spring/boot_swagger3

You can make use of OpenAPI specification (previously Swagger specification) in your Spring-boot project, where in , you define your APIs along with Request/Response headers as well as any error model you may want to return or any other custom field you want to capture!

By defining, you will have privilege of mentioning attributes such as required, minLength, maxLength etc

The openAPI plugin will take care of rest of the things!

You may refer these links to have a glance!

https://www.javainuse.com/spring/boot_swagger3

https://www.baeldung.com/spring-rest-openapi-documentation

将自定义请求标头添加到Spring Boot中的每个API

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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