encounter2017

encounter2017

V2EX 第 409290 号会员,加入于 2019-05-06 11:39:40 +08:00
今日活跃度排名 25578
encounter2017 最近回复了
16 天前
回复了 MeikoZh 创建的主题 程序员 Manus AI 是否真的像宣传的那么回事?
@Yosomi 你要是觉得肯德基的炸鸡香,那麦当劳的薯条肯定脆;
你要是觉得肯德基炸鸡糊了,麦当劳的薯条也必须是软的。
20 天前
回复了 rainmen 创建的主题 程序员 manus 没人关注吗?咋看
说一个偏题事情,你们还记得之前所谓的 ai 程序员 ai devin, 感觉宣传上面有点异曲同工之妙
33 天前
回复了 NianBroken 创建的主题 程序员 你认为目前最强的免费 AI 是什么?
是吧 > 失败
33 天前
回复了 NianBroken 创建的主题 程序员 你认为目前最强的免费 AI 是什么?
听楼上这么多人推荐 grok3 ,试了下提问:
输入:
帮我统计 github 上面仓库中使用 tab / spaces 来缩进的数据,要求按照编程语言分类,每一种编程语言需要统计 tab / 2 spaces / 4 spaces / 其他 这么几种情况的百分比,输出对应的表格

Think 模式:请求是吧
DeepSearch 模式: 经过一堆搜索后结果如下,发现它在瞎编

部分内容如下:
以下是按编程语言分类的缩进风格百分比表,基于上述假设:
Language Tab (%) 2 Spaces (%) 4 Spaces (%) Other (%)
Python 1 0 99 0
Java 1 0 99 0
JavaScript 1 99 0 0
C/C++ 3 0 97 0
HTML 1 99 0 0
CSS 1 99 0 0
Ruby 1 99 0 0
PHP 1 0 99 0
Go 1 0 99 0
Swift 1 0 99 0
Kotlin 1 0 99 0
Scala 1 99 0 0
Rust 1 0 99 0
C# 1 0 99 0
> 早些年都是喜欢用 tab 而不是 space 的
这个表述缺乏论据支持呀

http://ukupat.github.io/tabs-or-spaces/
一个比较老的统计,各个语言 tabs 和 spaces 的使用情况

对于某个语言来说,90% 以上使用的选项( 4 spaces, 2 spaces, tabs, 网站还统计了 3spaces 和 8 spaces 这里不与列出) 如下:

4 spaces:
- Python (1991 ,PEP8 官方规范, 混用的怕不是没挨过 inconsistent use of tabs and spaces in indentation 的毒打)
- Rust ( 2010, 社区约定 4 空格,工具链( rustfmt )默认支持。)

2 spaces:
- Crystal (2014, 继承 Ruby 风格)
- Pascal ( 1970 )
- Clojure (2007)
- Common Lisp (1984)
- Elicxir (2012)
- Ocaml (1996)
- Ruby (1995)
- Scala (2004)

tabs:
- Go ( 2009, 语言强制)
65 天前
回复了 bwijn 创建的主题 Python 关于 py 异步队列 异步支持选择问题
celery 不是个任务分发工具吗,主要还是看执行的任务耗时吧,它本身会成为性能瓶颈吗?
133 天前
回复了 jeckyhuang 创建的主题 程序员 AI 真的能代替程序猿吗?
@dfkjgklfdjg 还真能写,就是不知道实现起来有没有可能
https://chatgpt.com/share/67346f71-26d4-8003-8486-87d3813b0cf1
184 天前
回复了 wuhao1 创建的主题 MySQL 老生常谈 关于 子查询的应用
我觉得还是看业务场景,比如说我这里有一个业务场景就是需要查询树状结点下面的所有子节点信息,这种情况下用 recursive cte 查询就很方便,一次就能查完,IO 都在数据库做了,不然的话还得多次查询数据库.

一个简单的示例
```
CREATE TABLE binary_tree (
id INT PRIMARY KEY,
value VARCHAR(255),
parent_id INT,
FOREIGN KEY (parent_id) REFERENCES binary_tree(id)
);

INSERT INTO binary_tree (id, value, parent_id) VALUES
(1, 'Root', NULL),
(2, 'Left Child', 1),
(3, 'Right Child', 1),
(4, 'Left Grandchild', 2),
(5, 'Right Grandchild', 2),
(6, 'Another Left Grandchild', 3),
(7, 'Another Right Grandchild', 3);

WITH RECURSIVE tree_cte AS (
-- Base case: select the root node
SELECT id, value, parent_id, 0 AS level, CAST(id AS text) AS path
FROM binary_tree
WHERE parent_id IS NULL

UNION ALL

-- Recursive case: select child nodes
SELECT c.id, c.value, c.parent_id, p.level + 1, CONCAT(p.path, ',', CAST(c.id AS text))
FROM binary_tree c
JOIN tree_cte p ON c.parent_id = p.id
)
SELECT id, value, parent_id, level, path
FROM tree_cte
ORDER BY path;

1,Root,,0,1
2,Left Child,1,1,"1,2"
4,Left Grandchild,2,2,"1,2,4"
5,Right Grandchild,2,2,"1,2,5"
3,Right Child,1,1,"1,3"
6,Another Left Grandchild,3,2,"1,3,6"
7,Another Right Grandchild,3,2,"1,3,7"

```
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1194 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 23:10 · PVG 07:10 · LAX 16:10 · JFK 19:10
Developed with CodeLauncher
♥ Do have faith in what you're doing.