ITeye博客

2011 年文章归档

共 12 篇文章

一句话总结-Git服务器Gitosis架设

安装完gitosis以后要记得修改post-update权限 sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

2011-12-29 13:30 · Software

总结总结~

总结: 1. 重构:类中某个方法,纠结于多个出口与do{}while()+ret_code+break的方式,多个出口 - 行数稍少,但是return太多太刺眼,do{}while - 行数太多.纠结良久,拆分原函数变为5行,另两个函数一个变为8行,一个变为20行;还是易读性最重要,当纠结的时候,拆分逻辑吧.槑. 2. autoconfigure,automake:纠结于link: too few arguments. g之无解,只好用有限的理解读configure,加--disable-dependency-tracking解决之.圡. 3. 外链一第三方库,见2,成功配置生成静态库.co…

2011-11-28 19:39 · C/CPP Dev

spawn-fcgi配置C的fastcgi程序

网上一般会说有了spawn-fcgi以后,不需要lighttpd,那应该是针对PHP. 针对C写的fastcgi程序,应该还是需要lighttpd来转一下的.直接访问的话,得到的是空白页.猜测lighttpd调用c的fastcgi程序时候,传递了一些特殊的参数. spawn c-fcgi process的script spawn.sh: spawn-fcgi -n -a 127.0.0.1 -p 9000 -- lighttpd的配置: lighttpd.conf: 在fastcgi.server域内加一行: "/fcgi" => ( ( "host" => "127.0.0.1", "po…

2011-10-19 12:15 · Web Server

centOS下lighttpd&(g)vim编译安装

类似于 XXX package where not found, install them or build with --without-XXX 或 XXX-headers and/or libs where not found, install them or build with --without-XXX 用yum -y install XXX-devel. devel应该为development version了. 配置fastcgi的时候,需要确认php等是否是支持fastcgi的版本. 若为C/C++,下载fastcgi的API/libraries,编译安装,设置LD_LIBR…

2011-10-12 14:15 · Web Server

redis 事件处理机制及其它

关于redis的事件处理机制,网上有很详细的源码解析了,基于2.0.4的,URL如下: redis源代码分析8–事件处理(上) redis源代码分析8–事件处理(中) redis源代码分析8–事件处理(下) 小总结: 初始化:在redis.c中initServer调用aeCreateEventLoop,并建立了现有唯一的一个time event:serverCron. 使用:在redis.c中main 1) 调用aeSetBeforeSleepProc设置beforeSleep函数,我看的源码是2.2.1的,功能比2.0.4稍作改变,加上了处理之前等待BLPOP的已经unblock的clie…

2011-08-19 17:28 · C/CPP Dev · redis

Redis 存储结构分析,及哈希相关

Redis 是支持多 key-value 数据库 ( 表 ) 的 , 并用 RedisDb 来表示一个 key-value 数据库 ( 表 ). redisServer 中有一个 redisDb *db; 成员变量 , RedisServer 在初始化时 , 会根据配置文件的 db 数量来创建一个 redisDb 数组 . 客户端在连接后 , 通过 SELECT 指令来选择一个 reidsDb, 如果不指定 , 则缺省是 redisDb 数组的第 1 个 ( 即下标是 0)redisDb. 一个客户端在选择 redisDb 后 , 其后续操作都是在此 redisDb 上进行的 . dictT…

2011-08-18 15:29 · C/CPP Dev · redis

Redis string的小笔记

数据结构定义: struct sdshdr { long len; long free; char buf[]; }; 1) buf是一个变长数组,指向真正的字符串,非指针*; 2) len存储字符串总长度,保证o(1)的长度获取操作; 3) free存储空闲字符长度. 简短精悍. 新建一个字符串: sds sdsnewlen(const void *init, size_t initlen) { struct sdshdr *sh; sh = zmalloc(sizeof(struct sdshdr)+initlen+1); #ifdef SDS_ABORT_ON_OOM if (sh =…

2011-08-17 17:17 · C/CPP Dev · redis

Some tips from the architeture of StackOverflow(cont. 1)

Software: 1)HAProxy(load balancer) HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. …

2011-08-03 10:46 · HS Server Tips

android开发随记 - Google Map

Google Map开发教程: http://marakana.com/forums/android/examples/311.html 开发环境Eclipse + ADT, 需要首先下Android SDK并按需求更新. 一般的选择性的会只下Android的package, 要用Google Map, 需要下Third party Add-ons中的Google APIs. 如教程所说,需要申请Google Map的API key. 新建项目时,Build Target需选Google APIs. 运行时报错: Installation error: INSTALL_FAILED_MISS…

2011-06-22 15:21 · Mobile Dev

拷贝构造函数的相互调用?

G++ error: Error: declaration of xxx shadows parameter Explanation: http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.3 Can one constructor of a class call another constructor of the same class to initialize the this object? Nope. Let's work an example. Suppose you want your constructor Foo::…

2011-05-18 18:01 · C/CPP Dev

Some tips from the architeture of StackOverflow

Definition(from Scaling up vs. Scaling out ): scaling up -- a seriously big iron single server. scaled out -- Hadoop or MapReduce style, across lots and lots of inexpensive servers. Other factors(per year): software licensing: if using all open source software, close to zero. power cost. Scaling up…

2011-03-29 17:12 · HS Server Tips

DTrace相关

最近在看DTrace,记录下点滴: 文档推荐: 1.入门: DTrace Quick Start Guide: Observing Native and Web Applications in Production (PDF) 2.循序渐进:Learning DTrace Series * Part 1: Introduction (pdf) * * Part 2: Scripts and the D Language (pdf) * * Part 3: Advanced Scripting and Aggregations (pdf) * * Part 4: Solving Everyda…

2011-02-17 11:01 · Performance Tuning