编程我只用CPP 发布的文章

一、以太网

1.1 以太网和IEEE802标准的关系

以太网 指一个标准,由DEC、Intel和Xerox公司在1980年共同发布的标准,第一个常见格式的以太网在目前被称为10Mb以太网共享以太网 ,后来被IEEE采纳修改成了802.3 标准。

这种网络的所有的站点都工作在一条共享的线路上,网络结构通常为:

- 阅读剩余部分 -

一、概述

把编辑器移到markdown 之后遇到了一个非常棘手的问题,就是图片路径问题,因为图片都是在本地,转到博客都要重新上传再重新改URL,非常麻烦,而且会造成本地和博客的内容不同步,这样就不和谐了。

后来想了个办法就是把图片放到七牛云上去,虽然本质是和上传到博客再调用是一样的,但是把博客的媒体库当成一个文件服务器有点不太好,而且wordpress 上的图片url定位也比较麻烦,服务器配置不是很好的话运行起来还有点卡,所以最后还是选择七牛云来作为文件存储。

- 阅读剩余部分 -

一、setuptools安装错误:RuntimeError: Compression requires the (missing) zlib module

1. 描述

搞了个腾讯云的服务器,闲在手上没事准备当个测试机用用,写写代码什么的。然后按照之前写的文章安装了python2.7 ,安装的中途出现了一个错误:

running install
running bdist_egg
running egg_info
writing requirements to setuptools.egg-info/requires.txt
writing setuptools.egg-info/PKG-INFO
writing top-level names to setuptools.egg-info/top_level.txt
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
reading manifest file "setuptools.egg-info/SOURCES.txt"
reading manifest template "MANIFEST.in"
warning: no files found matching "*" under directory "setuptools/_vendor"
writing manifest file "setuptools.egg-info/SOURCES.txt"
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating "dist/setuptools-36.6.0-py2.7.egg" and adding "build/bdist.linux-x86_64/egg" to it
Traceback (most recent call last):
  File "setup.py", line 188, in <module>
    dist = setuptools.setup(**setup_params)
  File "/usr/local/python27/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/data/setuptools-36.6.0/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/data/setuptools-36.6.0/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command("bdist_egg")
  File "/usr/local/python27/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/data/setuptools-36.6.0/setuptools/command/bdist_egg.py", line 231, in run
    dry_run=self.dry_run, mode=self.gen_header())
  File "/data/setuptools-36.6.0/setuptools/command/bdist_egg.py", line 473, in make_zipfile
    z = zipfile.ZipFile(zip_filename, mode, compression=compression)
  File "/usr/local/python27/lib/python2.7/zipfile.py", line 736, in __init__
    "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module

- 阅读剩余部分 -

一、概述

正则表达式,又称正规表示式、正规表示法、正规表达式、规则表达式、常规表示法(英语:Regular Expression,在代码中常简写为regex、regexp或RE),是计算机科学的一个概念。正则表达式使用单个字符串来描述、匹配一系列匹配某个句法规则的字符串。在很多文本编辑器里,正则表达式通常被用来检索、替换那些匹配某个模式的文本。

Regular Expression的“Regular”一般被译为“正则”、“正规”、“常规”。此处的“Regular”即是“规则”、“规律”的意思,Regular Expression即“描述某种规则的表达式”之意。

本篇将介绍正则表达式的基本语法,所有代码基于python 完成,环境:python2.7 + re 模块,python 操作正则的方法详见: python正则表达式的使用方法

- 阅读剩余部分 -

概述

一直听闻markdown 的强大,也一直手痒准备试一试,今天有时间来鼓捣了一番。

作为一个程序员,本着排斥装软件来写markdown的情怀,拿起了手里的sublime text作为试验品,把sublime text打造成了一个markdown编辑器。

不过说实话用sublime text来作为编辑器有点闹心,也有点折腾,毕竟是要靠插件来完成,功能还是不太满意。

- 阅读剩余部分 -

一、概述

re 模块是python官方提供的正则表达式模块,一些常用的方法如下:

re.match(pattern, string, pos, endpos)

string 中匹配pattern 规则,返回一个匹配对象。

re.search(pattern, string, pos, endpos)

string 中查找第一个满足规则pattern 的字符串,返回一个匹配对象。

re.findall(pattern, string, pos, endpos)

查找所有满足规则pattern 的字符串,结果将返回一个元组。

- 阅读剩余部分 -

概述

对一个linux开发这来说,习惯了linux的命令行和快捷键操作,回到windows的cmd 用起来非常不习惯,而且界面也是巨丑无比,写python 总是是各种乱码。今天终于下定决心一定要换了它,找了很久终于找了一个很不错的命令行工具cmder,能兼容linux下的各种命令,功能也很强大,先试用一段时间。

- 阅读剩余部分 -

Internet中的IP地址结构在大学里学了好几遍了,自认为当初学得也还不错,本来打算跳过这一章,仔细一看就发现好多都已经忘了,于是就重新过了一遍。再看一遍就发现很多概念比以前都清晰多了,还有一些小的细节以前没弄清楚现在也是搞明白了,算是温故而知新吧。

- 阅读剩余部分 -