根据端口号来杀死进程

根据端口号获得进程的 pid,然后 taskkill 命令杀死进程。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@echo off
:wait_a_port
set port=
echo.&set /p port=Please input port number:
cls
if not defined port goto :wait_a_port

for /f "tokens=2,4,5" %%a in ('netstat -ano^|find /i ":%port% "') do if not "%%c"=="" (set pid=%%c) else (set pid=%%b)
for /f "tokens=1" %%a in ('tasklist /fi "pid eq %pid%"') do set prog=%%a
echo Port Number:%port%
echo PID:%pid%
echo Process:%prog%

set n=
echo.&set /p n=Please input pid to kill it:

if defined n (echo.&taskkill /f /fi "pid eq %pid%")

echo.&echo Press to exit ...
pause>nul
exit

ORA-01555 问题记录

undo_segment_and_consistent_read

阅读全文 »

Excel VBA: 提取最后一连串数字

提取最后一连串数字,采用从后往前查找的方式,程序中限定了返回结果字符串的长度必须为 15 或 16 或者 17 。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Sub ExtractTheLastSuccessiveNumbers()
'Update by 20150702
Dim Rng As Range
Dim WorkRng As Range
Dim xValue As String
Dim OutValue As String
Dim PreviousIsNumber As Boolean
Dim Find As Boolean
Dim index As Integer

On Error Resume Next
xTitleId = "QQ的小工具箱[逆序读取]"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("选择数据范围", xTitleId, WorkRng.Address, Type:=8)

For Each Rng In WorkRng
OutValue = ""
PreviousIsNumber = False
Find = False
xValue = Rng.Value
index = VBA.Len(xValue) + 1

For i = 1 To VBA.Len(xValue)

If VBA.IsNumeric(VBA.Mid(xValue, index - i, 1)) Then

Find = True

If PreviousIsNumber Then
OutValue = VBA.Mid(xValue, index - i, 1) & OutValue
Else
OutValue = VBA.Mid(xValue, index - i, 1)
End If
PreviousIsNumber = True

Else
PreviousIsNumber = False

If Find Then
Exit For
End If

End If
Next

Rng.NumberFormat = "@"
'Rng.NumberFormat = "0"
If VBA.Len(OutValue) = 15 Or VBA.Len(OutValue) = 16 Or VBA.Len(OutValue) = 17 Then
Rng.Value = OutValue
Else
Rng.Value = ""
End If
Next

End Sub
阅读全文 »

在 Excel 单元格中查找最后一个空格(Space)的位置

问题描述

I have an Excel sheet with text values, e.g. in A1: “This is the text”. I need to find the position of the last space character. Is there an excel formula that will give me the result I want? I have tried FIND and SEARCH, however these start from left, what I need is to start from right.

解决办法一:

1
=FIND("☃",SUBSTITUTE(A1," ","☃",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))

说明:

  1. LEN(A1)-LEN(SUBSTITUTE(A1," ","")) gives you the number of spaces, let’s call it x,
  2. SUBSTITUTE(A1," ","☃",[x]) will replace the xth space (so the last one) by a snowman,
  3. FIND("☃",[...]) will give you the position of the snowman. Which is the position of the last space.
阅读全文 »

逐步学习 Vim

vi/vim cheat sheet

阅读全文 »

Python Tutorial

Python 3

阅读全文 »

Eclipse 常用快捷键与插件汇总

Eclipse Shortcut Keys and Plugins

阅读全文 »

搭建PHP服务器

本文只是简单记录了使用 Wamp 搭建 PHP 服务器,主要涉及解决 MSVCP110.dll丢失问题,修改 mysql 默认配置,以及网站部署。

阅读全文 »

Javadoc:Documentation Comments

Code_Train

阅读全文 »

SSD:OCZ RevoDrive3 X2 240G Performance Test

主要内容:

  • HDD RAID 5 Performance vs Single HDD Performance
  • SSD Performance vs HDD Performance
  • SSD Performance: PCI-Express SSD vs SATA III SSD
  • RAID 5 Performance: Software based vs Hardware based
阅读全文 »