跳到主要内容

· 阅读需 8 分钟

I am currently using Writerside, a new Integrated Development Environment (IDE) designed for technical writers, to create and develop the documentation website for my side project, PingCAP Docsite Preview. Throughout my experience with Writerside, I discovered an undocumented feature: a feedback module. I have utilized Cloudflare Pages Functions and TiDB Cloud Data Service to process the feedback received through this module and store it in the database.

This guide provides step-by-step instructions for integrating a feedback module into your website. It utilizes Writerside, Cloudflare Pages Functions, and TiDB Cloud Data Service for this integration. This will enable you to collect valuable user feedback directly through your website.

View the demo code: writerside-feedback-example

Try the feedback widget: Feedback example page

· 阅读需 6 分钟

During the CS 106L course, I learned a lot of C++ streams. This document describes how to use basic_stringstream to get an integer from a string.

quote

The basic unit of communication between a program and its environment is a stream. A stream is a channel between a source and destination which allows the source to push formatted data to the destination.

—— CS 106L Course Reader

· 阅读需 7 分钟

作为一个 C++ 初学者,在学习基本语法和练习示例代码时,需要频繁使用 g++ ... input.cpp -o output && ./output 类似的命令编译和运行程序。虽然这种方式有助于熟悉 g++,但是对于想要快速测试代码的新手来说,这种方式不够友好。

本文介绍如何利用 CMake 来管理一个 C++ 学习项目,帮助你快速实现编译和运行。

· 阅读需 9 分钟

本文以 pingcap-docsite-preview 项目中的测试框架为例,介绍如何使用 Python 测试 Shell 脚本。

pingcap-docsite-preview 是一个用于预览文档内容的项目。它使用一些 Shell 脚本更新文档网站的内容。为了确保 Shell 脚本的代码质量和功能正确性,该项目使用 Python 构建了一个测试 Shell 脚本的框架。

下面以测试 sync_scaffold.sh 为例,该脚本用于更新 markdown-pages 目录以及 docs.json 文件内容。

· 阅读需 9 分钟

在写 TiDB Cloud 的 Python SDK 时,我需要实现一个等待集群创建成功的函数 wait_for_available() ,以便用户等待集群变为可用状态。这个函数需要计算集群创建所花费的时间,并在超过用户设置的超时时间时抛出异常。这是一个常见的计算时间差的场景。可以通过记录集群创建的开始时间、获取当前时间,然后计算与开始时间开始时间的差值来实现该功能。伪代码如下:

start_time = GetCurrentTime()
while True:
current_time = GetCurrentTime()
duration = current_time - start_time
if duration > timeout:
raise TimeoutError
if cluster.status == "AVAILABLE":
break

· 阅读需 11 分钟

使用场景

在维护 Git 仓库,特别是文档类型的仓库,随着文档数量的增加,很容易出现信息不准确或过时的情况。为了解决这个问题,你可以将文档的内容与对应功能的代码或存在的 issue 绑定,当上游代码发生变化时,自动触发文档的更新。这种方式适合文档项目从 0 到 1 的初期,但是对于已经存在的文档项目重新维护这样的绑定关系就会变得很麻烦。

为了及时发现文档仓库中可能过时的内容,你可以使用 git log 命令获取文档的最后一次更新信息,以发现长期未更新的文档。下面具体介绍如何使用 git log 生成指定目录下所有 Markdown 文件的最后一次 commit 信息。

· 阅读需 11 分钟

This document outlines how to utilize code to enhance the accuracy of configuration documentation, particularly for technical writers who might not be well-versed in coding but are responsible for creating or reviewing configuration files. By following the examples in this document, writers can ensure that their configuration files are correct, efficient, and easy to understand, while also reducing the risk of errors or inconsistencies.

· 阅读需 8 分钟

Introduction

quote

Bytebase is an open-source database DevOps tool, it's the GitLab for managing databases throughout the application development lifecycle. It offers a web-based workspace for DBAs and Developers to collaborate and manage the database change safely and efficiently. ——What is Bytebase

Recently, I have been working on migrating a project's database from SQLite to TiDB Cloud. To facilitate the management of database changes, I decided to use a database DevOps tool and discovered Bytebase. As a new user, I will share my first experience with Bytebase as I tackle the following tasks:

  1. Install Bytebase on macOS
  2. Quick start with Bytebase
  3. Query data and modify schema using the sample data
  4. Integrate Bytebase with TiDB Cloud

· 阅读需 8 分钟

前段时间在写 tidbcloudy(一个 TiDB Cloud Python SDK)的时候用到了 Poetry 来管理依赖以及发布到 PyPI。经历了五次小版本的迭代,感觉 Poetry 时常让我有一种“写 SDK 也不难,发版也可以很简单”的错觉,所以决定记录一下我是如何使用 Poetry 来完成我的第一个 SDK 的。

· 阅读需 7 分钟

Scenario

I use webpack to bundle some JS scripts today, see openapi-scripts/pull/16. The following lists details of the project and reasons for bundling:

· 阅读需 4 分钟

Scenario

  1. There is an API definition file open-api-swagger.json in a private repository production/api and I have no write access to it.
  2. I want to deploy a preview website of the open-api-swagger.json:
    • test some Redoc configuration in my repository Oreoxmt/preview-api
    • build the open-api-swagger.json specification file into a HTML file index.html using redoc-cli build
    • deploy it on Netlify or other services

· 阅读需 8 分钟

新一期的生活小技巧分享终于更新啦,这次是社畜奥奥的打工小技巧分享。

如果你需要同时使用多个终端,又不希望两个键盘、两个鼠标来回切换,或者说你只有一个键盘、一个鼠标却想要控制多个终端的话,那这个超级低成本的小技巧就非常适合你啦!

· 阅读需 6 分钟

最近在学习 Hadoop 的相关内容,厦门大学数据库实验室提供了相关内容的讲义,但是下载的时候要点击 17 次,文件默认的名称也较为繁琐,改名又需要操作 17 次。所以懒懒的奥利奥同学就开始研究有没有一些不太手动的方法,虽然这个过程花费的时间好像会更多(

如果你感兴趣的话,那就继续看下去吧。

应用场景:实现这个页面所有 PPT 的一键下载,以及后续文件名的修改

代码获取:github

· 阅读需 15 分钟

Oreo 同学最近开始记笔记和写心情了,但是就是不走寻常路偏偏想整一个自己的网站来写博客。正巧之前有一个 oreo.life 的域名,很快就定下来了 Hexo + GitHub Pages + Cloudflare CDN 的方案,Oreo 自己折腾了一段时间,成功部署了现在你看到的博客并在坚持更新,可喜可贺可喜可贺。

但是有个问题,GitHub Pages 对应的 Repo 存的是渲染过后的 HTML 文件,我们总得有个地方来存原始的 Markdown 文档。于是更新博客首先需要在 _source 目录写 Markdown,然后在根目录执行 hexo generatehexo deploy 更新网站。命令行操作就先不说了,还要研究什么 Node.js、npm 是不是太过分了,在 Windows 配置环境超麻烦的好吗。世界如此美好,我却还要存 node_modules,这样不好,不好。

成,好歹咱也是做过 CI 的,GitHub Actions 也出来一段时间了看起来反响不错,那肯定也可以用 Actions 完成从博客源码到 Pages 部署的完整流程。Google 一搜发现已经有很多很多人做了类似的事情了,但是总有一些小地方不够好看或者是不满足需求,那就只能自己重新造一遍轮子了。