枫以

文章 评论 浏览 28

枫以 2025-02-20 20:52:15

也许您可以使用递归电话,类似的话:

def myfor(x):
    x -= 1
    for i in project['tasks']:
        if x > 0:
            myfor(x)
        # whatever
        print (x)

x = 3
myfor(x)

Maybe you could use recursive call, something like this:

def myfor(x):
    x -= 1
    for i in project['tasks']:
        if x > 0:
            myfor(x)
        # whatever
        print (x)

x = 3
myfor(x)

我想知道如何自动化我的嵌套以循环

枫以 2025-02-20 13:12:30

请在Xcode 14 beta 3中运行该项目。在Beta 1中遇到了相同的问题,现在它对我工作正常。

Please run the project in Xcode 14 beta 3. Had the same issue in beta 1 and now it was working fine for me.

iOS 16焦点滤波器确实在设置中显示自定义过滤器

枫以 2025-02-20 12:29:43

对于那些想知道同步GEMS和Rubymine支持文件的按钮在哪里,您可以在Intellij Ultimate中找到它:

“

我很想将其作为评论中的评论,但看起来我无法在那里上传图像。

For those wondering where the button for Synchronize Gems and RubyMine support files is in IntelliJ Ultimate, you can find it here:

Synchronize gems in IntelliJ Ultimate

I would have loved to add this as a comment to the existing answer, but it looks like I cannot upload images there.

如何迫使红宝石重新安装它用于在偏远环境中调试的宝石

枫以 2025-02-20 00:42:08

您发布的代码将比较每个字符串的长度(以字符为单位)与整体数组的长度(元素数),因为 myArray.length.length 提供了数组中的元素数量,和“ String” .length 给出字符的数量。您必须执行的过程是记录第一个字符串的长度,并将该长度与数组中的每个字符串进行比较,以查看是否有任何不相同的长度。

在C#中:

string[] myArray = new String[] {"four", "char", "word"};
boolean allSameLength = true;
int firstLen = myArray[0].Length;

for (int i = 1; i < myArray.Length; i++)
{
   if (myArray[i].Length != firstLen)
   {
      allSameLength = false;
      break;
   }
}

此功能封装在PM100的响应中。 将确定数组中的元素是否通过逻辑测试,而 lambda operator测试要应用( s.length ==单词[0] .length )。

The code you have posted will compare the length of each string (in characters) to the length of the overall array (in number of elements), since myArray.Length givees the number of elements in an array, and "string".Length gives the number of characters. The process that you have to do is record the length of the first string, and compare that length to every string in the array to see if there are any which are not the same length.

In C#:

string[] myArray = new String[] {"four", "char", "word"};
boolean allSameLength = true;
int firstLen = myArray[0].Length;

for (int i = 1; i < myArray.Length; i++)
{
   if (myArray[i].Length != firstLen)
   {
      allSameLength = false;
      break;
   }
}

This functionality is encapsulated in pm100's response. .All() will determine whether ever element in an array passes a logical test, and the lambda operator is used to pass the logical test to apply (s.length==Words[0].Length).

如何测试数组中的所有字符串是否具有相同的长度

枫以 2025-02-19 23:28:44

好吧,我最终找到了解决方案。我使用动作而不是动作。 “ S”

Okay I found finally solution. I used action instead of actions. "S"

VUEX:NUXT JS中未知的动作类型

枫以 2025-02-19 21:22:50

似乎您并不真正想要过去三个月中的所有日期,但是您希望收藏中的所有项目 permdate 是某个日期范围内的日期。

鉴于您自己的方法,某个日期范围似乎是前两个月以及整个当月。即2022年7月5日,日期范围是5月和2022年6月的全部。

我认为您可以通过定义开始日期结束日期来简化您的方法 ,并将 permdate 值与这两个值进行比较。一种直接的方法可能是:

var today = DateTime.Today;

var startMonth = today.AddMonths(-2);
var endMonth = today.AddMonths(1);

var startDate = new DateTime(startMonth.Year, startMonth.Month, 1);
var endDate = new DateTime(endMonth.Year, endMonth.Month, 1);

然后,您可以在过滤中使用 startdate enddate :

var dt = payload_object.AttendancePermissionBO.permissionList
    .Where(x => 
        x.empNum == empNum &&
        x.permDate >= startDate &&
        x.permDate < endDate)
    .OrderBy(x => x.permDate)
    .ToList();

It seems like you do not really want all dates in the last three months, but you want all items in your collection where permDate is a date within some date range.

Given your own approach, that some date range seems to be the two previous months plus the entire current month. I.e. for 5th of July 2022, the date range is all of May, June and July 2022.

I think you can simplify your approach by defining a start date and an end date, and compare the permDate values with those two values. A straight-forward way of doing that could be:

var today = DateTime.Today;

var startMonth = today.AddMonths(-2);
var endMonth = today.AddMonths(1);

var startDate = new DateTime(startMonth.Year, startMonth.Month, 1);
var endDate = new DateTime(endMonth.Year, endMonth.Month, 1);

Then, you can use startDate and endDate in your filtering:

var dt = payload_object.AttendancePermissionBO.permissionList
    .Where(x => 
        x.empNum == empNum &&
        x.permDate >= startDate &&
        x.permDate < endDate)
    .OrderBy(x => x.permDate)
    .ToList();

在过去的X个月中如何获得所有日期

枫以 2025-02-19 21:18:15

Sklearn支持符号如 n_components = 0.95

sklearn supports notation like n_components = 0.95 in fact.

在进行管道过程时,建立95%的解释差异

枫以 2025-02-19 15:38:49

改编自一些来源 [1] [2] [3] (也 uservani ramesh r 的答案上述),我认为这也将使用较新的Android版本。我只在模拟器上对此进行了测试,因此,如果有人在物理设备上部署在方法论或任何问题上的任何缺陷,请随时提议编辑或澄清评论中的某些内容。

首先,我们创建一个专门确定信号强度的课程:

@file:Suppress("DEPRECATION") //<-- Otherwise You'll Probably Get Warnings For The Pre-"Android Snow Cone" Section
package com.example.YOUR_PROJECT_NAME_HERE

import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.telephony.CellInfo
import android.telephony.PhoneStateListener
import android.telephony.SignalStrength
import android.telephony.TelephonyManager
import androidx.core.app.ActivityCompat

class ClassSignalStrength (private val mvContext : Context) {
    private val mvTelephonyManager = mvContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
    private var mvTechnology = ""
    private var mvSignalStrengthDbm = 0 //<-- Initialize
    init {
        //Get Signal Strength Data (Pre-"Android Snow Cone")
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
                mvTelephonyManager.listen(object : PhoneStateListener() {
                    @Deprecated("Deprecated in Java")
                    override fun onSignalStrengthsChanged(mvSignalStrength: SignalStrength) {
                        super.onSignalStrengthsChanged(mvSignalStrength)
                        mvTechnology = if (mvSignalStrength.isGsm) "GSM" else "CDMA"
                        mvSignalStrengthDbm = if (mvTechnology == "GSM") {
                                                  2 * mvSignalStrength.gsmSignalStrength - 113 //Convert ASU To dBm
                                              } else {
                                                  mvSignalStrength.cdmaDbm //<-- Should Already Be Converted To dBm
                                              }
                    }
                }, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS)
            }
    }
    fun mmGetSignalStrength()
    {
        //Get Signal Strength
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
                //Get Signal Strength Data (Android Snow Cone+)
                //Note: The Following Requests An Up-To-Date Rundown Of The Cell Info
                if (ActivityCompat.checkSelfPermission(mvContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                    //Note: requestCellInfoUpdate()'s Updates Are Rate-Limited, Please Be Advised
                        mvTelephonyManager.requestCellInfoUpdate(mvContext.mainExecutor, object : TelephonyManager.CellInfoCallback() {
                            override fun onCellInfo(mvCellInfoList: MutableList<CellInfo>) {
                                mmParseSignalStrength(mvCellInfoList)
                            }
                        })
                }
            }
            else {
                //Alert User To The Status
                //(Explanation: Pre-"Android Snow Cone", The Listener (Which We Declared In The init Block) Should Already Be Updating This Info Automatically)
                    mmShowUser()
            }
    }
    private fun mmParseSignalStrength(mvCellInfoList : MutableList<CellInfo>)
    {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
        {
            //Find The Minimum Signal Strength Value Of All Returned Instances
                mvSignalStrengthDbm = 1000000 //<- Create A Large Value To Begin With So We Have A Point Of Reference For Choosing The Next Minimum
                for (mvCellInfo in mvCellInfoList) {
                    if (mvCellInfo.cellSignalStrength.dbm < mvSignalStrengthDbm) {
                        mvSignalStrengthDbm = mvCellInfo.cellSignalStrength.dbm
                        mvTechnology = mvCellInfo.javaClass.kotlin.toString()
                    }
                }
            //Alert User As To The Status
                mmShowUser()
        }
    }
    private fun mmShowUser()
    {
        //How's The Signal?
            val mvSignalQuality= if (mvSignalStrengthDbm < -120) {
                                    "Very Low"
                                 } else if (mvSignalStrengthDbm <= -100) {
                                    "Low"
                                 } else if (mvSignalStrengthDbm <= -90) {
                                    "Normal"
                                 } else if (mvSignalStrengthDbm < 0) {
                                    "Above Average"
                                 } else {
                                    "No Signal Information" //<-- This Condition Can Be Simulated By Turning On "Airplane Mode" In The Emulator, But Only For Snowcone+ (Pre-Snowcone, Emulators Do Seem To Change To Signal Strength 0 IFF The Emulator Is Cold Booted In Airplane Mode. Incidentally, dBm Of 0 Is Likewise Just About The Theoretical Asymptote Of Signal Strength, Hence Why We Consider Anything 0 Or Higher To Be The "No Information" State - Source: https://www.reddit.com/r/HomeNetworking/comments/17kq3nz/the_highest_possible_rssi_for_lte/)
                                 }
            println("Signal: $mvSignalStrengthDbm ($mvSignalQuality) [$mvTechnology]")
    }
}

其次,我们在需要时请求此信息:

private val mvClassSignalStrength = ClassSignalStrength(applicationContext)
…
mvClassSignalStrength.mmGetSignalStrength()

Adapted from a few sources [1] [2] [3] (also userVani and Ramesh R's answer above), here's an approach I think will also work on more recent versions of Android. I've only tested this on emulators, so if anyone sees any flaws in the methodology or any issues when deployed on a physical device, please don't hesitate to propose an edit or clarify something in the comments.

First, we create a class specifically for determining signal strength:

@file:Suppress("DEPRECATION") //<-- Otherwise You'll Probably Get Warnings For The Pre-"Android Snow Cone" Section
package com.example.YOUR_PROJECT_NAME_HERE

import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.telephony.CellInfo
import android.telephony.PhoneStateListener
import android.telephony.SignalStrength
import android.telephony.TelephonyManager
import androidx.core.app.ActivityCompat

class ClassSignalStrength (private val mvContext : Context) {
    private val mvTelephonyManager = mvContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
    private var mvTechnology = ""
    private var mvSignalStrengthDbm = 0 //<-- Initialize
    init {
        //Get Signal Strength Data (Pre-"Android Snow Cone")
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
                mvTelephonyManager.listen(object : PhoneStateListener() {
                    @Deprecated("Deprecated in Java")
                    override fun onSignalStrengthsChanged(mvSignalStrength: SignalStrength) {
                        super.onSignalStrengthsChanged(mvSignalStrength)
                        mvTechnology = if (mvSignalStrength.isGsm) "GSM" else "CDMA"
                        mvSignalStrengthDbm = if (mvTechnology == "GSM") {
                                                  2 * mvSignalStrength.gsmSignalStrength - 113 //Convert ASU To dBm
                                              } else {
                                                  mvSignalStrength.cdmaDbm //<-- Should Already Be Converted To dBm
                                              }
                    }
                }, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS)
            }
    }
    fun mmGetSignalStrength()
    {
        //Get Signal Strength
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
                //Get Signal Strength Data (Android Snow Cone+)
                //Note: The Following Requests An Up-To-Date Rundown Of The Cell Info
                if (ActivityCompat.checkSelfPermission(mvContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                    //Note: requestCellInfoUpdate()'s Updates Are Rate-Limited, Please Be Advised
                        mvTelephonyManager.requestCellInfoUpdate(mvContext.mainExecutor, object : TelephonyManager.CellInfoCallback() {
                            override fun onCellInfo(mvCellInfoList: MutableList<CellInfo>) {
                                mmParseSignalStrength(mvCellInfoList)
                            }
                        })
                }
            }
            else {
                //Alert User To The Status
                //(Explanation: Pre-"Android Snow Cone", The Listener (Which We Declared In The init Block) Should Already Be Updating This Info Automatically)
                    mmShowUser()
            }
    }
    private fun mmParseSignalStrength(mvCellInfoList : MutableList<CellInfo>)
    {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
        {
            //Find The Minimum Signal Strength Value Of All Returned Instances
                mvSignalStrengthDbm = 1000000 //<- Create A Large Value To Begin With So We Have A Point Of Reference For Choosing The Next Minimum
                for (mvCellInfo in mvCellInfoList) {
                    if (mvCellInfo.cellSignalStrength.dbm < mvSignalStrengthDbm) {
                        mvSignalStrengthDbm = mvCellInfo.cellSignalStrength.dbm
                        mvTechnology = mvCellInfo.javaClass.kotlin.toString()
                    }
                }
            //Alert User As To The Status
                mmShowUser()
        }
    }
    private fun mmShowUser()
    {
        //How's The Signal?
            val mvSignalQuality= if (mvSignalStrengthDbm < -120) {
                                    "Very Low"
                                 } else if (mvSignalStrengthDbm <= -100) {
                                    "Low"
                                 } else if (mvSignalStrengthDbm <= -90) {
                                    "Normal"
                                 } else if (mvSignalStrengthDbm < 0) {
                                    "Above Average"
                                 } else {
                                    "No Signal Information" //<-- This Condition Can Be Simulated By Turning On "Airplane Mode" In The Emulator, But Only For Snowcone+ (Pre-Snowcone, Emulators Do Seem To Change To Signal Strength 0 IFF The Emulator Is Cold Booted In Airplane Mode. Incidentally, dBm Of 0 Is Likewise Just About The Theoretical Asymptote Of Signal Strength, Hence Why We Consider Anything 0 Or Higher To Be The "No Information" State - Source: https://www.reddit.com/r/HomeNetworking/comments/17kq3nz/the_highest_possible_rssi_for_lte/)
                                 }
            println("Signal: $mvSignalStrengthDbm ($mvSignalQuality) [$mvTechnology]")
    }
}

Second, we request this info when needed:

private val mvClassSignalStrength = ClassSignalStrength(applicationContext)
…
mvClassSignalStrength.mmGetSignalStrength()

与Kotlin的Android网络信号

枫以 2025-02-19 14:21:20

将按钮的样式从“ plain ”更改为“ default ”,您将看到一个属性,可以在其中定义uibutton的阴影颜色。

Change the button's style from "Plain" to "Default" and you will see a property where you can define the shadow color of the UIButton.

Interface Builder options of Style "Default"

如何在Xcode 13 Inspector中设置Uibutton阴影颜色?

枫以 2025-02-19 02:31:58

您可以使用

df = df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True)
df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True, inplace=True)

熊猫测试:

import pandas as pd
df = pd.DataFrame({'urls':['https://pippo.it, https://pluto.it', 'http://blah.com'], 'urls2':['http://blah.net', 'https://pippo.it, https://pluto.it']})
df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True, inplace=True)

因此,如果初始数据帧看起来像

                                 urls                               urls2
0  https://pippo.it, https://pluto.it                     http://blah.net
1                     http://blah.com  https://pippo.it, https://pluto.it

输出将是:

               urls             urls2
0  https://pippo.it   http://blah.net
1   http://blah.com  https://pippo.it

inplace = true 直接将更改为数据框,则无需重新分配变量。

\ s*(?:,\ s*)

  • (?:,\ s*)? - 逗号的可选序列,然后零或更多whitespaces
  • https:// pluto \ .it - 字面 https://pluto.it 字符串
  • \ b - 一个单词边界(用于匹配 it ,但不 ITA it0 it _ 等)。 注意:如果要确保字符串结束,请使用 $ 。如果要确保只有在URL之后才能有一个空格或字符串的结尾,请使用(?!\ s)而不是 \ b

You can use

df = df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True)
df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True, inplace=True)

See a Pandas test:

import pandas as pd
df = pd.DataFrame({'urls':['https://pippo.it, https://pluto.it', 'http://blah.com'], 'urls2':['http://blah.net', 'https://pippo.it, https://pluto.it']})
df.replace(r"\s*(?:,\s*)?https://pluto\.it\b", "", regex=True, inplace=True)

So, if the initial dataframe looks like

                                 urls                               urls2
0  https://pippo.it, https://pluto.it                     http://blah.net
1                     http://blah.com  https://pippo.it, https://pluto.it

The output will be:

               urls             urls2
0  https://pippo.it   http://blah.net
1   http://blah.com  https://pippo.it

The inplace=True makes the changes directly to the dataframe, no need to reassign the variable.

The \s*(?:,\s*)?https://pluto\.it\b regex needs more attention:

  • \s* - zero or more whitespaces
  • (?:,\s*)? - an optional sequence of a comma and then zero or more whitespaces
  • https://pluto\.it - a literal https://pluto.it string
  • \b - a word boundary (used to match it but not ita, it0, it_ etc.). Note: If you want to make sure there is end of string, use $. If you want to make sure there can be a whitespace or end of string only after the URL, use (?!\S) instead of \b.

从数据框架中删除特定的URL

枫以 2025-02-18 23:14:57

使用效应是用于制作某种共同调整的React钩子

// 1. No dependency passed:
useEffect(() => {
  //Runs on every render
});
// 2. An empty array:
useEffect(() => {
  //Runs only on the first render
}, []);
// 3. Props or state values:
useEffect(() => {
  //Runs on the first render
  //And any time any dependency value changes
}, [prop, state]);

useEffect is a React hook used to make some kind of co-routines, it is triggered when it dependencies are updated or when the component is rendered

// 1. No dependency passed:
useEffect(() => {
  //Runs on every render
});
// 2. An empty array:
useEffect(() => {
  //Runs only on the first render
}, []);
// 3. Props or state values:
useEffect(() => {
  //Runs on the first render
  //And any time any dependency value changes
}, [prop, state]);

如何解决React Rerenderign问题

枫以 2025-02-18 19:45:37

从我这边,我必须从工作目录中删除所有现有的二进制文件,然后重新发布并将所有新的二进制文件复制到工作目录。
并停止并再次开始过程。
运行良好。 ^^

From my side, I must delete all existing binary files from Working Directory, then re-publish and copy all new binary files to Working Directory.
And stop and start the process again.
It's working well. ^^

代码=倾倒,单= ABRT尝试运行dotnet core应用程序作为ubuntu中的服务

枫以 2025-02-18 15:34:00

大多数类型都暴露了他们的“亚型”。
std :: map has key_type 示例例如。

(如果需要,您可以创建特征以提取模板参数,如果类型不提供此类 typedef )。

然后,您可能会对这些子类型使用约束,例如:

template <typename Map, Strategy Strategy = Strategy::Depth>
requires(Comparable<typename Map::key_type>
     && IsATransition<typename Map::mapped_type>)
class Machine
{
    // ...
};

Most types expose their "subtypes".
std::map has key_type and mapped_type for example.

(You can create traits to extract template parameter if needed BTW, if type doesn't provide such typedef).

Then you might use constraint on those sub-types, something like:

template <typename Map, Strategy Strategy = Strategy::Depth>
requires(Comparable<typename Map::key_type>
     && IsATransition<typename Map::mapped_type>)
class Machine
{
    // ...
};

模板中的嵌套概念类型

枫以 2025-02-18 15:07:37

也许请查看“显示和隐藏视图控制器”,其中解释了某些导航概念:

使用故事板时,您应该能够使用SEGUE从一个视图控制器导航到另一个视图控制器。

Maybe have a look at "Showing and Hiding View Controllers" where some navigation concepts are explained: https://developer.apple.com/documentation/uikit/view_controllers/showing_and_hiding_view_controllers

When using storyboards you should be able to use a segue to navigate from one view controller to another.

如何在uiviewController中创建一个uinavigation controll,以程序为快速

枫以 2025-02-17 17:23:39

因此,您实际的HTML代码中的空格(默认情况下)被解释为文本(尽管连续的多个白色空间确实被凝结成一个单一空间,就像这里发生的那样)。您可以说是这种情况,因为如果悬停在缝隙上,光标会更改为I光束,并且实际上可以选择该空间。


一种解决方案只是在您的两个 div 标签之间没有空格,例如,

</div>

<div>

另一个解决方案

</div><div>

就是使用

So, whitespace in your actual HTML code is (by default) interpreted as text (although multiple white space in a row does get condensed into one singular space, as is happening here). You can tell that this is the case, because if you hover over the gap your cursor changes to the I-beam, and you can actually select the space.


One solution would just be to have no whitespace between your two div tags, e.g.

</div>

<div>

would become

</div><div>

Another would be to lay out your divs using the css flexbox, which avoids this issue entirely (and still allows your HTML markup to look nice!)

如何摆脱盒子之间的空间?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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