Category: Life & Work

近期Web项目的开发和运营的经验,以下几条适合小型团队在资源和时间都有限的情况下做高效开发:

1. 快速开发和迭代

应该在最短时间内验证一个feature或者一个想法行得通还是不容易实现。这样还有时间进行系统的重新设计。最先验证feature中的关键点是否可行,再将所有关键点进行串联,和系统整合。

2. 提早进入运营和市场

我们都工作在互联网时间,每天互联网都在发生翻天覆地的变化,不进则退。同样的创意,世界上有很多团队在把它变成产品。

3. 高效运行

将现有系统尽可能的做得快速运行,减少数据冗余。以备以后需求增长中执行速度变慢。

4. 容错和并行化

每个请求,数据返回都可能失败或成功,需要不定的时间长度。所以系统要尽可能做到并行,容错。互联网项目尤其是这样,网络环境不是可信环境。

5. 易于维护和管理

项目中期应该做到容易监控和维护。

Tips About Mysql And SimpleDB

Zerofill feature of Mysql:

All rows of the field store the integer value in the same length, this feature is usable for generating invoice ID or SKU number:

create table t (t int(3) zerofill);

insert into t set t = 10;

select * from t;

+——+
| t       |
+——+
| 010|
+——+

Something about Amazon SimpleDB

Sort feature added to SimpleDB. You can use the query ORDER BY. But if you want to sort the result set by a attribute , you should judge the exist of the attribute first WHERE A IS NOT NULL AND ORDER BY A DESC.

Eventual Consistency, that means when you put some data the latency maybe 1 second or longer, you can not get the data immediately.

A cache layer is needed if your system require returning result real time.

启用了 Boost 模块缓存整个网站,或者需要在站外调用 Drupal 网站的数据,如何调用 Drupal 中的动态数据?

Ajax 调用 Drupal 中的 block 需要以下步骤

  • 启动 Drupal 页面
  • 动态输出 block 的内容,json 格式或者 html 格式
  • 在目标页面中 Jquery 输出 Ajax 调用的数据

启动 Drupal 输出HTML格式内容

1
2
3
4
5
6
7
<?php
// block.php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$block = module_invoke('statistics', 'block', 'view', 0);
print $block['content'];
?>

在目标页面中 Jquery 输出 Ajax 调用的数据

1
2
3
4
<div id="info"></div>
<script>
$('#info').load('/block.php')
</script>