QuickSortIn the previous challenge, you wrote a partition method to split an array into 2 sub-arrays, one containing smaller elements and one containi...
分类:
其他好文 时间:
2014-08-02 12:12:53
阅读次数:
512
Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr...
分类:
其他好文 时间:
2014-08-02 04:22:40
阅读次数:
248
1.MFC下生成动态库1>显式调用在.cpp文件里添加接口函数1 int sum(int a,int b)2 {3 return a + b;4 }5 6 int sub(int a,int b)7 {8 return a - b;9 }在.def文件里标示导出接口1 sum @1;...
监控服务器是否宕机的脚本:$sudoviping.sh按a或i进入编辑模式#!/bin/bashDate=`date+%m%d%y`touch/log/Ping/$Date.logServer="ming1ming2ming3ming4ming5"forServerin$ServerdoPing=`/bin/ping-c4$Server|grep%|awk-F[:""]+‘{print$6}‘|tr-d‘%‘`Ping2=`/bin/ping-c4$Server|gr..
分类:
其他好文 时间:
2014-08-01 20:20:13
阅读次数:
237
现有字符串,需要取出用空格分隔的第一段,操作如下>>> product_model = ‘WS-C2960G-24TC-L – Fixed Module 0′>>> product_model.split(‘ ‘)[0]‘WS-C2960G-24TC-L’不带参数的split(),会把所有空格(空格...
分类:
编程语言 时间:
2014-08-01 18:59:42
阅读次数:
238
文本行中各列打乱:awk 'BEGIN{srand()}{for(i=1;i<=NF;i++) b[rand()NF]=$i}END{for(x in b)printf "%s ",b[x]}'` data文本行中各行打乱:awk 'BEGIN{srand()}{b[rand()NR]=$0}END...
分类:
其他好文 时间:
2014-08-01 18:29:22
阅读次数:
220
#/bin/bash
#
beforTime=02:00
afterTime=08:00
beforTime=$(echo$beforTime|awk-F:{‘print$1‘})
afterTime=$(echo$afterTime|awk-F:{‘print$1‘})
Flag=0
whiletrue
do
sleep2s
echo"date:$(date+"%Y-%m-%d%H:%M:%S")"
if[$(date+%H)-eq$beforTime];then
CurDate=$(date+%d)
..
通过tcp三次握手的情况来说明#netstat -an|awk '/^tcp/ {++s[$NF]} END{for (a in s) print a,s[a]}'established是表示tcp三次握手成功后的工作状态,可以理解为已经成功进行访问了listen是表示在侦听,没有客户连接进来syn...
分类:
Web程序 时间:
2014-08-01 13:02:41
阅读次数:
222
这三个方法个人感觉还是很实用的,并且挺相似的,故放到一起: split && join split注1注2 作用:分割字符串;返回一个列表1.可以分割字符串中不存在的字符,返回完整列表: string = 'sadhjfhdj' print string.split("5")...
分类:
移动开发 时间:
2014-08-01 10:40:01
阅读次数:
438
Public Class frmDl Dim x As Single = 0 Dim y As Single = 0 Private Sub frmDl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ...