STL 中取第 n 小数的算法 nth_element 的函数原型如下
template
void nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
算法说明:
1、功能:执行 nth_element 后,nth 所指位置的元素将是整个区间有序时在该处的元素。对 [first, nth) 中的任意迭代器 i 和 [n...
分类:
其他好文 时间:
2014-07-22 23:03:14
阅读次数:
345
用YII很久了今天看老代码发现了一个致命又气人的bug: “'SiteController cannot find the requested view "index". ”
在这个项目里对应的views/site/index.php文件都有,但是为什么还报了这个错呢, 于是开始看内核代码:
public function getViewFile($viewName)
{
if(($t...
分类:
其他好文 时间:
2014-05-01 21:59:39
阅读次数:
454
javaScript会在调用时会设置执行上下文“this”的值。
一些使用错误的例子
我们举一个例子,给一个Menu构造函数,用来接受一个元素来创建一个菜单。
function Menu(elem){
//...
}
//使用
var elem = document.getElementById('something') // a DOM element
var menu =...
分类:
编程语言 时间:
2014-05-01 17:40:31
阅读次数:
312
jQuery获取Select选择的Text和Value:
语法解释:
1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发
2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text
...
分类:
Web程序 时间:
2014-05-01 17:38:42
阅读次数:
420
代码如下
#include
#include
#include
using namespace std;
template
class Base
{
public:
Base(T name);
virtual void toString();
protected:
T id;
};
template
Base::Base(T n)
{
printf("B...
分类:
编程语言 时间:
2014-04-30 22:27:39
阅读次数:
450
CKEDITOR.editorConfig = function( config )
{
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.filebrowserBrowseUrl = '/CKEditorAndCKFinder/ckfinder/ckfinder.html' ;
config.fi...
分类:
其他好文 时间:
2014-04-30 22:21:39
阅读次数:
366
typeof()函数 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"
js中undefined,null,NaN的区别
1.类型分析:
js中的数据类型有undefined,boolean,number,string,object等5种,前4种为原始类型,第5种为引用类型。
未定义的值...
分类:
Web程序 时间:
2014-04-29 13:45:21
阅读次数:
414
set容器是以红黑树容器为基础实现的,在其基础上稍加改变接口即可
#ifndef MY_SET_H_INCLUDED
#define MY_SET_H_INCLUDED
#include"my_rb_tree.h"
namespace juine
{
template
struct identity
{
const T& operator()(cons...
分类:
其他好文 时间:
2014-04-29 13:16:20
阅读次数:
376
JS 对某图片的等比缩放
代码
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
最新javascript自动按比例显示图片,按比例压缩图片显示
function AutoResizeImage(maxWidth,max...
分类:
数据库 时间:
2014-04-29 13:14:22
阅读次数:
440
建立elements目录
mkdir -p elements/lamp/install.d/
vim 70-lamp
#!/bin/bash
set -eux
install-packages wordpress mariadb-server httpd memcached
生成一个带wordpress的镜像
export ELEMENTS_PATH=...
分类:
其他好文 时间:
2014-04-29 13:14:21
阅读次数:
475