小编kit*_*une的帖子

无法在 Apple Silicon 上安装 lightgbm==3.3.3

这里是 的完整日志pip3 install lightgbm==3.3.3

\n
me % pip3 install lightgbm==3.3.3\nCollecting lightgbm==3.3.3\n  Using cached lightgbm-3.3.3.tar.gz (1.5 MB)\n  Preparing metadata (setup.py) ... done\nRequirement already satisfied: wheel in /opt/homebrew/lib/python3.10/site-packages (from lightgbm==3.3.3) (0.37.1)\nCollecting numpy\n  Using cached numpy-1.23.5-cp310-cp310-macosx_11_0_arm64.whl (13.4 MB)\nCollecting scipy\n  Using cached scipy-1.9.3-cp310-cp310-macosx_12_0_arm64.whl (28.5 MB)\nCollecting scikit-learn!=0.22.0\n  Downloading scikit_learn-1.1.3-cp310-cp310-macosx_12_0_arm64.whl (7.7 MB)\n     \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 7.7/7.7 MB 4.7 MB/s eta 0:00:00\nCollecting threadpoolctl>=2.0.0\n  Downloading threadpoolctl-3.1.0-py3-none-any.whl (14 kB)\nCollecting joblib>=1.0.0\n  Using cached joblib-1.2.0-py3-none-any.whl (297 kB)\nBuilding wheels for collected packages: lightgbm\n  Building wheel for lightgbm (setup.py) ... error\n  error: subprocess-exited-with-error\n …
Run Code Online (Sandbox Code Playgroud)

python numpy pip apple-silicon

12
推荐指数
1
解决办法
1万
查看次数

在 React Native 中使用 Jail Monkey 检查设备是否越狱/植根失败模块为“未定义”

在 React Native 中,我找到了两个插件来检查设备(iOS/Android)是否越狱/root:

  1. 监狱猴子
  2. react-native-is-device-rooted

我首先尝试了 npm 包react-native-is-device-rooted但它不起作用,而且似乎已经过时了。所以我尝试了 Jail Monkey,但出现以下错误:

在此处输入图片说明

代码是:

import JailMonkey from 'jail-monkey'

export default class Welcome extends Component {
    render() {
        return (
                ...
                <View style={styles.lowerView}>
                    <CustomButton text={"Jail Monkey"} onPress={() => this.printJailMonkey()}/>
                </View>
                ...
        );
    }

    printJailMonkey = () => {
        console.log("Jail Monkey library content: " + JailMonkey.isJailBroken())
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经仔细检查了包的手动链接(使用 Xcode、pod install 等......)。没有任何效果,有人可以帮助我吗?

jailbreak package.json react-native

5
推荐指数
1
解决办法
2656
查看次数

如何在将 Android 应用程序置于后台之前更改视图?

我有一个带有两个视图的应用程序,只有当应用程序处于活动状态(前台)时才必须显示蓝色视图,而当应用程序置于后台时(例如在 Android 上的硬件方形按钮上计时),必须显示绿色视图。

在此处输入图片说明

下图显示了当我将应用程序置于后台状态时当前得到的结果:

在此处输入图片说明

以下是当 App 置于后台时我想做的事情(在 iOS 上工作,在 Android 上不太好):

在此处输入图片说明

这就是实现。

请暂时忽略 iOS 的组件与 Android 的组件几乎相同,除了 View 的样式。我正在用不同的组件进行其他测试,目前我可以让它们保持这样。两个组件(iOS / Android)的区别在于样式,因为在iOS中是zIndex有效的,而在Android中我必须使用elevation重叠视图。

const showSecurityScreenFromAppState = appState =>
    ['background', 'inactive'].includes(appState);

const withSecurityScreenIOS = Wrapped => {
    return class WithSecurityScreen extends React.Component {
        constructor(props) {
            super(props);
        }

        state = {
            showSecurityScreen: showSecurityScreenFromAppState(AppState.currentState),
        };

        componentDidMount() {
            AppState.addEventListener('change', this.onChangeAppState);
        }

        componentWillUnmount() {
            AppState.removeEventListener('change', this.onChangeAppState);
        }

        onChangeAppState = nextAppState => {
            const showSecurityScreen = showSecurityScreenFromAppState(nextAppState);

            this.setState({showSecurityScreen});
        };

        //this.state.showSecurityScreen
        render() {
            return ( …
Run Code Online (Sandbox Code Playgroud)

android android-recents react-native react-native-android

5
推荐指数
1
解决办法
663
查看次数

据称随机获得“无权向这些 tmID 发送消息”HMS 推送服务

固定服务器端

注意:这是一个服务器端错误,现在似乎已解决。我们的移动应用程序代码保持不变。


我必须使用 HMS 推送服务才能使我的 RN 应用程序适用于华为 EMUI 设备:HMS Core

我按照所有必需的步骤在服务器和移动应用程序上安装和配置 HMS。

但是......我注意到一个奇怪的行为。我使用网页上的按钮将推送通知从服务器发送到移动应用程序。我确保在我的华为 ID 上启用了 Push Kit,并且 Push Device Token 是正确的。

有时会发送通知,有时不会。我一整天都在寻找原因,但现在看来完全是偶然的,至少直到找不到原因为止。

请注意,下面的代码中的mc.send()每一个时期进入.then(),从不提出的.catch()

有时我会得到:OK {"code":"80000000","msg":"Success","requestId":"161832746491754926000107"}通知实际上是从移动应用程序收到的(一切都很好!)。

有时(而且经常): OK {"code":"80300002","msg":"No permission to send message to these tmIDs","requestId":"161832753512250325000107"}

最后,我不断收到:OK {"code":"80000000","msg":"Success","requestId":"161832795126307445060711"}但是......该应用程序实际上没有收到通知。

我尝试重新启动服务器,将应用程序保持在三个不同的状态(关闭、前台、后台),但没有任何帮助我找到问题。

这是我用来发送通知的代码的最后一个版本(我更改了很多次):

function sendPushNotificationHMS(pushDeviceToken, data, attempt){
  hcm.init({
      appId: configHMS.AppId,
      appSecret: configHMS.AppSecret,
      authUrl: configHMS.AuthUrl,
      pushUrl: configHMS.PushUrl
  });
  let mc = hcm.messaging().messaging;

  let androidConfig = {
      collapse_key: -1,
      urgency:"HIGH",
      ttl: "10000s",
      bi_tag: …
Run Code Online (Sandbox Code Playgroud)

android push-notification node.js react-native huawei-mobile-services

5
推荐指数
1
解决办法
92
查看次数

HMS+GMS设备上的HMS推送通知问题

我在也有 GMS 的三星设备上遇到了有关 HMS 的问题。

华为通知有两种类型:

  1. 数据消息 (DM)
  2. 通知消息 (NM)

华为设备(仅限HMS)

NM如果我们发送 NM,那么推送会以任何状态(关闭、后台和前台)到达应用程序,但它们不会被自动处理......它必须是推杆,我想由应用程序处理。这似乎是 HMS 强加的限制。现在这可能没问题。

DM如果我们发送 DM,那么推送可以由 App 自动处理,但只有当 App 的状态为前台(自动处理)或后台时,它们才会到达 App。如果应用程序处于关闭状态,则不会收到它们(没有声音,没有气泡,...)。但这暂时不是错误问题。

非华为设备(HMS + GMS),例如三星 A10

NM仅与上面的 HMS 相同,只是它们没有以任何方式进行处理。这是个大问题……我们需要把NM的payload传给App。??

DM如果我们发送 DM,不好......推送通知甚至不会被处理,只有当应用程序的状态是前台或后台时它们才会到达应用程序。如果应用程序处于关闭状态,则不会收到它们(没有声音,没有气泡,...)。这个问题可能是 HMS Core 配置错误的问题……但没有说。??

我们已经注册了广告日志(下图,经过HMSSDK过滤):

05-05 15:38:19.130  4452  4688 D SDHMS:s : SIOP:: AP:270(293,30) BAT:261(261,0) CHG:0(0,0) USB:0(0,0) 
05-05 15:38:24.045   551 16859 I PushLog3203_HMS: [SocketRead_15:36:31-2319]process cmdid to receive from pushSrv:44(:277)
05-05 15:38:24.050   551 16859 I PushLog3203_HMS: [SocketRead_15:36:31-2319]dispatchIntent over(:277)
05-05 15:38:24.051   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]enter …
Run Code Online (Sandbox Code Playgroud)

android push-notification samsung-mobile huawei-mobile-services huawei-developers

5
推荐指数
1
解决办法
348
查看次数

在Mac OS X上使用命令find扩展POSIX实用程序?

我尝试在Mac OS X 10.9终端上执行此命令:

find / -type f -regextype posix-extended -regex "(.*A.*a.*.*)|(.*a.*A.*.*)" -exec tail -n 3 '{}' \;
Run Code Online (Sandbox Code Playgroud)

但Bash v 3.2的回应是:

find: -regextype: unknown primary or operator
Run Code Online (Sandbox Code Playgroud)

我在终端联机页面上进行了深入搜索:

man find

man regex
Run Code Online (Sandbox Code Playgroud)

等等...

但我一无所获.是否应该更新Mac OS X Bash v3.2?似乎"-regextype"选项不包含在"find"中.

我该如何解决?

ps该命令在Ubuntu Linux 14上运行完美.

regex macos bash terminal find

4
推荐指数
1
解决办法
2125
查看次数

什么是"wc"命令的行为?

例如:

myCleanVar=$( wc -l < myFile )
myDirtVar=$( wc -l myFile )

echo $myCleanVar
9

echo $myDirtVar
9 myFile
Run Code Online (Sandbox Code Playgroud)

为什么在"myCleanVar"中我从"wc"命令得到一个"整数"值,而在"myDirtVar"中我得到的结果如下:"9 file.txt"?我引用了"整数"因为知道在Bash shell中默认情况下都被视为一个字符串,但无法理解第一个和第二个表达式的行为差异.在这种情况下,重定向"<"的特殊效果是什么?

bash fileparsing io-redirection wc

3
推荐指数
2
解决办法
1417
查看次数

AttributeError:模块“http.server”没有属性“ThreadingHTTPServer”

我正在尝试Python3文档页面上关于HTTP服务器的代码。

网站上发布的代码是:

def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
    server_address = ('', 8000)
    httpd = server_class(server_address, handler_class)
    httpd.serve_forever()
Run Code Online (Sandbox Code Playgroud)

这段代码正在运行。我想尝试ThreadingHTTPServer所以,正如文档所说:

此类 ( ThreadingHTTPServer ) 与 HTTPServer 相同,但通过 ThreadingMixIn 使用线程来处理请求。这对于处理 Web 浏览器预打开套接字非常有用,HTTPServer 将在该套接字上无限期地等待。

所以,我将上面的代码更改为:

def run(server_class=http.server.ThreadingHTTPServer, handler_class=http.server.BaseHTTPRequestHandler$
    PORT = 8000
    server_address = ('', PORT)
    httpd = server_class(server_address, handler_class)
    print("server running on port: ", PORT)
    httpd.serve_forever()
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

Traceback (most recent call last):
  File "simple_http_server.py", line 6, in <module>
    def run(server_class=http.server.ThreadingHTTPServer, handler_class=http.server.BaseHTTPRequestHandler):
AttributeError: module 'http.server' has no attribute 'ThreadingHTTPServer'
Run Code Online (Sandbox Code Playgroud)

我想补充一点,我最近才使用Python,所以我可能错过了一些东西。

您认为错误的原因是什么?我哪里做错了?

python httpserver python-3.x

2
推荐指数
1
解决办法
5420
查看次数

强制模式仅在Y轴Unity3D上工作

我正在学习如何使用Unity3D.

我有这个场景,其中元素是两个PNG图像(两个黑色圆圈),我已将其与Rigidbody属性相关联(没有重力).

在此输入图像描述

在此输入图像描述

使用脚本我将水平轴的控制器关联起来并且它可以工作:我可以用键盘控制中心圆.

现在我试图联想一个恒定的力量.我的脚本如下.但它只能沿Y轴工作.我不能使它沿水平轴工作.

该脚本是:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CircleController : MonoBehaviour {

    float MaxSpeed = 10f;
    Rigidbody rigid2D;
    public Vector3 tensor;

    // Use this for initialization
    void Start()
    {
        rigid2D = GetComponent<Rigidbody>();
        rigid2D.AddForce(new Vector3(0,10,0), ForceMode.Force);
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        float move = Input.GetAxis("Horizontal");
        rigid2D.velocity = new Vector2(move * MaxSpeed, rigid2D.velocity.y);
    }
}
Run Code Online (Sandbox Code Playgroud)

有人能帮助我理解为什么我不能沿着这条轴施加力吗?

特别是,当我用这条指令执行脚本时:rigid2D.AddForce(new Vector3(0,10,0), ForceMode.Force);我看到中心圆向另一个方向移动.这是正确的.

在此输入图像描述

相反,当我用这个指令执行它时,rigid2D.AddForce(new Vector3(10,0,0), ForceMode.Force);中心圆保持静止.

c# unity-game-engine

1
推荐指数
1
解决办法
330
查看次数

是否以 JSON 格式存储 SVG 图像?

我不知道我是否在正确的“堆栈”中询问,但目前我似乎是最合适的。还请注意,如果我错了,我会立即将问题转移到另一个堆栈。

我需要保存矢量图像(很可能是 SVG 格式)。我们正在考虑如何记住这个图像。关键是我们更喜欢只使用 JSON 文件,这意味着你必须将 SVG 图像至少转换为 Base54,但它是否无损?

另一种方法是将此 SVG 图像的本地路径保存在 JSON 文件的字段中。该图像和 JSON 文件不应通过网络发送,并且考虑到 PC 环境,从 Bas64 到 SVG 的转换不应太慢。根据您的经验,您建议做什么?

base64 svg json jq

1
推荐指数
1
解决办法
2万
查看次数

Possible bug in Unity3D?

显然,在 Unity3D 更新后,我无法再从一个场景切换到另一个场景。我不知道这是否是由于更新造成的问题,但目前,当我单击一个应该将我送回另一个场景的按钮时,我收到此错误。

ArgumentException: method return type is incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:190)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:276)
UnityEngineInternal.NetFxCoreExtensions.CreateDelegate (System.Reflection.MethodInfo self, System.Type delegateType, System.Object target) (at /Users/builduser/buildslave/unity/build/Runtime/Export/WinRT/NetFxCoreExtensions.cs:11)
UnityEngine.Events.InvokableCall..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:149)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:447)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:610)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:776)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:812)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler …
Run Code Online (Sandbox Code Playgroud)

c# debugging error-handling unity-game-engine

1
推荐指数
1
解决办法
1085
查看次数