Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers.You may as...
分类:
其他好文 时间:
2015-05-07 23:26:13
阅读次数:
158
在安装了最新版本的Python 3.x版本之后,去参考别人的代码(基于Python 2.x写的教程),去利用print函数,打印输出内容时,结果却遇到print函数的语法错误:SyntaxError: invalid syntax这是因为Python 2.x升级到Python 3.x,print函数的语法变化了,所以用Python 2.x的print函数的代码,放在Python 3.x中运行,结果就...
分类:
编程语言 时间:
2015-05-07 22:08:54
阅读次数:
183
不使用 ulimit 命令,在程序中使用 API 开启 core dump。注意:只对当前程序有效。#include int enableCoreDump(void){ struct rlimit r_old, r_new; getrlimit(RLIMIT_CORE, &r_old); print...
分类:
其他好文 时间:
2015-05-07 20:17:29
阅读次数:
143
监控redis端口如下:#!/bin/sh#Createdbyhys20140823declare-amaster_ismaster_is=($(redis-cli-h192.168.0.76-p7711INFO|greprole|awk-F:‘{print$2}‘))echo$master_isif[${master_is}=="master"];thenecho"OK-slaveisrunning"exit0elseecho"Critical-slaveiserror"exit2fi监控..
分类:
移动开发 时间:
2015-05-07 17:06:06
阅读次数:
136
#!/bin/shecho"kill-9`psaux|grepjava|grep[t]omcat01|awk‘{print$2}‘`"psaux|grepjava|grep[t]omcat01|awk‘{print$2}‘|xargskill-9echo"kill-9`psaux|grepjava|grep[t]omcat02|awk‘{print$2}‘`"psaux|grepjava|grep[t]omcat02|awk‘{print$2}‘|xargskill-9/data/webserver/tomc..
分类:
系统相关 时间:
2015-05-07 16:59:39
阅读次数:
155
电脑上原来有个win7, 由于要在 ubuntu 环境下开发, 所以要装个 ubuntu 。
在 win7 下, 通过压缩卷, 腾出来了 150G 的空间。
安装 ubuntu 的时候, 提示说我电脑上没有操作系统。
选择分区的地方, 看到的只有整个硬盘设备, 看不到硬盘上的分区。
网上找了些资料, 通过命令:
sudo parted /dev/sda
进去后, 输入 print...
??
查看运行时数据
print - 查看变量值
ptype – 查看变量类型
#ptype i
#ptype “aaa” 打印字符串”aaa”的类型
#ptype array 打印数组array的类型
#ptype main 打印main函数的类型
print array – 查看数组
#p arr1
#p arr1[2] 查看数组arr2第三个元素值
#p...
分类:
数据库 时间:
2015-05-07 14:35:46
阅读次数:
255
1、addslashes() 在预定义字符串前添加反斜杠 magic_quotes_gpc=on 对get/post提交的数据自动转义 get_magic_quotes_gpc() 获取php是否开启自动转义 stripslashes() 吧转义字符前反斜杠删除 print_r(ini_get_al...
分类:
其他好文 时间:
2015-05-07 14:21:58
阅读次数:
101
1,http日志分析#!/bin/bash
foriin$@;do
echo====================="$i"=============================>>weblog.txt
echo"IPdata">>weblog.txt
awk‘{print$1}‘$i|wc-l>>weblog.txt
awk‘{print$1}‘$i|sort|uniq-c|wc-l>>weblog.txt
echo"sokectdata"&g..
分类:
Web程序 时间:
2015-05-07 12:39:34
阅读次数:
156
在编程的过程中,总是无法避免处理异常的情况,这些异常也有可能是错误,也有可能是一些偶现的异常,Python中提供了处理这些情况的有效机制。
语法错误
语法错误,即解析错误,也许会是你学习Python的过程中遇到最多的错误:
>>> while True print('Hello world')
File "", line 1, in ?
while True print('Hel...
分类:
编程语言 时间:
2015-05-07 12:36:26
阅读次数:
123