ICode9

精准搜索请尝试: 精确搜索
  • 漫话:如何给女朋友解释什么是CDN?2022-02-21 18:03:46

    周六晚上七点多,我正在看书呢,突然女朋友跑过来问我她的IPAD去哪了,火急火燎的。 她拿到了IPAD之后就不再理我了,不过作为一个程序员,我还是比较好奇这么大的流量虎牙到底能不能扛得住,哈哈哈。于是我过去看了一下,结果看到了下面这一幕: 但是直播竟然并没有显得很卡顿,禁不住说了一段

  • 漫话Redis源码之八十七2022-02-20 23:04:19

    这个文件的函数比较杂,大致看看就行,以第一个为例,就是一下哈希相关的操作,为了密码安全。其余的函数了解用途就行。 /* Given an SDS string, returns the SHA256 hex representation as a * new SDS string. */ sds ACLHashPassword(unsigned char *cleartext, size_t len) {

  • 漫话Redis源码之六十六2022-01-23 22:33:53

    这里主要是generic分配,功能比较直白。 /* Defrag helper for generic allocations. * * returns NULL in case the allocation wasn't moved. * when it returns a non-null value, the old pointer was already released * and should NOT be accessed. */ void* activeDef

  • 漫话Redis源码之五十六2022-01-09 23:33:54

    对intset的更新和扩容,不是关键核心的代码: /* Upgrades the intset to a larger encoding and inserts the given integer. */ static intset *intsetUpgradeAndAdd(intset *is, int64_t value) { uint8_t curenc = intrev32ifbe(is->encoding); uint8_t newenc = _intse

  • 漫话Redis源码之四十四2022-01-02 23:03:16

    这里主要是跟时钟相关的一些函数,其实不是特别需要仔细阅读。 #include "monotonic.h" #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #undef NDEBUG #include <assert.h> /* The function pointer for clock retrieval. */

  • 漫话Redis源码之四十一2022-01-02 23:00:09

    什么时候调用这些函数呢?值得思考,其实,每次传世壶数据数据到客户端时,都会调用。 /* This function is called every time we are going to transmit new data * to the client. The behavior is the following: * * If the client should receive new data (normal clients wil

  • 漫话Redis源码之四十2021-12-26 23:59:07

    在该文件中,或逻辑用得很巧妙。在我们实际开发中,也经常用到。有点屏蔽位的感觉。 /* * Copyright (c) 2013, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modific

  • 漫话Redis源码之二十六2021-12-05 21:58:55

    这里不需要重点看,主要看下cancelReplicationHandshake就行: #include "server.h" #include "cluster.h" #include "bio.h" #include <sys/time.h> #include <unistd.h> #include <fcntl.h> #include <sys/socket.h> #include <s

  • 漫话Redis源码之十七2021-11-28 19:01:54

    sha是典型的哈希算法,我曾经在博客中写过源码来实现,现在只需要读懂源码就可以了。 这是安全相关的函数,其实,很多安全函数都是挺难读懂的,里面各种奇奇怪怪的数字。 void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len) { WORD i; for (i = 0; i < len; ++i) {

  • 漫话Redis源码之十八2021-11-28 18:59:22

    很显然,这是test函数,咱们在开发代码时,要时刻有自测的意识,提前发现错误,确保代码质量: #define UNUSED(x) (void)(x) int sha1Test(int argc, char **argv, int accurate) { SHA1_CTX ctx; unsigned char hash[20], buf[BUFSIZE]; int i; UNUSED(argc); UNUSE

  • 漫话Redis源码之二2021-11-21 23:02:36

    看了一下,zipmapDecodeLength的实现还挺巧妙的,直接使用内存操作: /* Decode the encoded length pointed by 'p' */ static unsigned int zipmapDecodeLength(unsigned char *p) { unsigned int len = *p; if (len < ZIPMAP_BIGLEN) return len; memcpy(&len,p+1,

  • 漫话:如何给女朋友解释什么是删库跑路?2021-07-05 15:52:04

    在DBA圈子有这样一个段子: 最近几年,经常会出现各种删库跑路的事件发生,前几天还有报道说思科离职5个月的程序员,为了报复公司,删虚拟机跑路了。 这位思科的离职员工,仅凭一己之力,删掉了思科 456 台虚拟机,导致思科损失 240 万美元,相当于人民币 1650 万。 对于这些事件,程序员之所以会

  • 看板 | 漫话之减少WIP(在制品)2020-06-03 15:54:48

      传统的流水线生产模式中,生产流程按生产程序进行划分,而各部分因动作的难度或复杂程度的差异导致用时不同。 例如:一个产品进行组装用时2分钟,完成装箱工作只需10秒。在这种情况下,组装动作用时长、产出慢,工作大量堆积,因此无法及时递交给下一级进行装箱工作,而负责装箱工作的人员在这

  • 漫话:程序员要失业了??!机器人开始在GitHub上修Bug了。2019-07-18 14:35:40

    周末午后,我正在家里疯狂的撸着代码,沉浸在Coding之中。这时候,女朋友急急忙忙的跑过来。 还在写代码么,程序员小哥哥。 快来看看新闻吧,程序员要失业了? 会编程的机器人已经被开发出来了呀。 据 MIT Technology Review 报道,一位名为“Repairnator”机器人在 GitHub 上“卧

  • 漫话:如何给女朋友解释为什么计算机只认识0和1?2019-06-10 10:00:49

    端午节放假休息,我正在家里面吹着空调,吃着西瓜,看着《这就是街舞》,女朋友在一旁看某游戏主播的直播。我隐约中听到她手机中传来主播的一句话:“朋友们,听懂我的意思了吗?懂得扣个1,不懂得扣个0 ”。于是,我开始吐槽:首先,我们要从计算机的历史讲起,这部分涉及到一些硬件知识。计算机计算机(com

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有