Nitrogen web framework 入门

Nitrogen web framework 入门

Author:litaocheng@gmail.com
Data:2009-1-23
Version:0.1

1   概述

Nitrogen是一个使用Erlang开发的Web Framework

2   特性

  • 事件驱动模型(和ASP.NET相似,和Ruby On Rails不同)
  • 简洁高效:只有~2.5k行代码实现
  • 与JavaScript等脚本的交互
  • 支持Client和Server的Form验证
  • Coment和Long Polling的支持
  • 通用的Ajax相关控件实现
  • 页面表现与逻辑独立
  • 页面文件为纯粹的Erlang代码
  • 多种HTTP Server配置

3   期待

  • 丰富的文档
  • 完善的错误处理机制
  • 丰富的调试工具
  • 页面热替换
  • 可配置javascript lib,比如"jquery", "Mootools", "MochiKit "等
  • 提供多种数据库访问
  • 精简Nitrogen中各种标签的定义及设置
  • 制定一些通用web模型

4   术语(Glossary of Terms)

  • application 包含很多的page
  • 每个 page 包含很多 element ,nitrogen将其render为html tag
  • 每个element可以关联一个或多个 action ,在浏览器中控制page
  • 有些action可以成为 event ,event会从浏览器端postback到server端进行处理

5   应用的结构

一个Web Application其实就是Erlang OTP中的一个Application,这个Application我们可以通过脚本来进行创建. 包含下面的内容:

  1. html模板文件(包含html,css,image,通常位于/wwwroot/目录下)
  2. erl页面代码(包含myapp.app, *.erl文件,通常位于/src/目录下)
  3. start.sh启动脚本(用来启动本应用,实质是调用erl启动Application)

Nitrogen默认的路径映射规则,是将 / 转化为 _ ,比如: http://domain/web/user 对应的页面文件为 web_user.erl

用户也可以通过定义myapp:route/1函数,定义自己的路径映射规则。

开发一个应用,首先我们设计编辑html模板页面,随后编写erl页面代码,最后是编译部署,启动。

6   一个简单的例子

创建一个Web版的"Hello World":

$ mkdir myfirstweb
$ cd myfirstweb
$ nitrogen create helloworld
 Copy Nitrogen Static: "livevalidation.js"
 ...
 Creating file: "helloworld_app.erl"
$ ls
doc        ebin       Emakefile  Makefile   src        start.sh   wwwroot
$ cd src/pages/
$ ls
web_index.erl

接下来让我们编辑web_index.erl::

-module (web_index).
-include_lib ("nitrogen/include/wf.inc").
-compile(export_all).

main() ->
       #template { file="./wwwroot/template.html"}.

title() ->
       "hello world".

body() ->
   [
       #h1{text ="My First Nirogen Web"},
       #panel{text = "Hello World"}
   ].


event(_) -> ok.

保存后,继续:

$ cd ../..
$ ./start.sh
Starting Nitrogen.
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6.5  (abort with ^G)
(nitrogen@localhost)1> Recompile: ./src/pages/web_index

--- Nitrogen is now running on inets. Serving files from: ./wwwroot. Open your browser to: http://localhost:8000 ---

启动浏览器,URL:http://localhost:8000/ 看到Hello World了吧。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
Rab GTPases serve as master regulators of membrane trafficking. They can be activated by guanine nucleotide exchange factors (GEF) and be inactivated by GTPase-activating proteins (GAPs). The roles of some GAPs have been explored in Saccharomyces cerevisiae, but are largely unknown in filamentous fungi. Here, we investigated the role of GAP Gyp3 gene, an ortholog of S. cerevisiae Gyp3, in an entomopathogenic fungus, Metarhizium acridum. We found that MaGyp3 is mainly localized to the endoplasmic reticulum (ER) of vegetative hyphae, nuclei of mature conidia, and both ER and nuclei in invasive hyphae. Lack of MaGyp3 caused a decreased tolerance to hyperosmotic stress, heat-shock and UV-B radiation. Moreover, the ΔMaGyp3 mutant showed a significantly decreased pathogenicity owing to delayed germination, reduced appressorium-mediated penetration and impaired invasive growth. Loss of MaGyp3 also caused impaired fungal growth, advanced conidiation and defects in utilization of carbon and nitrogen sources, while overexpression of MaGyp3 exhibited delayed conidiation on nutrient-rich medium and conidiation pattern shift from microcycle conidiation to normal conidiation on nutrient-limited medium. Mavib-1, a tanscription factor invloved in conidiation by affecting nutrient utilizaiton, can directly bind to the promoter of MaGyp3. ΔMaGyp3 and ΔMavib-1 mutants shared similar phenotypes, and overexpression mutants of MaGyp3 and Mavib-1 (Mavib-1-OE) exhibited similar phenotypes in growth, conidiation and pathogenicity. Reintroduction of the Magyp3 driven by strong promoter gpd in ΔMavib-1 mutant recovered the defects in growth and conidiation for dysfunction of Mavib1. Taken together, our findings uncovered the role of GAP3 in a filamentous pathogenic fungus and and illustrated the upstream regulatory mechanism by direct interaction with Mavib-1.请用nature杂志的风格润色成学术论文的形式。
02-10

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值