V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  riceball  ›  全部回复第 2 页 / 共 3 页
回复总数  45
1  2  3  
77 天前
回复了 lerry 创建的主题 Linux 记一次 ZFS 存储池恢复实战
我的一点使用 ZFS 的❄️的教训:

1. 必须至少上 RegRAM,还有就是尽可能多的 RAM,至少要满足最小值,具体计算我忘记了,根据你组的磁盘总大小计算,尤其是你启用了 deduplication, 它严重依赖 RAM ,如果 RAM 有错误,写入就会错误!
2. 当 ZFS 快写满了,如果这时候仓库错误,恢复几乎不太可能,折腾几天,几乎进度不动。我的数据...
Good ,推荐基于这个弄: https://github.com/apify/crawlee easily Extract data for AI, LLMs. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. 并添加了自己的反屏蔽功能和类人指纹。

这个要单独分几块弄

1. 建立 UI 自动化脚本规范,要简单易懂,能很自然扩展到桌面应用,采用类自然语言,使得 LLM 更好理解
2. 开发 UI 自动化脚本引擎库
3. 设计 PPE 可编程提示词工程(引擎),目的是规范化提示词,使 AI 提示任务工程化,简单化,打通代码和 LLM 之间的 gap ,这个我在弄,目前部分开源: https://github.com/offline-ai/cli 目前进展是实现了类自然语言的结构化聊天消息,只实现了 js 可以像调普通函数一样调用 llm 提示词任务, 反过来 llm 提示词也可以调用任意 js 或其他 PPE. PPE 支持继承,import,export. 还没作广泛宣传,自我感觉完成度不高,仅在 Linux 上开发测试。有一两个应用例子. 提示词这块坑多,模型规模越小,坑越多。大模型也有坑,所以想通过规范化提示词避坑。
4. 引入 UI 自动化脚本引擎库,让 LLM 调用.
80 天前
回复了 kran 创建的主题 Java 你喜欢使用 Java 下的哪个 web 框架?
VertX 太底层!不过,如果你正在寻找一个能够快速开发高性能 Web 应用的框架,那 Play Framework 是一个极佳的选择。它支持 Java 和 Scala ,好像是从 3.0 开始用 scala 重写底层的,采用异步模型处理请求,非常适合构建高并发的应用。内置热部署功能让你在开发时可以即时看到代码改动的效果,极大地提高了开发效率。同时,简洁的路由配置、强大的表单处理机制和内置模板引擎都使得开发变得更加直观和高效。对于想要构建 RESTful API 的开发者来说,Play 提供了流畅的支持和工具。

sbt new playframework/play-java-seed.g8
82 天前
回复了 angrylid 创建的主题 NAS 24 岁,感觉到了玩 NAS 的年纪,求推荐。
供参考:DIY 自己的开源 NAS https://riceball.me/article/diy-cloud-computing-2/
应该是太贵,本地离线 llm 高端 pc 才带得动,小设备没戏。如果只是 online.所有的现在的伪智能音箱厂家只要后端改下服务接口就可以做到,只是服务而已,随时可以切换,也可以随时跑路,比如京东智能音箱
83 天前
回复了 freesun165 创建的主题 git 求助 git 自动 merge 丢代码
还是 Git 操作要有规范,这个彼此合并,左右互搏,啧啧,建议使用 Git flow 规范,有 git 插件支持: https://danielkummer.github.io/git-flow-cheatsheet/index.zh_CN.html
@drymonfidelia OnPointerUp 在最前面就是个错误顺序,放这里也一样,`Start OnPointerUp Awake OnPointerDown OnBeginDrag OnDrag OnEndDrag`。这个提示词思想是让它按事件发生的先后顺序来讲解,因此与你写在里面的顺序无关. 另外如果要让纠正名称错误,最好单独一个提示词,一次只让它做一件事也能提高成功率。
但说实话,我发现它在语法纠错上不是很好,尤其是漏字,可能是没有针对这块精调过。
提示词没有设计好,因为这个的确算小众知识,如果要激发出来,提示词是关键。

我的测试是,本地 7B 左右的 LLM 基本没戏,激发也没用,已经吃不准了,而 qwen2.5 则没戏,估计是一点都没有学过。
7B 左右只有 gemma9B 经过二次提醒,能搞对顺序。30b 左右的基本能一次搞定。

[PPE(Programable Prompt Engine)]( https://github.com/offline-ai/cli)提示词如下:

```yaml
---
parameters:
temperature: 0
---
system: |-
You are a helpful Unity programming expert in the world. You know the Unity knowledge very well. You are very careful and precise.
Think about the user's intention carefully and solve the problem step by step.
---
user: |-
Please tell me the order in which the following Unity events occur:
OnPointerUp Start Awake OnPointerDown OnBeginDrag OnDrag OnEndDrag
assistant: "[[AI]]"
```

`ai run unity.ai.yaml`的执行结果(gemma-27b):

```
user: Please tell me the order in which the following Unity events occur:
OnPointerUp Start Awake OnPointerDown OnBeginDrag OnDrag OnEndDrag


unity: Here's the order of those Unity events, along with a brief explanation of each:

1. **Awake:** This event is called once when the script instance is being loaded, before any Start functions are called.

2. **Start:** This event is called once at the beginning of the game, after all Awake functions have been called.

3. **OnPointerDown:** This event is triggered when the user starts pressing down on a UI element or a GameObject with a
Collider.

4. **OnBeginDrag:** This event is triggered when the user starts dragging the UI element or GameObject after pressing down.

5. **OnDrag:** This event is triggered continuously while the user is dragging the UI element or GameObject.

6. **OnPointerUp:** This event is triggered when the user releases the mouse button or touch input.

7. **OnEndDrag:** This event is triggered when the user finishes dragging the UI element or GameObject.

**Important Notes:**

* These events are typically used with UI elements or GameObjects that have colliders attached.
* The order can be slightly modified depending on specific user interactions and the setup of your UI or game.



Let me know if you have any other Unity event-related questions!
```

gemma9B 经过二次提醒的提示词:

```yaml
---
parameters:
temperature: 0
---
system: |-
You are a helpful Unity programming expert in the world. You know the Unity knowledge very well. You are very careful and precise.
Think about the user's intention carefully and solve the problem step by step.
---
user: |-
Please tell me the order in which the following Unity events occur:
OnPointerUp Start Awake OnPointerDown OnBeginDrag OnDrag OnEndDrag
assistant: "[[AI]]"
user: |-
Hint: Please think about OnPointerUp in Unity carefully.
assistant: "[[AI]]"
```

执行结果:

```
user: Please tell me the order in which the following Unity events occur:
OnPointerUp Start Awake OnPointerDown OnBeginDrag OnDrag OnEndDrag


unity: Here's the order in which those Unity events occur, along with a brief explanation of each:

1. **Awake:** This method is called once, when the script instance is being loaded. It's used to initialize variables and set up
initial conditions.

1. **Start:** This method is called once, after Awake, and before the first frame update. It's often used to perform setup tasks
that require access to the GameObject's components or other game objects.

1. **OnPointerDown:** This event is triggered when the user presses a mouse button or touches the screen over your GameObject.

2. **OnBeginDrag:** This event is triggered when the user starts dragging an object. This usually happens after `OnPointerDown`
and only if the object is set up to be draggable.

1. **OnDrag:** This event is triggered repeatedly while the user is dragging the object.

2. **OnEndDrag:** This event is triggered when the user releases the mouse button or lifts their finger from the screen, ending
the drag operation.

1. **OnPointerUp:** This event is triggered when the user releases the mouse button or lifts their finger from the screen. It
occurs after `OnEndDrag` if the drag operation was initiated.


**Important Notes:**

* The exact order of events can vary slightly depending on the specific Unity version and the context of the events.
* `OnPointerDown` and `OnPointerUp` are more general events that can occur for any interaction with the mouse or touch input.
`OnBeginDrag`, `OnDrag`, and `OnEndDrag` are specifically related to dragging operations.



Let me know if you have any other questions about Unity events or need further clarification!

user: Hint: Please think about OnPointerUp in Unity carefully.

unity: You're right, I need to be more careful about `OnPointerUp`.

While it's generally triggered when the user releases the mouse button or finger, it's not *always* directly after `OnEndDrag`.

Here's a more precise order, taking `OnPointerUp` into account:

1. **Awake:** Initialization of script variables.
2. **Start:** Setup tasks after Awake.
3. **OnPointerDown:** Mouse button pressed or touch initiated on the GameObject.
4. **OnBeginDrag:** Drag operation starts if the GameObject is set up for dragging.
5. **OnDrag:** Repeatedly triggered while dragging.
6. **OnPointerUp:** Triggered when the mouse button or finger is released.
* **Important:** This can happen *before* `OnEndDrag` if the user releases the button without completing the drag.

7. **OnEndDrag:** Triggered when the drag operation officially ends (usually after `OnPointerUp` if the drag was completed).



Let me know if you have any more questions!
```
275 天前
回复了 logictan89 创建的主题 奇思妙想 有没有基于 AI 的个人秘书?
啊,这些不都是别人家的秘书,这下老王又可以八卦了. 自己本地电脑跑开源 LLM 脑子不香么,
自架 LLM

* https://github.com/facebookresearch/fairseq/tree/main/examples/mms 可识别 4000 多种语言、错误率仅为 OpenAI 产品的一半
* https://github.com/google-research/multilingual-t5
2023-06-14 20:07:32 +08:00
回复了 QianyanSanren 创建的主题 程序员 现在个人开发游戏,推荐去学习哪种语言?
如果和 aurora4x 非常类似,那么可以考虑直接在现有开源项目上 fork 修改: https://github.com/Pulsar4xDevs/Pulsar4x
2023-06-14 19:45:15 +08:00
回复了 godleon 创建的主题 程序员 [讨论一个开源的想法] 针对 web 端,想做一个有交互的升级
是 web 端么? 如果只是浏览器访问,那么必然就 PWA 了,关于 PWA 可以使用资源的预缓存机制,google 提供的 Workbox 工具箱简化使用.

如果是跨平台的 JS 应用,那么要看你用的是啥了,react native? cordova? capacitor? flutter? 基本上都有热更新, 微软贡献的开源项目 code-push 不错

1. https://github.com/microsoft/react-native-code-push
2. https://github.com/microsoft/cordova-plugin-code-push
3. https://github.com/mapiacompany/capacitor-codepush
2023-06-14 09:03:33 +08:00
回复了 xiangpeng 创建的主题 Markdown 求推荐可以批量导入 Markdown 文件的知识库
支持 Markdown 格式的知识库一大堆, 各有用途, 不说清楚怎么用, 给谁用. 没法推荐. Markdown 格式,后端最好不要数据库, 直接 git 存储+静态站点生成, 如果是开发人员编辑使用:

1. VSCode 编辑器的使用者 [vscode-front-matter]( https://github.com/estruyf/vscode-front-matter):
![]( https://camo.githubusercontent.com/8e1975fcbcf06db2ff1b83c40e42f17d1bf4a15273637e69d36991343c0d500a/68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f666f7265737472792d64656d6f2f766964656f2f75706c6f61642f64755f31362c775f3730302c655f6c6f6f702f76313537313135393937342f74696e612d6865726f2d64656d6f2e676966)


2. [TinaCMS]( https://github.com/tinacms/tinacms) 基于 Git 后端的,一整套的可扩展的 headless 内容管理系统, 后端将 Git 上的 Markdown 文件生成 GraphQL API 进行查询. 前端 dashboard 用的 nextjs. 它的可视化编辑器比较强大,而且有意思, 使开发者和普通内容创作者能够无缝协作.
@chnwillliu 虽然 super 可以这样,但是实例方法不是这样用的,如果不需要`this`,那么应该定义为 static 方法或者函数.
### 请说出方法一中的问题和缺陷

> 首先,该函数只能在函数内部被调用,即在子类方法中使用 `getSuper(this)(...args)` 调用父类方法。如果在函数外部调用该函数,则无法获取到正确的调用者函数名。
>
> 其次,该函数只能用于访问父类方法,而不能用于访问父类属性。如果父类属性与子类属性同名,则无法通过该函数访问父类属性。
>
> 最后,该函数使用了 `arguments.callee.caller`,这是一个非标准的特性,在严格模式下可能会被禁用。

补充:函数表达式也不存在`arguments`, 而且目前 JS 几乎都是在严格模式下,所以该方案基本无用.

### 那么方法二中的问题和缺陷

> 该实现方式可以实现模拟 `super` 访问父类方法的功能,但是有一些问题和限制。
>
> 首先,该实现方式使用了 `Reflect.getPrototypeOf` 方法获取实例的原型对象。这种方式可以正确地获取实例的原型对象,但在一些特殊情况下可能会出现问题,比如当实例的原型链中存在 Proxy 对象时。
>
> 其次,该实现方式只能在子类方法内部调用 `getSuper` 函数,且需要手动传入父类方法名。这样就需要手动维护父类方法名,容易出现错误。
>
> 最后,该实现方式没有考虑多层继承的情况。如果子类的父类也继承自其他类,则可能无法正确地访问到最终的父类方法。


### 那么方法三呢


> 该实现方式可以实现模拟 `super` 访问父类方法的功能,但是也有一些问题和限制。
>
> 首先,该实现方式使用了 Proxy 对象来代理实例对象,以拦截属性的访问。这种方式可能会带来性能上的损失,特别是在大规模的应用中。
>
> 其次,该实现方式只能用于访问父类属性或方法,而不能用于访问父类的私有属性或方法。
>
> 最后,该实现方式可能会存在多层继承的情况。如果子类的父类也继承自其他类,则可能无法正确地访问到最终的父类方法。

补充: 当子类重载了该方法,那么该实现无法访问到父类方法,需要修改,总体来说 ChatGPT 想得过于复杂

### 最后,什么是多层继承的情况

多层继承是指一个子类从另一个子类继承,而这个子类又从其它父类继承。举例说明:

```javascript
class A {
m() {console.log('A')}
}
class B extends A {
m() {console.log('B'); getSuper(this).m()}
}
class C extends B {
m() {console.log('C'); getSuper(this).m()}
}

如果不支持多重继承,那么`B.prototype.m()`中`getSuper()`就会出错.
2023-03-14 20:45:25 +08:00
回复了 cheunghy 创建的主题 程序员 开源项目组织征集伙伴
@cheunghy No, Primsma 是静态生成 Schema 的技术,所以无法做到在运行时刻动态增加删除表和数据源. 它的实现是建立在 ORM 在设计阶段确定好的,如果需要 Upgrade 那么也是 Stop 后 migrate. 没有考虑 headless 动态内容的 CMS, 以及如今的低代码 Online 平台(需要在线增改表以及字段,甚至从第三方拉数据(动态增加 datasource).
2023-03-14 10:48:39 +08:00
回复了 yueji 创建的主题 程序员 现在安卓一键 Root 工具都没什么作用了
2023-03-14 10:41:23 +08:00
回复了 cheunghy 创建的主题 程序员 开源项目组织征集伙伴
stared, Prisma 的问题是无法运行时刻动态创建 datasource 和 model, 硬伤到现在都无法解决: https://github.com/prisma/prisma/issues/6442. what's about teo?
2023-02-14 15:01:00 +08:00
回复了 acbot 创建的主题 C++ 现在有比较好的 NAT 穿透(打洞)开源实现吗?
用于构建 P2P 网络的模块化网络堆栈和库(全): https://libp2p.io/
包括打洞协议
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1255 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms · UTC 23:41 · PVG 07:41 · LAX 16:41 · JFK 19:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.