Posts
Miigon's blog
Cancel

Natural Sort: How to sort file names naturally

What’s the problem? When a programmer is given the task of sorting file names in a list, it might be tempting to sort using something like std::sort(). The problem with that is: std::sort() sorts ...

关于 IEEE 754 浮点数一些设计细节的疑问解释

计算机系统课程上讲到的 IEEE 754 32位浮点数一些规则细节的个人理解与解释。 老师在课上已经把各个细节都大致讲过了,这篇文章是给课后对这些细节还感兴趣的同学,做补充解释和扩展。 这篇文章不会采用晦涩的引用或者证明,而是尝试让同学能直观理解 IEEE 754 的一些设计选择。 2021-03-31: 最近有比较多的同学看到了这篇文章,这篇文章的本意是回答几个课上遇到的...

问题分析:ios_base::fixed 导致输出精度丢失?

这篇文章是来自我在 0xffff.one 上的一个帖子 https://0xffff.one/d/911/ 的回复。 原帖内容: 百度说是这行代码的作用是使用定点输出,同时输出小数点后6位(我试了好多数,仍然表示很迷) 为什么有这行代码有时候求两个数加减乘除的结果就不对,没有这行代码就对呢 比如55.25+11.17有上面那行代码结果是66.419998,没有就是66...

原理分析:使用 dd 跳过开头若干字节快速拷贝文件

这篇文章是来自我在 0xffff.one 上的一个帖子 https://0xffff.one/d/900 的回复。 原帖内容: 在折腾一个超大的备份文件,需要把它的前 41 个字节删除掉,没有 WinHEX,想着用 dd 命令来实现 一开始这么干,发现速度奇慢,5分钟过去才复制40MB… dd if=input.bak bs=1 skip=41 > result....

MongoDB 高性能最佳实践: 事务,读取关心程度与写入关心程度

本文章为翻译作品,原作者为 Mat Keep 与 Henrik Ingo 原文章发布日期 2020年02月25日 原文标题:Performance Best Practices: Transactions and Read / Write Concerns 原文链接:https://www.mongodb.com/blog/post/performance-best-practices...

Golang Project: Tic Tac Toe

In this article, I’ll go through my process of writing a simple Tic-Tac-Toe game in Golang. Error handling, closures, iota as well as other golang features are used to create the game. Before...

Golang: Control structures

Control structures Taken from Effective Go: The control structures of Go are related to those of C but differ in important ways. There is no do or while loop, only a slightly generalized for; sw...

Golang: Values, Types and Variables

Variables Noted that in Go, type lies after variable/function name, which is different from all the other “C-like” languages, eg. C, C++, C#, Java. Here’s a great article on why the Go declara...

Golang: Functions

Functions Reader of this blog is assumed to have some basic programming skills. So in this series, we will not get into basic things like how function works. Because it’s basically the same for ev...

Golang: Packages - Introduction

Packages - Introduction Every Go program is made up of packages. Note: Do not get confused with Go modules, which is Go’s dependency management system. A Go modules usually contains one or mor...

Golang: Starting my journey

Golang Disclaimer: This series is meant to compare the features and quirks of Golang with other languages like C, because that’s basically how I learned the language. However, this means that...

Announcement | 公告

What? Here’s my personal blog on which I may post stuffs like what I am learning recently, what I found fascinating and want to talk about, or just random thoughts. Why? I have been learning pr...