try-catch语句只要代码中包含finally子句,则无论try或catch语句块中包含什么代码--甚至return语句,都不会阻止finally子句的执行,来看下面这个函数: function testFinally(){ try{ return 2; }catch(error...
分类:
编程语言 时间:
2014-07-08 23:26:00
阅读次数:
249
int link_admin_pwd(char * admin_pwd, char *admin, char*pwd)
{
if (admin == (char *)NULL ||
pwd == (char *) NULL)
{
return -1;
}
if (strlen(admin) == 0 || strlen(pwd) == 0)
{
return -2;
}
...
分类:
其他好文 时间:
2014-07-08 19:00:55
阅读次数:
169
ServerMqFramework.h
#import "MqttFramework.h"
@interface ServerMqFramework : MqttFramework
/**
* @brief 得到模块控制器的句柄单例
*
* @param [in] N/A
* @param [out] N/A
* @return void
* @note
*/
+(S...
分类:
移动开发 时间:
2014-07-08 18:29:44
阅读次数:
272
def FirstNotRepeatingChar(string):
hashStr = [0] * 256
for c in string:
hashStr[ord(c)] += 1
for c in string:
if hashStr[ord(c)] == 1:
return c
这里说下ord, 可以作为atoi来用,功能是若给定的参数是一个长度为1的字符串,那么若...
分类:
其他好文 时间:
2014-07-08 16:15:10
阅读次数:
183
第一种方法:cout
#include
#include
using namespace std;
int main()
{
double aDouble = 5.141592694827862736487362746374637434343434;
cout<<fixed<<setprecision(20)<<aDouble<<endl;
return 0;
}
第二种方...
分类:
编程语言 时间:
2014-07-08 15:56:26
阅读次数:
208
4.6 人性化表单
function $(str) {return(document.getElementById(str));}
function check_submit(){
if($("txt_user_name").value==""){alert("请填写用户名");return(false);}
if($("txt_user_pass").v...
分类:
编程语言 时间:
2014-07-08 15:08:33
阅读次数:
175
# @left part: [start, mid]
# @right part: (mid, end]
def merge(data, start, mid, end):
if mid < start or end < mid:
return 0
reverse = 0
'''
@ for start, it play as the start index of left par...
分类:
其他好文 时间:
2014-07-08 15:04:06
阅读次数:
204
C语言中的函数指针
函数指针的概念: 函数指针是一个指向位于代码段的函数代码的指针。
函数指针的使用:
#include
typedef struct (*fun_t) (int,int);
fun_t pf;
int add(int a, int b)
{
return a+b;
}
int sub(int a,int b)
{
retu...
分类:
编程语言 时间:
2014-07-08 14:40:05
阅读次数:
217
1.任意输入两个数x和y,输出最大值max。
int max(int x, int y)
{return x>y?x:y;}
2.函数模版
(1)用一种或者多种通用类型去表示函数——函数模版。
(2)函数模版由于没有具体的数据类型,所以函数模版不可运行。
(3)作用:模板就是实现代码重用机制的一种工具,它可以实现类型参数化,即把类型定义为参数, 从而实现了真正的代码可重用性。模版可以分...
分类:
编程语言 时间:
2014-07-08 13:51:36
阅读次数:
292
题目
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant spac...
分类:
其他好文 时间:
2014-07-08 13:46:26
阅读次数:
205