1删除左右两端的空格//删除左右两端的空格function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, "");}2 判断是否为空//判断是否为空function isEmpty(s) { return ((s == undefin...
分类:
Web程序 时间:
2014-10-15 18:33:21
阅读次数:
131
一,定义函数 def?functionname(?parameters?):
???"函数_文档字符串"
???function_suite
???return?[expression] 二,引用传递 or 值传递? 示例1: def?func1(name):
????name=name+"sun"
??...
分类:
编程语言 时间:
2014-10-15 16:38:11
阅读次数:
229
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
/**
* Definition for singly-link...
分类:
其他好文 时间:
2014-10-15 16:29:21
阅读次数:
119
1. String --> InputStream InputStream String2InputStream(String str){ ?? ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes()); ?? return stream; } 2. InputStream --> String S...
分类:
其他好文 时间:
2014-10-15 16:22:11
阅读次数:
161
第一步:
打开 phpmyadmin/libraries/plugins/auth/AuthenticationCookie.class.php
找到 authCheck 和 authSetUser 两个函数的定义,在函数体最前面直接加个 return true; 就是让这两个函数无论何时都只返回 true。
经过第一步后,你每次打开phpmyadmin 都可以不用登陆自动进入 da...
分类:
Web程序 时间:
2014-10-15 16:17:11
阅读次数:
209
1. 返回ViewResult public ActionResult Index() { ViewData["Message"] = "Welcome to asp.net MVC!"; return View(); } public ActionResult Index(){ ViewData[...
分类:
Web程序 时间:
2014-10-15 15:59:00
阅读次数:
209
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing
together the nodes of the first two lists.
class Solution {
public:
ListNode *mergeTwoLists(Li...
分类:
其他好文 时间:
2014-10-15 15:48:31
阅读次数:
127
问题: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep ...
分类:
其他好文 时间:
2014-10-15 15:40:50
阅读次数:
262
文章导读:
以前自己一直没搞明白Python中的匿名函数,现在拿这个问题基本上搞明白了,拿自己的理解整成一篇文章,附带大量例子,让其更加好理解。
-------
在编程语言中,函数的应用:
1. 代码块重复,这时候必须考虑用到函数,降低程序的冗余度
2. 代码块复杂,这时候可以考虑用到函数,降低程序的可读性
在Python,有两种函数,一种是def定义,一种是lambda函数
#假如要求两个数之和,用普通函数或匿名函数如下:
1. def func(x,y):return x+y
2. lambda x,...
分类:
编程语言 时间:
2014-10-15 15:14:51
阅读次数:
293
/** * 获取指定URL的参数值 * @param url 指定的URL地址 * @param name 参数名称 * @return 参数值 */ function getUrlParam(url,name){ var pattern = new RegExp("[?&]"+n...
分类:
Web程序 时间:
2014-10-15 14:14:50
阅读次数:
173