Archive for 4月, 2011

Erlang Supervisor 的 error:{badmatch,{error,{{start_spec,{invalid_modules, ??? }} 错误解决

新人,刚开始学习 erlang ,使用 rebar 生成了一个标准的 otp 应用程序,往 Supervisor 加了一个 gen_server ,却通不过默认单元测试了。提示

 
gamexg@vps1:~/erl/cw$ rebar compile eunit
==> cw (compile)
Compiled src/cw_dnode.erl
Compiled src/cw_sup.erl
Compiled src/cw_app.erl
==> cw (eunit)

=INFO REPORT==== 18-Apr-2011::14:53:47 ===
    application: cw
    exited: {{start_spec,{invalid_modules,cw_dnode}},
             {cw_app,start,[normal,[]]}}
    type: temporary
cw_app: simple_test (module 'cw_app')...*failed*
::error:{badmatch,{error,{{start_spec,{invalid_modules,cw_dnode}},
                        {cw_app,start,[normal,[]]}}}}
  in function cw_app:simple_test/0


=======================================================
  Failed: 1.  Skipped: 0.  Passed: 0.
Cover analysis: /home/gamexg/erl/cw/.eunit/index.html
ERROR: One or more eunit tests failed.

最后发现原因是回调模块应该是列表,我却直接把模块名填上了….

 
-module(cw_sup).

-behaviour(supervisor).

%% API
-export([start_link/0]).

%% Supervisor callbacks
-export([init/1]).

%% Helper macro for declaring children of supervisor
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).

%% ===================================================================
%% API functions
%% ===================================================================

start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

%% ===================================================================
%% Supervisor callbacks
%% ===================================================================

init([]) ->
    {ok, { {one_for_one, 5, 100}, 
        [
            {dnode,
                {cw_dnode,start_link,[]},
                permanent,
                10000,
                worker,
                cw_dnode                                 % 这里错了,应该是 [cw_dnode] ,是列表。
            }
        ]
       } }.

No comment »

还是 Godaddy 域名 30% 优惠码

可用于 .com .net 和.org ,没有说过期时间。
优惠码是gdz418c。

No comment »

Godaddy 26% 优惠码

今天收到的优惠码,未提供过期时间,未提供限制。各位如果需要可以试一下。
优惠码是:gdz417p

No comment »

谷歌将字典集成到了标准搜索界面

今天发现谷歌字典界面变了,直接集成到标准搜索界面,就在时光隧道下面。我记得前天用的时候还是原来的版本,应该是昨天或今天更换的。
印象中好像比原来的版本结果更多了,但是还是没有动词名称等标注。集成版的却比原来独立的的使用方便,原来字典不好找基本不用。

No comment »

Godaddy 域名 30% 优惠码

今天刚刚收到的,节省30% ,可用于 .COM、.NET、.ORG 域名,11年4月17前有效。
优惠码是 gdz414p 。

No comment »

3ds max 快速循环不能循环一圈,只建立一部分边的原因。

今天为一个弧形的建筑的窗户建立边,却发现快速循环不能用了,只能建立一点边。最后检查发现时之前把系统建立的弧形的分段边给删了照成了,回退编辑后就恢复了。
目前还不知道除了撤消操作还有什么办法能处理误删分段边的情况,以后只能尽量注意了。其实使用 快速循环 左下的 剪切 工具在删掉分段边后还能建立边,但是不如快速循环方便。

No comment »

3ds MAX 建立弧形建筑(长方体)的办法

很简单,就是建立一个弧形的线,然后挤出+壳就可以出来弧形的建筑了。

具体步骤是:

1.先按建筑的尺寸建立一个长方体来,为下一布做准备。
2.使用 创建-图形-样条线-弧根据第一步建立的长方体来建立建筑的弧面(注意,这里要之一些,之后在修改比较麻烦)。
3.对弧使用 挤出 修改器,数量为建筑的高度。
4.增加 壳 修改器,外部量设置为建筑的宽度。
5.现在弧形就建立完了。可以根据需要增加编辑多边形,增加 UVW贴图 或 UVW展开。

No comment »

把 WordPress 博客迁移到 vps

原来的虚拟主机要到期了,vps正好空着,就打算迁移到vps上。

迁移起来基本没有遇到麻烦,很快就完成了。具体步骤是:

1.把 BackWPup 昨天的备份拷到了vps下解压出来。这里需要注意一下文件的权限问题。
2.照着 wp-config.php 建立了新的数据库和mysql帐号,通过 phpmyadmin 把数据库导入vps。
3.因为我的vps用的是nginx,所以需要处理一下htaccess文件。为 location 段增加以下内容

 
# WordPress pretty URLs
if (-f $request_filename) {
expires max;
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;

# Enable nice permalinks for WordPress
error_page  404  = //index.php?q=$uri;


#下面是 WP Super Cache 支持部分,如果没有WP Super Cache就不需要。
# if the requested file exists, return it immediately
if (-f $request_filename) {
expires 30d;
break;
}

set $supercache_file '';
set $supercache_uri $request_uri;

if ($request_method = POST) {
set $supercache_uri '';
}

# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $supercache_uri '';
}

if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $supercache_uri '';
}

# if we haven't bypassed the cache, specify our supercache file
if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /var/www/wp-content/cache/supercache/$http_host/$1index.html;
}

# only rewrite to the supercache file if it actually exists
if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}

# all other requests go to WordPress
if (!-e $request_filename) {
rewrite . /var/www/index.php last;
}

4.登录博客后台,修改一下BackWPup文件的备份路径。
5.WP Super Cache 的路径也需要修改一下,打开 wp-content/advanced-cache.php 修改一下就可以了。

6.在处理一下 BackWPup 的备份目录,禁止下载备份。在nginx配置文件里面加上下面的内容

 
        location /wp-content/backwpup {
                deny all;
        }

这样就把 WordPress 迁移完成了。

备注:发现BackWPup插件自动备份出现了问题,会使php5-cgi 进程cpu使用率达到100%,并产生数G的日志占满磁盘空间。删除旧的备份计划,并建立新的备份计划就可以解决了。

Comments (3) »