effective life plus

Binzy's blog

深入PHP :面向对象,模式与实践

| Filed under Programming

书终于在上个月出版了,而我对翻译的记忆的细节已经完全模糊了,只依稀记得那是从2007年到2008年。刚开始的时候是第一版,然后第二版出来了,然后继续翻译,因为2版之间区别不大。大部分的时间都是haohappy在沟通和协调,而我仅是负责我的那部分。虽然我也已然记不大清我具体负责了哪几章,大体是模式那部分。书最终还是出版了,虽然有读者抱怨说原书第三版已然出版,但我还是想说,虽然是第二版,书还是好书。这本书是为数不多的把面向对象,模式及相关良好实践阐述的比较清晰和深人,并且按照PHP的方式来阐述的书。虽然书中的一部分内容,现在看来有些许过时,但理论是一致的。大部分应用软件开发的成本如果不计质量(当然也不计研发),那主要在于单位时间的人力成本及时间总量。而优秀的设计,模式和实践都有助于降低成本及提高或保持质量。

原书的第三版从目录来看,更新了一些有些过时的内容,比如版本管理从CVS改为SVN,针对PHP5.3的一些新特性添加了一些内容,并且加入了持续集成这样的重要敏捷元素章节。

不得不说,翻译比我想象的要累得多。不仅要考虑到原作的表达,也要符合中文的习惯。希望我的翻译不是太糟糕。
更多关于本书,可前往douban等网站,也希望大家多批评指正。

Expand Short Url & Google App Engine

| Filed under Cloud Programming

1. I decided to play around with Python several months ago, but the only thing I’ve done is once creating a script to retrieve an online manual with still few understanding of python. I think I should keep trying…

2. I’m living in China within the famous GFW, and I’m using a twitter proxy site to tweet when I’m at home or using mobile phone.   So there is a problem to me, the http://bit.ly is almost the most popular short url service on twitter which is also blocked by GFW…

3. There are some short url expanding service sites, like http://longurl.org, but they were blocked sometime…

I decided to create a simple function with google app engine after dinner. So that I can continue to learn some of python and also know a little of google’s cloud stuff.

Then here you go the app: http://yatlongurl.appspot.com/ and the source code here. Really quite fun to write code with python. But it looks the app will be intermittently unavailable. And apparently, I did not use any of real functionalities of google’s app engine. Possibly I will add support to automatically retweet or delicious the useful link while expanding it .

Is Windows Phone 7 Series the One I Expect?

| Filed under Mobile

Microsoft announced WP7 series on WMC2010. (Announce video: http://www.youtube.com/watch?v=5q-HtdW03Zs, pretty cool!) And there are lots of people are talking about it. But what I expect of a mobile OS? I write this down 9 months ago:

1. Small/Micro kernel.
2. Powerful UI.
3. Simple Application development.

And what I can see now is it really has an innovative UI and I like it. The kernel should be neat althought it definitely should be based on Win CE (guess). So what I really want to know is how to develop app based on this new UI. It should bring a tough switch… But let’s check it out on MIX10

6 Key points of a successful project with fixed deadline

| Filed under PM

Last November, we were about to move to our new apartment in 4 weeks. The bathroom, living room were planned to be re-decorated completely and we planned to partially make kitchen and bedroom up. And we only had a small amount budget and we are both quite busy on our full-time job. But finally I think we are pretty successful on this project since following six things.

1. Good Plan
Stick to your budget, make a well plan according to your real needs and budget. Never trying to achieve more than  reality. Clearly write down the items into a backlog with milestones/check points.

2. Clear Defined Scope
This should be part of the plan, but I separate it since it is critical to the whole project.  If you really want to extend the scope, that means either the project will be delayed or you have to remove something from the scope finally.

3. A Good Team Lead
A good team is always required for any successful project. But a good team lead is much more important. A good team leader means a lot of things, like:
a. Accurate data of status which is also in time
b. Appropriated arrangement
c. Risks identified
d. Agile, frankly, without a great team lead (a good scrum master or project manager),  you are not able to be real agile.

4. Choose Good Suppliers
During the whole decoration period, you need to buy lots of stuff. If time is not a matter, it will be pretty OK to find cheap stuff with good quality. But it’s not the case to me. So there are only two places where I bought things I need, they are IKEA and B&Q. IKEA almost always has goods in stock while B&Q almost has everything. Another great thing of this kind of supplier is that they sell at expressly marked price and I can easily manage the account.

5. Delegation
You have to delegate many things to the project/team leader, as they are good at the decoration and you should put your time and effort to the things you most concern. So look back to your project backlog and see what you must to do in person.

6. Compromise
No perfect. You have to make trade-offs. Make decisions based on the values not the feelings.

nginx + Zend Framework @ Windows

| Filed under Programming

If you feel pretty boring with Apache, just like me, so having a try of nginx might be good idea. Although at most of my time, I’m using Windows, fortunately, nginx has native Windows build. So my steps might be helpful to you to try nginx on Windows, especially Windows 7.

1. Download nginx and php and install

2. Configure nginx and php

  • PHP, no specific configuration, just do what you like to php.ini.
  • Nginx
    Fast-CGI of php
    You can find sample from wiki.nginx.org, http://wiki.nginx.org/PHPFastCGIOnWindows, below works for me.
    location ~ \.php$ {
                fastcgi_pass   127.0.0.1:9999;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  D:/www/public/$fastcgi_script_name;
                include        fastcgi_params;
            }

    Configure for Zend Framework
    -f and !-f are used for checking whether file exists.
            error_page 404 /index.php;
    
            if (!-f $request_filename) {
                rewrite ^.*$ /index.php last;
                break;
            }

3. batch script to start and stop nginx + php-cgi

I’m using RunHiddenConsole to hide the prompt window and actually you also can use vbs to run nginx.

start-nginx.bat

@ECHO OFF
ECHO Starting PHP FastCGI...
C:\nginx\RunHiddenConsole.exe C:\PHP5\php-cgi.exe -b 127.0.0.1:9999
ECHO Starting nginx...
C:\nginx\RunHiddenConsole.exe c:\nginx\nginx.exe

stop-nginx.bat
@ECHO OFF
ECHO Stopping nginx...
taskkill /F /IM nginx.exe
ECHO Stopping php-cgi...
taskkill /F /IM php-cgi.exe

but php-pfm doesn’t work on Windows unless you are using cygwin.

nginx_zend