Category: My Thinking

2011 Review

又到一个年底,回顾一年的变化和目标,幸好有1年前的总结和目标 2010 Summary And 2011 Goals ,可以让我在一年后还能回顾一下以前的计划和现在的完成情况。

关于博客的总结

本年度博客数量有所降低,原因是下半年从主要开发 A 切换到主要开发 B 。而 B 的核心是人工智能,由于领域过于窄,不方便分享一些通用的心得;另一方面写博客的时间变少,有几篇总结性的博客想放到新的一年吧。以下是有一点价值的博文:

关于 Drupal

  1. What is new in Drupal 7
  2. Drupal Views PHP Code Validator
  3. [Drupal] 错误执行MYSQL命令之后如何挽救
  4. Add a custom tab menu in profile edit page in Drupal 7
  5. Why Drupal is not popular in China

Drupal 仍然是快速原型,甚至是生产系统的首选。当然现在更多的人推崇 Rails 或者 Django, NodeJS ,个人也在 2011 对这 3 中技术堆栈进行了认真比较,发现 Drupal 仍然是不二选择。当然 Drupal 只能用在 WEB 的 UI 界面和业务逻辑部分,对性能要求高的地方或者通讯层可以考虑用 NodeJS 或者 Erlang 。假如能自己定主要开发框架,我倒是愿意尝试 Django ,它看起来还是比较完善的。

关于前端开发

  1. JSON JSON-RPC 和 JSONP
  2. JSONP Library In Plain JavaScript With Timeout
  3. Backbone JS框架指南
  4. CoffeeScript – 未来可以取代 JavaScript 的语言
  5. Javascript 设计模式入门

前端部分这年尝试了基于 Backbone 开发,发现它也是个学习曲线比较高的东西,但是一旦熟悉还是很通用的。CoffeeScript 建议不要用,无论如何还是离不开 JS 。2011 前端部分研究比较多,发现 WEB 开发最靠谱的还是纯文本+超链接的方式,将计算分散到客户端是比较不靠谱的想法,尝试各种花哨的前端技术也是不靠谱的,毕竟用户体验才是王道。

关于 WEB 架构

  1. 谈一谈 Scalability 和可扩展的架构设计模式
  2. WEB Development Rookie – NodeJS
  3. Enter Django Development
  4. 细数跨语言通信的选择

NodeJS 可能是 2011 最热门的话题,目前已经在项目 B 用到了生产环境。

其他

  1. What tools and software used for development
  2. XML 文件处理利器 VTD-XML
  3. Encrypt your files or content on cloud services
  4. 如何停止Windows服务器上僵死进程

2011的个人计划完成

  1. 深入IOS , Android开发 未完成
  2. 关注产品的网络营销 完成
  3. 项目1,2,3的开发和营销的0突破 未完成
  4. Improve Algorithm and Linux C DELETED
  5. 继续关注 Marketing, Social information, BI 完成
  6. 换一个拥有大数据量的环境? DELETED

Oh, shit!  好像 2011 并没有按计划进行,但是仍然很充实,有很多收获。

2012个人目标

  1. 进入 IOS , Android 开发
  2. 继续关注市场和营销趋势
  3. 项目方向改进和营销
  4. 构建基于人工智能的解析器
  5. 写更多质量比较好的总结博客
  6. 尝试的模式

I have developed based on Drupal stack for more than 4 years. In my opinion:

  • The learning curve of Drupal is higher than other stacks, since It’s flexibility. 
  • Server environment in China is very poor. Drupal can works well at least installed in VPS.
  • The requirement is very simple in China, you can just install something like DZ forum or DEDE cms to accomplish the goal. Since the feature requirement is not comes from business requirement, they just want a simple web page to display there company profile etc.
  • Lots of teams want to build there own framework. (I disagree with this idea, it is wasting resource and time.)
  • The traffic of the website in China almost 100x larger than EU or US, but the value of the traffic is very low. So you need do more performance optimization for the Drupal site in China.
  • Most developers in China works on a Windows PC. So no drush, varnish, memcache, cron, etc.
  • Lots of developers installed Drupal and thought that Drupal is a blog :)

Django

Introduction:

Django is the modern base stack for web development. Compared with Ruby on Rails, I think I like Django better:

  • Build-in ready to use admin interface
  • Written in Python, with better performance
  • Simpler and reasonable project struct
  • Smaller base stack, but you can add what you want (ajax, south, REST, oauth …)

Essential tools for Django development:

virtualenv

We use this to manage the library for the project. You can have different environments (different python modules, different python versions) for every projects.

Create new clean environment foobar

virtualenv –no-site-packages foobar

Active the environment foobar

source foobar/bin/activate

Then install library in the environment foobar

pip …

At the end leave the environment foobar

deactivate

pip or easy_install

To install python libraries.

Django south

Database migration tool. Alertanative tool for syncdb

Create migration for your app

./manage.py schemamigration myapp –initial

Apply the migration

./manage.py migrate myapp

Then change the model myapp, and make a new migratation

./manage.py schemamigration myapp –auto

And apply it

./manage.py migrate myapp django-annoying

Useful decorators:

rederto ajaxrequest JSONField getobjectorNone

django-compressor

Compresses linked and inline javascript or CSS into a single cached file. And support coffeescript and less css framework.

django-pagination

pagination tools

django-piston

A mini-framework for Django for creating RESTful APIs.

django-celery

Celery integration for Django.

Celery is a task queue/job queue based on distributed message passing.

django-mongodb

MongoDB backend

django-admin-tools

Custom user interface, customizable dashboard

django-socialauth

oauth for social sites, login with twitter account, facebook account or gmail account

django-storages

Amazon S3, MogileFS file storage

django-grappelli

A jazzy skin for the Django Admin-Interface

django-profiles

A simple application which provides basic features for working with custom user profiles in Django projects.

django-registration

User registration and login

simplejson

JSON encoding and decoding

django-imagekit

Image process, support S3.

Beautiful Soup

Web Scrapping tool

django-workflows

django-workflows provides a generic workflow engine for Django.

The Django development environment steps:

How to install the virtualenv & django:

sudo apt-get install python-virtualenv

virtualenv –no-site-packages env_nm

source env_nm/bin/activate

pip install django

… ( install other modules )

deactivate

Export the libraries of the environment to a configuration file

pip freeze > requirements.txt

Install the environment in a clean environment

pip install -r requirements.txt

The missing part of Django settings.py

import os

ROOT_PATH = os.path.dirname(file)

MEDIAROOT = os.path.join(ROOTPATH, ‘static’)

TEMPLATE_DIRS = (

os.path.join(ROOT_PATH, ‘templates’)

)

Django Signals – You should pay attentation to this

This is the ECA (Aka: Event Condition Action) part of Django. 

ECA is the essentail part of modern web appliactions.

Other useful modules:

SQLAlchemy – use this when the django ORM is not enough.

Haystack – Modular search for Django.

Django-mptt – Preorder tree management