十一假期小结

还有一堆事情没做,但忍不住小结一下。

  • 家庭:回京郊老家三天,回三河老家一天,见亲朋若干,和姑姑家聚会一次
  • 朋友:高中同学聚会一次
  • Coding:把几个在Thrift上想实现的东东给实现了个原型,下面细说
  • 微笑网公益购物:给“最近订单”页添加了分页,这样可以查看全部订单,而不仅是最近50条了。其实就花了10几分钟查了一下CodeIgniter文档就写好了。在微笑网花的时间太少了,检讨。
Thrift服务的可用性、可管理性、实现细节这三个方面都做了些事情,挺满意的,只可惜还都是原型,还有很多工作要做。
  1. 提供了Service的Base(基于fb303),以及相应的Java实现基类,为Thrift服务的可管理性做一个基础。
  2. 重温了Django,基于Django和1中的规范,实现了Thrift Service配置管理界面和监控界面。
  3. 写了Java的Thrift Client Connection Lib,以便通过Client端机制实现Thrift Service的集群,提高服务可用性。
  4. 写了Java的Thrift Server辅助类,为了方便Server的代码编写,更是为了统一和提高Server的代码质量。

Related posts

关于CodeIgniter的URL的一些事儿

想让首页显示自己写的静态的index.html而不用ci的index.php?(Apache中的配置)

RewriteEngine on

RewriteCond $1 !^(index\.php|images|css|js|(.*)\.html|robots\.txt|$)

RewriteRule ^(.*)$ /index.php/$1 [L]

 

其中RewriteCond中最后的$起到的作用就是不把’GET /’请求Rewrite给index.php。这时,结合DirectoryIndex设置中index.html和index.php的先后顺序,你就能控制apache到底是显示index.php还是index.html了。

如何去掉CodeIgniter的url Helper会自动在url里添加的index.php?

默认设置下url Helper会把url弄成这样:http://localhost/index.php/logout。要去掉index.php,修改config.php文件:

$config['index_page'] = ”;

Related posts

SAE的运营

发了把CodeIgniter移植到SAE之后,半天之内就有一个人在我blog留言,另一个人在我的微博回复。指出文章的问题,给出解决的指导,现在原文已经修。非常不错!他们应该是SAE团队的成员,非常欣赏这样的态度,工作就应该如此,做自己喜欢的,喜欢自己所做的。

Related posts

在SAE运行CodeIgniter

昨天试用了phpfog,今天想起来SAE是一个国内的选择哦,就试用了一下。把CodeIgniter放到SAE下运行的过程记录一下。总的来讲:原始版CodeIgniter在SAE运行需要被阉割。但可以到网上找正式的SAE移植版,会work的更好(感谢@文峰186 提醒)。在普通服务器运行的程序很难直接在SAE运行,反之亦然。准备使用SAE的要想好这一点!

样例见:http://weixiao.sinaapp.com/ci/

CodeIgniter 版本为2.0.2。写的是只有一个controller、一个view、不使用DB的最简单的app,在做了如下“裁剪”后就可以在新浪的SAE环境下运行了。

– function set_magic_quotes_runtime() is forbidden for SAE security @ line 67, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/core/CodeIgniter.php        注释掉,反正SAE就是php5.3    — function flock() is forbidden for SAE security @ line 425, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/core/Output.php        注释掉,不就是cache嘛,而且不上锁也不会死人吧?    — function flock() is forbidden for SAE security @ line 58, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/helpers/file_helper.php        注释掉,不上锁不会死人    — function mysql_pconnect() is forbidden for SAE security @ line 88, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/database/drivers/mysql/mysql_driver.php        删除文件。。。不用它的数据库连接    — function mail() is forbidden for SAE security @ line 56, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/helpers/email_helper.php        删除文件。。。不发邮件    — function apc_delete() is forbidden for SAE security @ line 72, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Cache/drivers/Cache_apc.php        删除文件。。。不用apc cache。。。    — function mail() is forbidden for SAE security @ line 1526, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Email.php        删除文件。。。不发邮件    — function exec() is forbidden for SAE security @ line 603, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Image_lib.php        删除文件。。。不处理图片    — function flock() is forbidden for SAE security @ line 101, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Log.php        注释掉。。。不上锁死不了人    — function fsockopen() is forbidden for SAE security @ line 236, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Trackback.php        删除文件。。。不用这个lib    — function fsockopen() is forbidden for SAE security @ line 386, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Xmlrpc.php        删除文件。。。不用xmlrpc    — function flock() is forbidden for SAE security @ line 365, E:\SDKs\SAE_SDK\apps\/weixiao/1/code/ci/system/libraries/Zip.php        注释掉。。。不锁文件死不了人

—-

2011/5/20 update:加入@文峰186 的提醒

Related posts

CodeIgniter, CakePHP and phpfog

CodeIgniterCakePHP都是使用非常广泛的PHP Web框架。都非常优秀,相信任何一个框架都是能满足需求。只是某个应用场景下哪个框架更好,哪个框架更适合的问题。

  • CakePHP文档很好,但CodeIgniter文档更好。
  • CodeIgniter更简单、核心框架更小。这是双刃剑,好处是运行性能更高、更灵活,坏处是不像CakePHP那么多现成的东西可以拆箱即用。
  • 由于上面两点,CodeIgniter上手更容易,如果你熟悉php、对MVC有了解,那我打赌你可以在两个小时内上手。CakePHP则不行,需要理解的东西比较多。

对于我来讲,php初级水平、主要为兴趣而学习、无特定目的,CodeIgniter更合适。

phpFog是HeroKu模式在php下的克隆,使用非常顺手,10分钟之内就搭起来一个测试站点,域名也配置好了。http://phpfog.lixy.us/,而且访问速度还挺快的,http访问、git访问都不错。再次表达对美国IT环境的羡慕。

Related posts

Debian 6.0新特性

Debian 宣布下一代 stable 版 Debian 6.0 Squeeze 进入冻结。这标志着 Debian 6 Squeeze 不会再加入新特性,工作重点将转移到改进稳定版本的质量上来。

既然Debian 6.0的特性列表冻结了,那么我就来列一下Debian 6.0的新特性吧:

  • linux内核版本:2.6.32
  • 桌面环境:KDE 4.4.5, Gnome 2.30.0, LXDE 0.5.0, XFCE 4.6.2, X.org 7.5, OpenOffice.org 3.2.1
  • Apache版本:2.2.16
  • 编程语言:PHP 5.3.2, Python 2.6, Python 3.1, Perl 5.1
  • Gcc:4.4
  • 数据库:MySQL 5.1.48, PostgreSQL 8.4.4

BTW1:Debian给每一个版本起一个名字,让使用者无端增加了记忆成本。Debian 6.0叫Squeeze。

BTW2:Debian是我用的最顺的Linux系统。

Related posts

SugarCRM和AD集成

好久没有技术贴了,盖因为公司的产品工作搞得我欲死欲生。幸好上周商务的同时给我找了一个搭建CRM的活儿。这活儿是晓华推荐的,因为我以前公司用过SugarCRM。那时是王征同学配置的,现在他项目太紧,我就自己搞了。

安装配置没什么好说的,成熟的产品了,很容易搞定。稍微说一下SugarCRM和Active Directory的集成。公司OA都基于MS的Exchange,为了减少帐户管理的麻烦,所以后面上的管理系统都走Exchange的Active Directory认证。挺好的,比每个系统套自己的用户方便多了,而且Jira、Confluence等对LDAP的支持都很好。

SugarCRM和AD的集成主要参考了:http://www.sugarcrm.com/wiki/index.php?title=Integrating_SugarCRM_with_Windows_Active_Directory

在Sugar的后台“User password”中设置如下:

Click Enable LDAP
In Server enter the FQDN of your Active Directory Server , eg hq.example.com
In Port enter 389
In Base DN, enter OU=Users,DC=hq,DC=example,DC=com, where the OU corresponds with the location of your users.
In Bind Attribute, enter userPrincipalName
In Login Attribute, enter samaccountname
In Authenticated User, enter username@hq.example.com, where username is a user you’ve added for the purpose of authenticating users.
In Authenticated Password, enter the password of the user

后来遇到的问题是“LDAP Error: Extensions not loaded”,经查是这台linux上的PHP没有安装LDAP模块,装上就万事大吉了。

Related posts

网址缩短站程序yourls.org的安装配置

安装需求:

  • apache:enable mod_rewrite, apache要加载了mod_rewrite
  • apache:AllowOverride All, yourls需要自己的.htaccess,apache要允许加载它
  • php
  • mysql

安装配置过程:

  • 主要过程从略。官方文档,以及自带的readme.html里都说的非常清楚了。
  • 我出现的一个问题是:完成安装后浏览器再次访问http://yoursite/admin/目录,没有看到后台,而是安装成功的页面,困扰了我一下。原因是浏览器缓存。
  • cp sample-public-front-page.php.txt index.php,这样你的网站就有一个开放给所有用户的前台了。

样例:

Related posts

debian, php: command not found

先说结果:apt-get install php5-cli,搞定“php: command not found”

再说过程:在debian上安装php:apt-get install php5,之后运行php命令依然带到这个错误“php: command not found”。

原来apt-get install php5并不安装命令行程序。用下面命令可以看到php的命令行是在php5-cli这个package下的。

zerg1:~# apt-cache search php5|grep command
php5-cli – command-line interpreter for the php5 scripting language

很久不写程序、装系统了,这两天在公司的虚机上弄一个debian玩玩儿。Debian比redhat果然管理方便很多了,二者的区别就像王征今天讲的cakePHP和spring MVC的区别,都能用但工作效率差不少。

打算一段时间内所有程序都尽量用php写,以便尽快熟悉这个语言。

Related posts