vim中设置了autoindent后,粘帖带缩进的代码会造成多余的缩进。 用下面的代码解决这个问题
:r! cat
//and then paste ( shift + insert ) the content, and CTRL+D.
<?xml version="1.0" encoding="utf-8"?> | |
<root xmlns="dotnet" xmlns:w="wpf"> | |
<!-- xmlns: dotnet --> | |
<a>data in a</a> | |
<!-- xmlns: dotnet --> | |
<w:b>data in b</w:b> | |
<!-- xmlns: wpf --> | |
<c xmlns="silverlight"> | |
<!-- xmlns: silverlight --> | |
<w:d> |
System.out.println("通过Map.entrySet遍历key和value:"); | |
for (Map.Entry<String, String> entry : map.entrySet()) { | |
System.out.println("key= " + entry.getKey() + " and value= " | |
+ entry.getValue()); | |
} |
--创建函数(返回varchar类型的值) | |
create function test(@Num varchar(20))--@Num 参数 | |
returns varchar(50) --返回值类型 | |
as | |
begin | |
declare @MSG varchar(20) | |
if(@Num =1) | |
select @MSG ='正确' | |
else | |
select @MSG ='错误' |
-- ============================================= | |
-- Author: Md. Marufuzzaman | |
-- Create date: | |
-- Description: Split an expression. | |
-- Note: If you are using SQL Server 2000, You need to change the | |
-- length (MAX) to your maximum expression length of each datatype. | |
-- ============================================= | |
/* | |
SELECT * FROM [dbo].[SPLIT] (';','I love codeProject;!!!;Your development resources') | |
*/ |
public class LevenshteinDistance | |
{ | |
/// <summary> | |
/// 取最小的一位数 | |
/// </summary> | |
/// <param name="first"></param> | |
/// <param name="second"></param> | |
/// <param name="third"></param> | |
/// <returns></returns> | |
private int LowerOfThree(int first, int second, int third) |
js 代码 | |
var testStr = "now test001 test002"; | |
var re = /test(\d+)/ig; | |
var r = ""; | |
while(r = re.exec(testStr)) { | |
alert(r[0] + " " + r[1]); | |
} | |
此外也可以用testStr.match(re),但是这样的话就不能有g的选项,而且只能得到第一个匹配。 | |
另外备忘一下: | |
正则表达式对象的属性及方法: |
vim中设置了autoindent后,粘帖带缩进的代码会造成多余的缩进。 用下面的代码解决这个问题
:r! cat
//and then paste ( shift + insert ) the content, and CTRL+D.
# 8th November, 2009 | |
# update manager failed, giving me the error: | |
# 'files list file for package 'xxx' is missing final newline' for every package. | |
# some Googling revealed that this problem was due to corrupt files(s) in /var/lib/dpkg/info/ | |
# looping though those files revealed that some did not have a final new line | |
# this script will resolve that problem by appending a newline to all files that are missing it | |
# NOTE: you will need to run this script as root, e.g. sudo python newline_fixer.py | |
import os |