码迷,mamicode.com
首页 >  
搜索关键字:function    ( 54714个结果
GLUT的一个简洁OO封装
Member function 如何作为Callback? 这里其实是两个问题。 第一个问题,member function的函数签名上有this指针,不能直接传给glut*Func作为callback。 member function不行,很自然的想到static function。 第二个问题,static function如何能够调用member function,且与之关联的对象(this指针)能够在运行时期(或者用户程序)决定? 其一,static function调用member functi...
分类:其他好文   时间:2014-06-09 23:27:43    阅读次数:313
leetcode——Two Sum 两数之和(AC)
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe...
分类:其他好文   时间:2014-06-09 23:14:45    阅读次数:264
jquery入门 修改网页背景颜色
我们在浏览一些网站,尤其是一些小说网站的时候,都会有修改页面背景颜色的地方,这个功能使用jquery很容易实现。 效果图: show you code: jquery test white red green yellow $("button").click( function() { var color = this.value; $("...
分类:Web程序   时间:2014-06-08 16:48:45    阅读次数:274
quick-cocos2d-x教程10:实现血条效果。
血条是常见功能,可以通过一个血条背景和一个不断改变得血条宽度,来实现少血。 在MainScence.lua中,先改代码: function MainScene:ctor()     local bg = display.newSprite("bg01.jpg")     bg:setPosition(display.cx, display.cy)     self:addChild(bg...
分类:其他好文   时间:2014-06-08 15:34:24    阅读次数:347
extjs tree check 级联选择
extjs4 tree check 级联选择 实现效果:关键代码: function changeAllNode(node, isCheck) { allChild(node, isCheck); allParent(node, isCheck); function allChild(nodec, isCheckc) { var chileNodes = n...
分类:Web程序   时间:2014-06-08 15:25:20    阅读次数:222
检查输入的用户名是否符合规定
代码清单: <?php /** * 检测输入中是否含有错误字符 * @author ruxing.li * @param char $string 要检查的字符串名称 * @return boolean */ function is_badword($string) { $badwords = array("\\",'&',' ',"'",'"','/','*',',',''...
分类:其他好文   时间:2014-06-08 14:49:48    阅读次数:288
判断字符串是否为 utf-8 编码
代码清单: <?php /** * 判断字符串是否为utf8编码,英文和半角字符返回ture * @author ruxing.li * @param $string * @return bool */ function is_utf8($string) { return preg_match('%^(?: [\x09\x0A\x0D\x...
分类:其他好文   时间:2014-06-08 10:47:58    阅读次数:267
格式化文本域内容
本函数对 form 表单提交过来的 textarea 文本域的内容进行处理。 代码清单: <?php /** * 格式化文本域内容 * @author ruxing.li * @param $string 文本域内容 * @return string */ function formatTextarea($string) { $string = nl2br ( str_re...
分类:其他好文   时间:2014-06-08 10:36:42    阅读次数:184
[LeetCode] Remove Duplicates from Sorted Array [19]
题目...For example,Given input array A = [1,1,2],Your function should return length = 2, and A is now [1,2]. 解题思路, 移除数组中的重复元素,并返回新数组的长度。 这个题目应该算是简单的题目。使用两个变量就可以。具体的看代码 代码实现......
分类:其他好文   时间:2014-06-08 03:54:22    阅读次数:279
LeetCode——Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe...
分类:其他好文   时间:2014-06-08 02:12:04    阅读次数:216
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!