#!/bin/sh
if [ -r $1 ]; then
? ? #Delete Baiduspider
? ? baidu=$(grep -c ‘Baiduspider‘ $1)
? ? if [ $baidu -gt 0 ]; then
? ? ? ? sed -i ‘/Baiduspider/d‘ $1
? ? ? ? echo "match Baidus...
分类:
其他好文 时间:
2014-07-21 10:19:23
阅读次数:
259
废话不多说,直接上内容使用Regex.Match()方法的时候,想匹配一个子串,但是要匹配的内容可能在我加载的资源中出现换行,比如我的资源内容为john \r\n smith,我想把john smith匹配出来。1. 正则表达式中点号(.)代表除了\n以外的所有字符,但是这仅限于在中括号外使用([]...
分类:
其他好文 时间:
2014-07-21 00:01:18
阅读次数:
538
awk字符串函数gsub(r,s)在整个$0中用s替代rgsub(r,s,t)在整个t中s替代rindex(s,t)返回s中字符串t的第一个位置match(s,r)测试s是否包含匹配r的字符串split(s,a,fs)在fs上将s分成序列asprint(fmt,exp)返回经fmt格式化后的expsub(r,s)用$0中最左边最长的字符串代替ssubstr(s,p)..
分类:
其他好文 时间:
2014-07-20 15:41:31
阅读次数:
210
一些例子。1、显示gopher帐号所在行至最后一行。awk‘/^gopher/{row=NR;while(getline<"passwd"){++i;FS=":";if(i>=row){print$0}}}‘passwdgetline<"filename"若读取成功,则返回非0,当读文件完后,会返回0。awk-F:‘NR==FNR{if($1~/^gopher/){row=NR};next}{if(FNR>..
分类:
其他好文 时间:
2014-07-20 15:31:51
阅读次数:
353
在Eclipse中开发android的应用程序时,有时想查看函数的内部实现,但是当在函数上点击ctrl和鼠标左键的时候,往往出现如下提示: Class File EditorSource not foundThe JAR of this class file belongs to container 'Android' which does not allow modifications to ...
分类:
移动开发 时间:
2014-07-20 11:42:00
阅读次数:
217
问题描述与解决方案还是老问题,Linux系统中通过iptables配置的NAT无法在双向通信环境中使用,你无法配置一条NAT规则实现对两个方向主动发起的流量做NAT,解决这个问题的方案有好几种:1.配置两条NAT规则iptables的NAT配置本身就是先match再执行一个target,因此一条规则只能表示一种转换策略,要想实现“来自x的数据包的源地址转换为y,去往y的数据包的目标地址转为x”这样...
分类:
其他好文 时间:
2014-07-20 09:22:06
阅读次数:
294
问题描述与解决方案还是老问题,Linux系统中通过iptables配置的NAT无法在双向通信环境中使用,你无法配置一条NAT规则实现对两个方向主动发起的流量做NAT,解决这个问题的方案有好几种:1.配置两条NAT规则iptables
的NAT配置本身就是先match再执行一个target,因此一条规则只能..
分类:
其他好文 时间:
2014-07-20 03:46:22
阅读次数:
205
Cocos2d (v.3.0) rendering pipeline roadmap
Why (the vision)
The way currently Cocos2d does rendering is good but it is beginning to feel somehow antiquate and moreover it doesn’t actually leverag...
分类:
其他好文 时间:
2014-07-19 23:14:08
阅读次数:
449
Handler的实质就是异步消息处理。实例一:Handler的基本用法XML布局代码:<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<T..
分类:
移动开发 时间:
2014-07-19 16:28:30
阅读次数:
334
Binary String Matching
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述
Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as...
分类:
其他好文 时间:
2014-07-19 13:26:19
阅读次数:
274