Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.难度:60.这是算法中比较经典的问题,判断一个字...
分类:
其他好文 时间:
2014-09-20 14:02:47
阅读次数:
292
sql 没有split函数,所以要自定义一个create function f_split(@c varchar(2000),@split varchar(2)) returns @t table(col varchar(20)) as begin while(charindex(@split...
分类:
数据库 时间:
2014-09-19 15:35:05
阅读次数:
226
1、编写标量值函数ICONVERT2STRING
CREATE FUNCTION ICONVERT2STRING(@N INT,@F INT) RETURNS VARCHAR(10) AS
BEGIN
DECLARE @M INT
DECLARE @L0 INT
DECLARE @CH VARCHAR(10)
DECLARE @ST VARCHAR(20)
SELECT @CH=''
SELEC...
分类:
数据库 时间:
2014-09-19 01:14:14
阅读次数:
215
可以对照使用google protobuf RPC实现echo service一文看,细节本文不再描述。
google protobuf只负责消息的打包和解包,并不包含RPC的实现,但其包含了RPC的定义。假设有下面的RPC定义:
service MyService {
rpc Echo(EchoReqMsg) returns(EchoRespMsg)
}
那么要实...
分类:
其他好文 时间:
2014-09-18 23:52:27
阅读次数:
512
曾经想过在循环读取数据的时候进行记录,但是那效率并没有直接在sql中用函数调用好CREATE FUNCTION [dbo].[fnGetDistance](@LatBegin REAL, @LngBegin REAL, @LatEnd REAL, @LngEnd REAL) RETURNS FLOA...
分类:
其他好文 时间:
2014-09-18 21:53:24
阅读次数:
202
---创建视图create view myview as select re=rand() --自定义函数:取得指定范围的随机数 create function mydata( @a int, @b int) returns decimal(38,0) as begin declare @r dec...
分类:
数据库 时间:
2014-09-15 17:25:49
阅读次数:
211
Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.实现String...
分类:
其他好文 时间:
2014-09-15 00:54:37
阅读次数:
185
先看看官方手册的说明吧:
pairs (t)If t has a metamethod __pairs, calls it with t as argument and returns the first three results from the call.
Otherwise, returns three values: the next function, the table t, a...
分类:
其他好文 时间:
2014-09-12 01:16:42
阅读次数:
304
去除空格方法:"xyz".strip()#returns"xyz""xyz".lstrip()#returns"xyz""xyz".rstrip()#returns"xyz""xyz".replace(‘‘,‘‘)#returns"xyz"
分类:
编程语言 时间:
2014-09-10 19:48:21
阅读次数:
255
1.不可变StringString对象是不可变的,String类中每一个看起来会修改String值的方法,实际上都是创建了一个全新的String对象,例如:publicclassImmutable{
publicstaticStringupcase(Strings){
returns.toUpperCase();
}
publicstaticvoidmain(String[]args){
Stringstr1="Str..
分类:
编程语言 时间:
2014-09-10 02:47:40
阅读次数:
256