fuyufjh's recent timeline updates
fuyufjh's repos on GitHub
C++ · 203 watchers
GraphicBuffer
Use GraphicBuffer class from Android native code
Rust · 161 watchers
heygpt
A simple command-line interface for ChatGPT API written in Rust ⚡️
TypeScript · 38 watchers
mior
mior - Merge into one RSS
Java · 26 watchers
calculator
A simple calculator to demonstrate code gen technology
JavaScript · 25 watchers
ArkPets-Web
Go · 18 watchers
splunk-hec-go
Splunk HTTP Event Collector (HEC) Golang library
17 watchers
tensorflow-and-deep-learning-chinese
TensorFlow and deep learning without a PhD, translated to Chinese
TypeScript · 12 watchers
ArkPets-Chrome
明日方舟桌宠 Chrome 浏览器插件
Python · 7 watchers
chatgpt-toolbox
ChatGPT Toolbox based on Streamlit
C · 6 watchers
compiler-lab-nju
NJU Compiler Course Lab
2 watchers
go-scratch
Minimal Container Image for Go Binaries
JavaScript · 2 watchers
hexo-migrator-ghost
Ghost migrator for Hexo.
Java · 1 watchers
calcite-demo
1 watchers
galaxysql
PolarDB-X is a cloud native distributed SQL Database designed for high concurrency, massive storage, complex querying scenarios.
1 watchers
go-alpine
Minimal container image for Go binaries based on Alpine Linux
Java · 1 watchers
lynx
JavaScript · 1 watchers
n-blog
Multiuser blog system build with Express & MongoDB
0 watchers
acme.sh
A pure Unix shell script implementing ACME client protocol
CSS · 0 watchers
Affinity
Affinity is a clean, minimal, modern theme that focus on content for Ghost.
Python · 0 watchers
aiomysql
aiomysql is a library for accessing a MySQL database from the asyncio
Java · 0 watchers
aliyun-emapreduce-sdk
Hadoop/Spark on Aliyun, supporting interactions with Aliyun's base services.
Java · 0 watchers
aliyun-oss-java-sdk
Aliyun OSS SDK for Java
JavaScript · 0 watchers
automatically-set-milestone-to-issue
Java · 0 watchers
BrainControl
Python · 0 watchers
Brainwave_control_system
C++ · 0 watchers
BtQt
A simple Qt based BitTorrent client!
Python · 0 watchers
computer_use_ootb
An out-of-the-box (OOTB) version of Anthropic Claude Computer Use for Windows and macOS
TypeScript · 0 watchers
contextual-qa-checklist-action
Github action for filename-based QA checklists in PRs
Java · 0 watchers
CounselorAssistant
自动将NJU教务系统导出表格整理为学分表
Python · 0 watchers
dimensions
read the width, height, and rotation of images.
JavaScript · 0 watchers
dockerfiles
:whale: Dockerfiles
Python · 0 watchers
dotfiles
Backup my config
CSS · 0 watchers
DreamOnWeb
0 watchers
druid
阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
Go · 0 watchers
fasthttp
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
Java · 0 watchers
flink
Flink code for TPC-DS competition,forked from Apache Flink,and cherry pick some new feature.
JavaScript · 0 watchers
fuyufjh.github.io
Go · 0 watchers
go-aws-mon
put basic linux metrics to AWS CloudWatch with GoLang, fit for coreos and other small AMI Instance on AWS It is easy to kick up with cloud-init as system basic monitoring working with EC2 CloudWatch.
JavaScript · 0 watchers
hexo-renderer-marked
Markdown renderer for Hexo
0 watchers
juicefs
JuiceFS is a distributed POSIX file system built on top of Redis and S3.
C# · 0 watchers
Light-Switch
Easily switch from light to dark theme, or the other way around, in Windows 10/11.
Python · 0 watchers
loki_logging_handler
A logging handler that sends log messages to Loki with buffer
Python · 0 watchers
md2zhihu
convert markdown to zhihu compatible format.
Java · 0 watchers
meow-album
0 watchers
mintty-color-schemes
Some color schemes for MinTTY
C · 0 watchers
NanoOS
Simple UNIX running on X86
Java · 0 watchers
nju-data-mining-lab2
0 watchers
openraft
rust raft with improvements
Java · 0 watchers
pgjdbc
Postgresql JDBC Driver
0 watchers
PolarDB-for-PostgreSQL
A cloud-native database based on PostgreSQL developed by Alibaba Cloud.
0 watchers
postgres
Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see https://wiki.postgresql.org/wiki/Submitting_a_Patch
0 watchers
risingwave
RisingWave: the next-generation streaming database in the cloud.
Java · 0 watchers
rocketmq-externals
Mirror of Apache RocketMQ (Incubating)
Scala · 0 watchers
scala-impatient
My solutions for "Scala for the Impatient" exercises
TypeScript · 0 watchers
schema-registry-webui
Go · 0 watchers
shadowsocks-go
go port of shadowsocks
Racket · 0 watchers
sicp-exercises
JavaScript · 0 watchers
simple-gallery
Simple Gallery based on blueimp/Gallery
Scala · 0 watchers
spark
Mirror of Apache Spark
VimL · 0 watchers
spf13-vim
The ultimate vim distribution
Go · 0 watchers
splunk
Splunk Libraries in golang
Java · 0 watchers
splunk-sdk-java
Splunk Software Development Kit for Java
0 watchers
sqllogictest-rs
Sqllogictest (dialect with extensions) parser and runner in Rust.
CSS · 0 watchers
stackedit-css-chinese
CSS · 0 watchers
StayPuft
A fork of Casper, the default theme for Ghost
HCL · 0 watchers
tack
Terraform module for creating Kubernetes cluster running on CoreOS in an AWS VPC
Go · 0 watchers
tidb
TiDB is a distributed HTAP database compatible with the MySQL protocol
Python · 0 watchers
tiny-llm
A course of learning LLM inference serving on Apple Silicon for systems engineers: build a tiny vLLM + Qwen.
0 watchers
TokenBucket
Lock-free implementation of the token bucket algorithm in C++
0 watchers
type-exercise-in-rust
Learn Rust black magics by implementing basic types in database systems
Rust · 0 watchers
typos
Source code spell checker
Go · 0 watchers
vultr
:penguin: Vultr CLI and API client library
fuyufjh

fuyufjh

🏢  Dev
V2EX member #96093, joined on 2015-02-06 16:50:28 +08:00
Per fuyufjh's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
fuyufjh's recent replies
May 29
Replied to a topic by wweir 云计算 对联通云的信任,彻底没了
你还真用啊.jpg
遇到了同样的问题。。
这俩都是给 IDC 自建用户设计的…… “云数据库”至少也应该是 RDS / Aurora / PolarDB / Neon 这样的线上服务吧
搞艺术的想象力都很丰富吧?但凡认识一个女程序员都不会写下这么小众的文字
Jun 1, 2024
Replied to a topic by EVJohn iPhone 看 15/15pro 的价格很心动啊,买 15 还是等 16
16 (非 Pro ) 会上 8GB 内存,比 15 多了 2GB
Apr 17, 2024
Replied to a topic by utop1a 程序员 请教一个数据库或代码的唯一性设计问题
忍不住直接丢给 GPT-4 了,以下是它的回答:

你的需求是实现一个层级配置功能,其中层级关系由三个字段( a, b, c )定义,并且需要确保配置的数据项在同一层级上不重复。根据你的描述,这里是一个典型的树形结构,其中 a 是第一层,b 是第二层,c 是第三层。

为了解决你目前面临的问题,可以考虑以下几个设计思路:

### 1. 使用路径枚举模型( Materialized Path )

在这种模型中,你可以为每个节点存储一个路径字符串,该字符串反映了从根到该节点的完整路径。例如:

- "1" -> "1/"
- "1,2" -> "1/2/"
- "1,2,3" -> "1/2/3/"

在查询时,你可以使用路径来检查是否存在重复的层级配置。例如,要检查是否存在与"1/2/3/"相同或更高层级的配置,只需要查询路径以"1/2/3/"开头的记录。

### 2. 使用左右值模型( Nested Set )

这种模型适用于存储层级数据,每个节点都有一个左值和一个右值,通过这两个值可以快速查询节点的子节点和父节点。但是,这种模型在插入和删除操作时需要更新大量记录,可能不适合频繁变动的配置。

### 3. 使用 Adjacency List 模型并增加唯一性约束

这是最简单的层级数据模型,每个节点都有一个指向父节点的外键。在你的情况下,可以在表中添加唯一性约束来确保同一层级的配置不会重复。

例如,你可以在数据库表中创建一个唯一索引:

```sql
CREATE UNIQUE INDEX idx_unique_config ON t(a, b, c);
```

这样,数据库将自动保证不会插入重复的层级配置。

### 4. 使用闭包表模型( Closure Table )

闭包表存储每个节点与其每个祖先之间的关系。这种模型查询快速,但是需要维护一个额外的表来存储关系。

### 5. 使用触发器或应用层逻辑

你可以在数据库层使用触发器来阻止违反层级规则的数据插入,或者在应用层实现逻辑来确保数据的一致性。

### 结合你的需求

你的需求似乎最适合使用路径枚举模型,因为它可以很容易地通过字符串比较来检查层级关系。你可以这样设计:

1. 在表中添加一个额外的字段,比如 `path`。
2. 当插入新记录时,根据 a, b, c 的值生成路径字符串。
3. 使用这个路径字符串来检查是否有重复的层级配置。

例如:

```sql
-- 假设你要插入新记录
SET @new_a = '1';
SET @new_b = '2';
SET @new_c = NULL;

-- 生成路径字符串
SET @new_path = CONCAT_WS('/', @new_a, IFNULL(@new_b, ''), IFNULL(@new_c, ''));

-- 检查是否存在重复的层级配置
SELECT COUNT(*)
FROM t
WHERE path = @new_path OR path LIKE CONCAT(@new_path, '/%');

-- 如果计数为 0 ,则可以插入新记录
```

这种方法可以避免你当前面临的问题,并且可以很容易地扩展到更多层级。
Apr 16, 2024
Replied to a topic by OliverDD 程序员 对数据库感兴趣,但完全接受不了 cpp
看看大数据,Spark 、Hive 、Trino 这些,语言以 JVM 系的为主,查询路径上的知识差不多太多,存储、事务之类的被大幅简化了
Nov 27, 2023
Replied to a topic by V2asker 浏览器 下面哪款浏览器更安全?
chrome 套皮能列出 100 个 😄
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2681 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 19ms · UTC 13:46 · PVG 21:46 · LAX 06:46 · JFK 09:46
♥ Do have faith in what you're doing.