- 博客(43)
- 收藏
- 关注
原创 scheme letrec
#!/usr/bin/racket#lang scheme(display (let ([x 5]) (letrec ([x 2] [y x]) (list y x))))(newline)结果(2 2)
2013-12-16 21:22:13
815
原创 scheme let
#!/usr/bin/racket#lang scheme(display (let ([x 5]) (let ([x 2] [y x]) (list y x))))(newline)结果(5 2)
2013-12-16 21:14:15
1274
原创 nginx php 500
出错码:500出错日志:rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 192.168.190.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.190.14
2013-12-16 12:27:22
1958
原创 php in_array
<?php$var0 = ['a', 'b', 3];$var1 = 'a';var_dump(is_array($var0));var_dump(is_array($var1));运行结果bool(true)bool(false)
2013-12-16 09:54:05
553
原创 linux 安装php redis模块
wget https://github.com/nicolasff/phpredis/archive/master.zipunzip master.zipcd phpredis-masterphpize./configuremakesudo make install最后在php的配置文件里添加extension=redis.so
2013-11-22 12:55:51
615
原创 centeros 安装redis
下载:wget http://download.redis.io/redis-stable.tar.gz解压:tar xvf redis-stable.tar.gz; cd redis-stable编译:make -j4 && make test安装:sudo make install运行:sudo mkdir /etc/redissudo cp redis.conf /etc/redi
2013-11-22 12:39:13
738
原创 linux socket编程
以下程序监听localhost:1234,回显用户的输入#include #include #include #include int main(){ int welcome_fd, sock_fd; //连接套接字 welcome_fd = socket(AF_INET, SOCK_STREAM, 0); { struct sockaddr_in addr; add
2013-11-20 18:26:01
698
原创 php socket
以下代码用socket监听localhost:8080端口,当用户输入一串字符后,回显’you say ‘ +那串字符。<?php$host = 'localhost';$port = '8080';$welcome = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($welcome, $host, $port);socket
2013-11-20 17:06:49
594
原创 v8 hack ---给js添加新的关键字
ECMAScript的关键字是js关键字的子集。参考资料点击打开链接;点击打开链接下文将给v8的添加js关键字func,func的用法与function相同。1.打开v8/src/scanner.cc文件。2.找到function的token转换地方3.在它之上插入func的token,如下所示:退到v8根目录下重新编译:make -j4 native i1
2013-11-16 08:46:18
1073
原创 v8学习---使用内部字段给js添加全局变量
#include #include using namespace v8;void Setter(Local property, Local value, const PropertyCallbackInfo& info){ Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0))
2013-11-10 23:09:48
1449
原创 v8学习---添加js全局变量
#include using namespace v8;int x = 9527;void XGetter(Local property, const PropertyCallbackInfo& info){ info.GetReturnValue().Set(Integer::New(x));}void XSetter(Local property, Local value,
2013-11-10 11:40:41
1340
原创 v8学习---添加有返回值的js全局函数
#include using namespace v8; void get_name(const v8::FunctionCallbackInfo& args){ args.GetReturnValue().Set(String::New("Headool"));}int main(){ Isolate* isolate = Isolate::GetCurrent();
2013-11-10 10:55:03
1822
原创 v8学习---添加带参数js全局函数
#include using namespace v8; void log(const v8::FunctionCallbackInfo& args){ String::AsciiValue ascii(args[0]); printf("%s\n", *ascii);}int main(){ Isolate* isolate = Isolate::GetCur
2013-11-10 10:24:11
1021
原创 v8学习---添加js全局函数
#include using namespace v8; void test(const v8::FunctionCallbackInfo& args){ printf("Hello Headool\n");}int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleSco
2013-11-10 10:11:19
2218
原创 v8学习---js整数转c++ int
#include using namespace v8; int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate); Handle context = Context::New(isolate); Context::Scope context_s
2013-11-10 09:34:35
1427
原创 v8学习---判断是否为函数或对象
#include using namespace v8; int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate); Handle context = Context::New(isolate); Context::Scope context_s
2013-11-10 09:13:41
834
原创 v8学习---c++调用js构造函数
#include using namespace v8; int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate); Handle context = Context::New(isolate); Context::Scope context_s
2013-11-10 01:02:57
1618
原创 v8学习---c++调用javascript的方法
#include using namespace v8;int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate); Handle context = Context::New(isolate); Context::Scope context_scope(context)
2013-11-06 00:22:31
1453
原创 v8学习---获取全局对象成员
参考:http://iammr.7.blog.163.com/blog/static/49102699201201565822189/获取全局对象成员#includeusing namespace v8;int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate);
2013-11-05 22:56:40
1102
原创 v8学习---获取js变量的值
#include using namespace v8; int main(){ Isolate* isolate = Isolate::GetCurrent(); HandleScope handleScope(isolate); Handle context = Context::New(isolate); Context::Scope context_s
2013-11-04 00:38:49
1312
转载 v8学习---Hello world
完全抄自v8文档#include using namespace v8;int main(int argc, char* argv[]) { // Get the default Isolate created at startup. Isolate* isolate = Isolate::GetCurrent(); // Create a stack-allocat
2013-11-03 19:28:59
822
原创 git 恢复文件
在写代码时,可能会误删改文件,这时就需要恢复最近一次提交的版本。sudo git checkout filename_or_directory_name
2013-11-01 10:52:16
447
原创 mongodb导出和导入数据
mongodb导出和导入数据导出mongodump -h hostname_or_ip -d database_name -o output_directory导入mongorestore -h hostname_or_ip --directoryperdb data_directory
2013-10-31 12:01:08
588
原创 mysql 导出导入数据
在数据少时,mysql可以使用mysqldump工具来导出和导入数据导出mysqldump -uuser_name -ppasswd databasename > output.backup导入mysql -uuser_name -ppasswd databasename
2013-10-31 11:04:09
492
原创 Yiibooster popover 鼠标置于popover上 不隐藏
yiibooster bootstrap 的popover控件能够由hover触发,但是一旦想移动鼠标离开原button,进入popover时,popover控件就消失了,很多情况下我们期望它不消失。显然hover触发是不行了,我们自己加代码控制。widget('ext.bootstrap.widgets.TbButton', array(
2013-10-30 17:15:54
1140
原创 ubuntu 64位 链接 v8出错 undefined reference to icu_46
debian, ubuntu, linux mint 64位 链接 libv8 出错 undefined reference to icu_46==================================================出错情形:使用google document自带的例子g++ -Iinclude hello_world.cc -o hello_wor
2013-10-30 14:26:58
1782
原创 ubuntu 64位 编译v8
debian, ubuntu, linux mint 编译v8=========================================================准备编译工具:sudo aptitude install build-essential获取v8:git clone https://github.com/v8/v8.git获取v8的
2013-10-30 11:55:00
1214
原创 linux ssh自动登录服务器
linux 使用tcl脚本自动ssh登录服务器,不必每次都输入密码。=============================================首先要安装expect包(ubuntu)sudo aptitude install expect登录脚本(名为Ssh):#!/usr/bin/expect -fset password 111111se
2013-10-30 11:45:41
619
原创 ubuntu 安装 lamp
debian,ubuntu,linux mint 安装 lamp=============================================有一个tasksel的工具专门安装各种服务sudo aptitude install tasksel运行:sudo tasksel得到:上下键移动,空格键选择,回车键确认安装
2013-10-30 10:46:38
490
原创 linux mint 系统快捷键设置
linux mint 15 设置系统快捷键========================================================="System Tool" => "System Settings" =>
2013-10-30 10:00:17
9494
原创 centos 安装输入法
centos 安装输入法ibus--------------------------------------------------------------------------------------------------
2013-10-28 15:45:05
538
原创 centos 安装 nginx
centos 安装 nginx-1.3.5-------------------------------------------cd /tmpwget http://nginx.org/download/nginx-1.3.5.tar.gztar xvf nginx-1.3.5.tar.gzcd nginx-1.3.5./configuremake -j4sudo
2013-10-28 00:12:18
501
原创 nginx configure error: the HTTP rewrite module requires the PCRE library
nginx-1.3.5 configure:./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE
2013-10-27 11:14:44
1449
原创 nginx配置root, index
root 配置网站的根目录index配置网站的入口文件nginx配置文件放在:/etc/nginx/nginx.conf/etc/nginx/sites-available/default
2013-10-03 09:45:57
2153
转载 php require include
Its quite common to see such lines :require_once('../../lib/some_class.php');This approach has many drawbacks :It first searches for directories specified in the include paths of php , then
2013-01-20 15:40:55
239
原创 ubuntu emacs 输入法失效问题解决办法
首先安装ibus-el:sudo aptitude install ibus-el编辑emacs配置文件,在~/.emacs中加入:(add-hook 'after-init-hook 'ibus-mode-on)重启emacs就能见效
2012-10-25 18:10:56
512
原创 vim cscope E567: no cscope connections
在 ~/.vimrc里加上一句:cs add cscope.out顺便提醒:输入cscope -Rbkq能在当前目录下建索引。
2012-10-25 13:14:53
6724
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人