chillwind 最近的时间轴更新
chillwind

chillwind

V2EX 第 152281 号会员,加入于 2015-12-21 12:00:14 +08:00
gpt4 又开始报错误 Something went wrong 了?
OpenAI  •  chillwind  •  173 天前  •  最后回复来自 daishuge
2
碰到个非常奇怪的问题, mvn 启动不了了
Java  •  chillwind  •  2023-11-05 21:29:36 PM  •  最后回复来自 szq8014
3
像滴答清单这种提醒弹框是怎么实现的?
Android  •  chillwind  •  2022-07-02 16:46:34 PM  •  最后回复来自 antinads
6
iOS Core Graphics 画圆角矩形的问题
  •  1   
    iDev  •  chillwind  •  2020-10-26 19:18:36 PM  •  最后回复来自 ysc3839
    1
    一段 object c 代码想转 Swift ,有什么方法吗?
    macOS  •  chillwind  •  2020-08-29 13:17:41 PM  •  最后回复来自 zyc199847
    5
    android 小组件的问题?
    Android  •  chillwind  •  2020-08-11 23:04:57 PM
    chillwind 最近回复了
    @ml1344677 我的还是不行,有个请求浏览器控制台有报错 ,搞不清楚什么原因 password?state=hKFo2SBLbG5ERXlobmEwSnFPQ2hXM0dPcnU0aEM5XzBSU3dobKFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIEZ5aTdrUkhaSm9GdFYzRDJTQnNsZ25OTXZ4c0U2TFM3o2NpZNkgVGRKSWNiZTE2V29USHROOTVueXl3aDVFNHlPbzZJdEc:642 GET https://chatgpt.com/backend-api/sentinel/sdk.js net::ERR_BLOCKED_BY_RESPONSE.NotSameOrigin 403
    @ml1344677 是的,登录按钮无法点击。我一般用无痕模式,之前登录的窗口发不了消息
    192 天前
    回复了 KotoLyly 创建的主题 OpenAI chatgpt 付费账号无法响应
    @AiBoy 怎么处理的?被这个问题困扰好多天了
    同搬瓦工,会话一次就要刷新一次
    2021-07-29 10:44:43 +08:00
    回复了 zw1234 创建的主题 奇思妙想 [搞个副业]临期商品百亿风口,就差一个程序员了
    @zw1234 求拉 base64 Y2hpbGx3aW5kdGFu
    2021-01-13 10:04:00 +08:00
    回复了 chillwind 创建的主题 Android 像滴答清单这种提醒弹框是怎么实现的?
    @vone 应该不是,切换完其他 app 这个悬浮窗应该会消失。而且没有给 SYSTEM_ALERT_WINDOW 权限
    2020-08-28 15:16:06 +08:00
    回复了 chillwind 创建的主题 macOS 一段 object c 代码想转 Swift ,有什么方法吗?
    看了半天 swift,自己人肉转了一个。用的不对的地方,还请各位指正
    ```
    import Foundation
    import CommonCrypto

    struct AES {

    // MARK: - Value
    // MARK: Private
    private let key: Data
    // MARK: - Initialzier
    init?(key: String) {
    guard key.count == kCCKeySizeAES128 || key.count == kCCKeySizeAES256, let keyData = key.data(using: .utf8) else {
    debugPrint("Error: Failed to set a key.")
    return nil
    }


    self.key = keyData

    }


    // MARK: - Function
    // MARK: Public
    func encrypt(string: String) -> Data? {

    let iv = randomGenerateBytes(count: 16)!

    let cryptData = crypt(data: string.data(using: .utf8), iv: iv, option: CCOperation(kCCEncrypt))!

    var hmac = Data(count: 32)
    cryptData.withUnsafeBytes { v in
    hmac.withUnsafeMutableBytes { res in
    key.withUnsafeBytes { k in
    CCHmac(CCHmacAlgorithm(kCCHmacAlgSHA256), k.baseAddress!, key.count, v.baseAddress!, cryptData.count, res.baseAddress!)
    }
    }
    }

    let messageData = NSMutableData()
    messageData.append(iv)
    messageData.append(cryptData)
    messageData.append(hmac)

    return messageData as Data
    }

    func decrypt(data: Data) -> String? {
    //验证数据
    let ivByteData = data.subdata(in: 0..<16)

    let contentByteData = data.subdata(in: 16..<(data.count - 32))

    let serverHmacData = data.subdata(in: (data.count - 32)..<data.count)
    print(data.count)


    var hmac = Data(count: 32)
    contentByteData.withUnsafeBytes { v in
    hmac.withUnsafeMutableBytes { res in
    key.withUnsafeBytes { k in
    CCHmac(CCHmacAlgorithm(kCCHmacAlgSHA256), k.baseAddress!, key.count, v.baseAddress!, contentByteData.count, res.baseAddress!)
    }
    }
    }

    if (serverHmacData == hmac) {
    let decryptedData = crypt(data: contentByteData, iv: ivByteData, option: CCOperation(kCCDecrypt))
    return String(bytes: decryptedData!, encoding: .utf8)
    } else {
    print("HMac 不一致")
    return nil;
    }


    }

    func crypt(data: Data?, iv: Data, option: CCOperation) -> Data? {
    guard let data = data else { return nil }

    let cryptLength = data.count + kCCBlockSizeAES128*2
    var cryptData = Data(count: cryptLength)

    let keyLength = key.count
    let options = CCOptions(kCCOptionPKCS7Padding)

    var bytesLength = Int(0)

    let status = cryptData.withUnsafeMutableBytes { cryptBytes in
    data.withUnsafeBytes { dataBytes in
    iv.withUnsafeBytes { ivBytes in
    key.withUnsafeBytes { keyBytes in
    CCCrypt(option, CCAlgorithm(kCCAlgorithmAES128), options, keyBytes.baseAddress, keyLength, ivBytes.baseAddress, dataBytes.baseAddress, data.count, cryptBytes.baseAddress, cryptLength, &bytesLength)
    }
    }
    }
    }

    guard UInt32(status) == UInt32(kCCSuccess) else {
    debugPrint("Error: Failed to crypt data. Status \(status)")
    return nil
    }

    cryptData.removeSubrange(bytesLength..<cryptData.count)

    return cryptData
    }


    func randomGenerateBytes(count: Int) -> Data? {
    let bytes = UnsafeMutableRawPointer.allocate(byteCount: count, alignment: 1)
    defer { bytes.deallocate() }
    let status = CCRandomGenerateBytes(bytes, count)
    guard status == kCCSuccess else { return nil }
    return Data(bytes: bytes, count: count)
    }
    }

    ```
    @DeweyReed 今天试了一下 paging + room,通过 onZeroItemsLoaded 初始化数据,onItemAtEndLoaded 拉取后面的数据,测试基本功能可用,但是 onItemAtFrontLoaded 数据会有问题,onItemAtFrontLoaded 开始就会执行,而且 RecyclerView 定位到 onItemAtFrontLoaded 的第一条数据,而不是 onZeroItemsLoaded 的第一条数据。不知道是不是我对 PagedList.BoundaryCallback 理解不对,还是有别的方法?
    @DeweyReed 用 paging 刷新时也会卡一下的,感觉是靠 SCROLL_STATE_IDLE 触发的加载数据,没有 onScrolled 里做的加载顺滑
    在 AppTheme 里加了个配置 <item name="android:fontFamily">miui</item> 在小米手机上实现了跟微信一样的效果
    但是在华为手机上会崩溃。xml 文件里似乎是不能判断机型,全局字体有没有办法可以通过代码配置?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   959 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 21:31 · PVG 05:31 · LAX 13:31 · JFK 16:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.