python2 python3中long类型的区别
python2 python3中long类型的区别
python2中有long类型
python3中没有long类型,只有int类型
go 语言的并发模型
Go语言的并发模型基于CSP(Communicating Sequential Processes)通信顺序进程模型,通过goroutine和channel来实现并发。Go语言的设计者希望并发成为一种简洁、高效、易于使用的机制,因此它的并发模型具备轻量、简单、安全等特点。以下是Go语言并发模型的几个核心概念:
1. Goroutine
Goroutine是Go语言的并发执行单元,类似于线程,但它比线程更轻量。Go的运行时调度器会负责管理成千上万的goroutine,而不会给系统带来沉重的负担。
特点:
轻量:Goroutine的启动成本非常低,初始栈大小只有几KB,而不是线程的几MB。并且,栈会根据需要动态增长。
高效调度:Go的调度器会自动把goroutine分布在不同的操作系统线程上执行,程序员无需手动管理。
简单启动:通过使用关键字go,可以轻松启动一个新的goroutine。例如:
go someFunction()
2. Channel
Channel是Go语言中用来在goroutine之间传递数据的通信机制。它是类型安全的,可以通过它将一个goroutine中的数据传递到另一个goroutine。
10 个 Linux 中方便的 Bash 别名
你有多少次在命令行上输入一个长命令,并希望有一种方法可以保存它以供日后使用?这就是 Bash 别名派上用场的地方。它们允许你将长而神秘的命令压缩为易于记忆和使用的东西。需要一些例子来帮助你入门吗?没问题!要使用你创建的 Bash 别名,你需要将其添加到 .bash_profile 中,该文件位于你的家目录中。请注意,此文件是隐藏的,并只能从命令行访问。编辑此文件的最简单方法是使用 Vi 或 Nano 之类的东西。
1、 你有几次遇到需要解压 .tar 文件但无法记住所需的确切参数?别名可以帮助你!只需将以下内容添加到 .bash_profile 中,然后使用 untar FileName 解压缩任何 .tar 文件。
alias untar='tar -zxvf '2、 想要下载的东西,但如果出现问题可以恢复吗?
alias wget='wget -c '
3、 是否需要为新的网络帐户生成随机的 20 个字符的密码?没问题。
alias getpass="openssl rand -base64 20"
'python' engine because the 'c' engine does not support regex separators
moveielens.py:17: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.user = pd.read_table(path1, sep='::', header=None, names=unames)
pandas.read_table()函数,读取文件数据时,由于分隔符为'::',弹出如下警告
警告:ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex)
解决方法:增加函数的引擎参数engine='python',如下:
user = pd.read_table(path1, sep='::', header=None, names=unames, engine='python')
标签: python pandas re read_table
importError c extension: No module named np_datetine not buit
我的python代码中有import pandas
使用pyinstaller进行打包exe的时候出现以下问题,现在就来说一下。
打包的时候没有报错,
但是执行时候首先报了pandas的错。提示没有找到pandas._lilbs.tslibs.np_datetime。大概的错误如下:
第一个错误是:
Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?
importError c extension: No module named np_datetine not buit. Jf you yant to import pandas from. the source drectory
g you may need to run python setup. py buildext inplace force to bui1d the c extensions first:
iFai1ed to execute script smg
通过网上查找的方法,修改下pyinstaller的用法,生成过程中添加--hiddenimport=pandas._libs.tslibs.np_datetime,代码如下
pyinstaller -F -w smg.py --hiddenimport=pandas._libs.tslibs.np_datetime
继续打包,过程中没有报错,继续执行exe文件的时候报错如下
第二个错误:
Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?
Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?
importError c extension: No module named timedeltas not buit. Jf you yant to import pandas from. the source drectory
g you may need to run python setup. py buildext inplace force to bui1d the c extensions first:
iFai1ed to execute script smg
iFai1ed to execute script smg标签: pandas np_datetime timedeltas
四个提高工作效率的小技巧
四个提高工作效率的小技巧:一)有没有那么一个命令,创建目录并切换至新目录下?
在工作中是不是经常使用mkdir创建目录,然后cd到创建的目录下,如果经常这样执行的话是不是特烦,抱怨为什么没有一个现成的命令供使用
纠结中。。。。。
如果这个时候有个方式可以满足你的需求是不是感觉很兴奋,然我们见证实现方式吧:
在当前登录的账号的~/.bash_profile文件中添加如下代码:
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }
然后执行 source ~/.bash_profile 使修改文件生效
这个时候你的服务器下就会有个新的命令,mkdircd
Example:
#mkdircd /tmp/a/b/c #pwd /tmp/a/b/c
RuntimeError: Python is not installed as a framework
今天在mac上,python virtualenv 虚拟环境下运行matplotlib example的时候提示如下报错:python animation/animated_histogram.py
Traceback (most recent call last):
File "animation/animated_histogram.py", line 11, in <module>
import matplotlib.pyplot as plt
File "/Users/shiwei/Documents/python_project/study_matplotlib/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/shiwei/Documents/python_project/study_matplotlib/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/Users/shiwei/Documents/python_project/study_matplotlib/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
标签: python matplotlib RuntimeError
valid phone numbers
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers.You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx-xxxx or xxx-xxx-xxxx. (x means a digit)
You may also assume each line in the text file must not contain leading or trailing white spaces.
Example:
Assume that file.txt has the following content:
987-123-4567
123 456 7890
(123) 456-7890
Your script should output the following valid phone numbers:
987-123-4567
(123) 456-7890
cat > file.txt <<EOF
987-123-4567
(123) 456-7890
0(001) 345-0000
(001) 123-345
Elasticsearch史上最全最常用工具清单
Elasticsearch史上最全最常用工具清单1、题记
工欲善其事必先利其器,ELK Stack的学习和实战更是如此,特将工作中用到的“高效”工具分享给大家。
希望能借助“工具”提高开发、运维效率!
2、工具分类概览
2.1 基础类工具
1、Head插件
1)功能概述:
ES集群状态查看、索引数据查看、ES DSL实现(增、删、改、查操作)
比较实用的地方:json串的格式化
2)地址:http://mobz.github.io/elasticsearch-head/
2、Kibana工具
除了支持各种数据的可视化之外,最重要的是:支持Dev Tool进行RESTFUL API增删改查操作。
——比Postman工具和curl都方便很多。
标签: ansible Elasticsearch elk
数据库从0到0.1 : OLTP VS OLAP VS HTAP
OLTP是Online Transaction Processing的简称;OLAP是OnLine Analytical Processing的简称;HTAP是Hybrid Transactional/Analytical Processing的简称。Transaction是指形成一个逻辑单元,不可分割的一组读,写操作;Online一般指查询延迟在秒级或毫秒级,可以实现交互式查询。
OLTP的查询一般只会访问少量的记录,且大多时候都会利用索引。在线的面向终端用户直接使用的Web应用:金融,博客,评论,电商等系统的查询都是OLTP查询,比如最常见的基于主键的CRUD操作。
OLAP的查询一般需要Scan大量数据,大多时候只访问部分列,聚合的需求(Sum,Count,Max,Min等)会多于明细的需求(查询原始的明细数据)。 OLAP的典型查询一般像:现在各种应用在年末会发布的大数据分析和统计应用,比如2017豆瓣读书报告,2017豆瓣读书榜单,网易云音乐2017听歌报告; OLAP在企业中的一个重要应用就是BI分析,比如2017年最畅销的手机品牌Top5;哪类人群最喜欢小米或华为手机等等。
《Designing-Data-Intensive-Applications》一书指出的OLTP和OLAP的主要区别如下:
在CMU-CS 15-415的课程中对OLAP和OLTP这样介绍:
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)
最新日志
随机日志
- linux 批量查找删除
- 独立IP与共享IP对SEO的影响分析(转载)
- php-fpm通过request_slowlog_timeout检查哪个脚本执行时间长
- 永远不要在 Linux 执行的 10 个最危险的命令
- js 实现php中sprintf函数
- Js中window.parent ,window.top,window.self 详解
- Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0 Warning: require_once(): Unable to allocate memory for pool
- Jquery跨域请求php获取数据之jsonp