虎克的博客

Enthusiasm Biogeography-Biodiversity Informatics-Data Sciences

如何在Ubuntu上删除Munin服务及其软件包

| Comments

$ apt-get –purge munin
E: Invalid operation munin
$ dpkg –purge munin
(Reading database … 36418 files and directories currently installed.)
Removing munin …
Purging configuration files for munin …
The generated web site or accumulated data won’t be removed.
Processing triggers for man-db …
$ dpkg –purge munin-node
(Reading database … 36374 files and directories currently installed.)
Removing munin-node …
Stopping Munin-Node: done.
Purging configuration files for munin-node …
dpkg - warning: while removing munin-node, directory `/var/lib/munin’ not empty so not removed.
Processing triggers for man-db …


然后再根据信息提示删除相应的文件夹:$ rm -r /var/lib/munin

如何在ubuntu下修改文件权限-网站访问配置

| Comments

2010-02-25_00015

先来了解一下文件属性,
在shell环境里输入:ls -l 可以查看当前目录文件。如:
drwxr-xr-x 2 nsf users 1024 12-10 17:37 下载文件备份
分别对应的是:
文件属性 连接数 文件拥有者 所属群组 文件大小 文件修改时间 文件名
这里r是可读,w可写,x 可执行,其中文件属性分为四段,—- — — 10个位置
例如:
d rwx r-x r-x
第一个字符指定了文件类型。在通常意义上,一个目录也是一个文件。如果第一个字符是横线,表示是一个非目录的文件。如果是d,表示是一个目录。
第二段是文件拥有者的属性,
第三段是文件所属群组的属性,
第四段是对于其它用户的属性,
如上面文件夹“下载文件备份” 的访问权限,表示文件夹“下载文件备份” 是一个目录文件;文件夹“下载文件备份” 的属主有读写可执行权限;与文件夹“下载文件备份” 属主同组的用户只有读和可执行权限;其他用户也有读和可执行权限。
确定了一个文件的访问权限后,用户可以利用Linux系统提供的chmod命令来重新设定不同的访问权限。也可以利用chown命令来更改某个文件或目录的所有者。利用chgrp命令来更改某个文件或目录的用户组。
chmod 命令
功能:chmod命令是非常重要的,用于改变文件或目录的访问权限.用户用它控制文件或目录的访问权限.
语法:该命令有两种用法。一种是包含字母和操作符表达式的文字设定法;另一种是包含数字的数字设定法。
1. 文字设定法
chmod [who] [+ | - | =] [mode] 文件名?
参数:
操作对象who可是下述字母中的任一个或者它们的组合:
u 表示“用户(user)”,即文件或目录的所有者。
g 表示“同组(group)用户”,即与文件属主有相同组ID的所有用户。
o 表示“其他(others)用户”。
a 表示“所有(all)用户”。它是系统默认值。
操作符号可以是:
+ 添加某个权限。
- 取消某个权限。
= 赋予给定权限并取消其他所有权限(如果有的话)。
设置mode所表示的权限可用下述字母的任意组合:
r 可读。
w 可写。
x 可执行。
X 只有目标文件对某些用户是可执行的或该目标文件是目录时才追加x 属性。
s 在文件执行时把进程的属主或组ID置为该文件的文件属主。方式“u+s”设置文件的用         户ID位,“g+s”设置组ID位。
t 保存程序的文本到交换设备上。
u 与文件属主拥有一样的权限。
g 与和文件属主同组的用户拥有一样的权限。
o 与其他用户拥有一样的权限。
文件名:以空格分开的要改变权限的文件列表,支持通配符。
在一个命令行中可给出多个权限方式,其间用逗号隔开。例如:chmod g+r,o+r example
使同组和其他用户对文件example 有读权限。
chgrp命令
功能:改变文件或目录所属的组。
语法:chgrp [选项] group filename?
该命令改变指定指定文件所属的用户组。其中group可以是用户组ID,也可以是/etc/group文件中用户组的组名。文件名是以空格分开的要改变属组的文件列表,支持通配符。如果用户不是该文件的属主或超级用户,则不能改变该文件的组。
参数:
- R 递归式地改变指定目录及其下的所有子目录和文件的属组。
例1:$ chgrp - R book /opt/local /book
改变/opt/local /book/及其子目录下的所有文件的属组为book。
chown 命令
功能:更改某个文件或目录的属主和属组。这个命令也很常用。例如root用户把自己的一个文件拷贝给用户xu,为了让用户xu能够存取这个文件,root用户应该把这个文件的属主设为xu,否则,用户xu无法存取这个文件。
语法:chown [选项] 用户或组 文件
说明:chown将指定文件的拥有者改为指定的用户或组。用户可以是用户名或用户ID。组可以是组名或组ID。文件是以空格分开的要改变权限的文件列表,支持通配符。
参数:
- R 递归式地改变指定目录及其下的所有子目录和文件的拥有者。
- v 显示chown命令所做的工作。
例1:把文件shiyan.c的所有者改为wang。
$ chown wang shiyan.c
例2:把目录/his及其下的所有文件和子目录的属主改成wang,属组改成users。
$ chown - R wang.users /his

生物多样性信息学研究进展

| Comments

生物多样性信息学研究进展

 

摘要:生物多样性信息学是一门年轻而蓬勃发展的新学科。它将现代的信息技术带入生物多样性及其相关学科的研究领域。它在生物多样性基础数据的数字化、模型工具、专家系统、数据整合,全球、地区和国家性生物多样性网络等多个方面的发展,向我们展示了未来在全球范围内自由、免费获取生物多样性研究信息和数据的局面,并为我们实现全球保护战略目标,解决生物多样性危机,全球气候变化条件下生物多样性资源管理和利用奠定了坚实的信息基础。

关键词:生物多样性,信息学,数据库,物种,标本,地理信息系统

Progress in Biodiversity Informatics

Abstract: Biodiversity Informatics is a young and rapidly growingfield that brings information science and technologies to bear on the data andinformation generated by the study of biodiversity and related subjects. Recentyears, biodivesity informatcis community make an extrondinary efforts in digitizationof primary biodiversity data, modelling tools, expert system, data integration,and county/regional/global biodivesity networks. In doing so, it is creatingunprecedented global access to information and data produced by biodiversityscience; it is also building a strong information facilities in implementing thegoals set by Global Plant Conservation Strategy, resvolving biodiversity crisisand management of biodiversity resource in global climate change scenarios.

Key words: Biodiversity, Informatics, Database, Species, Specimen, GIS

前言

信息技术的发展对科学研究的影响是巨大的。从基础数据的采集、信息存储、分析到科学假设的形成和验证,所有科学研究的相关活动在计算机和网络技术的帮助下正逐渐自动化。在21世纪,信息技术在支持测试、计算公式、提出假说等方面将继续扮演日益重要的中心角色。科学的计算机化具有很高的潜在利益—从广泛的科学数据中产生知识,为各类技术创新铺平道路,这些技术创新从个性化机器到处理和避免气候变化的影响包罗万象(Muggleton, 2006)。

数字地球、数字城市、数字电视、数字图书馆、数字地图……,不仅仅是时髦的词汇,而是现代知识创新、知识转移和知识传播信息时代的形象表达。在科学诸多领域中,生命科学所具有的信息量几乎是无限的,并且依然保持着指数式的增长方式。生命科学中最基本的科学问题是物种问题,植物物种的研究决定性地影响着从宏观的全球生态系统至微观领域的生命DNA分子构造等全部研究内容,更与国家目标中的农业、能源、信息、环境、人口与健康,以及可持续发展等问题的研究和解决直接相关。

通过几个世纪的研究积累,全世界现已认知有花植物物种数目约22万~40万种(Govaerts, 2001,2003; Groombridge and Jenkins, 2002; Kier et al., 2009; Scotland and Wortley,2003; Tangley, 1997; Thorne, 2002);我国现已描述和认知的植物物种约3万余种(Yang et al.,2005),占世界已知物种总数的10%左右。植物物种是最基本和最重要的植物自然科技资源。物种及其存在凭证的重要原始材料是保藏在标本馆中的植物标本、植物园栽培的活植物、自然保护区和原始林区等自然植被中存在的物种。据粗略估计我国数百个标本馆共保存植物标本约1千7百万份(付立国等,1993),涵盖中国全部植物物种和世界物种约5万种;各地植物园不重复计算,引种栽培我国约60%的野生植物约2万种,引种国外物种约5000种。这些植物物种、标本和活植物是我国植物自然科技资源中最重要的原始性材料。国际上近年来把基于高科技方法保存的植物器官(种子)、营养体和蛋白质和DNA大分子材料等,也都归于植物自然科技资源保护、研究和利用的热点范畴。

目前,植物自然科技资源的研究管理已经进入崭新的迅猛发展年代,随着宏观、微观生物学实验观测手段的改善,引起了生物数据和信息的“爆炸”式增长。传统的信息管理、处理方式已显得力不从心。引入信息学及计算机科学的最新技术和成果,成为生物学家驾驭庞大数据信息的唯一选择。近年来信息技术的发展,例如大容量电子存储媒介、因特网、分布式数据库技术和开放性数据共享政策,如大范围的数字化工作、数据对公共普通用户的开放性使用,为生物多样性信息的产生、维持、传播和使用带来了革命性的发展(Bisby, 2000; Bisby et al., 2002; Brent and Bruck,2006; Causey et al., 2004; Edwards et al., 2000; Kagan, 2009; Krishtalka andHumphrey, 2000; Krishtalka et al., 2002; Oliver et al., 2000; Paton, 2009;Smith et al., 2000)。由于大量研究实践活动的涌现,生物学家和计算机专家的积极合作和努力,科学家们意识到需要有一个新的研究领域来界定这些科研人员积极的研究活动,明确他们的研究目标、内容、工作方法,对这些研究活动的将来做出科学地规划和设计,并且合理评价这些科研活动对社会的贡献和价值。因此,科学家们开始通过会议摘要、口头报告、个人博客、文章等多种形式来讨论相关的问题,并最终使用“生物多样性信息学”(BiodiversityInformatics:简称BI)这个词来界定这一活跃而蓬勃生长的新研究领域(Canhos et al., 2004; Cotter and Bauldock, 2000;Godfray, 2002; Godfray, 2007; Godfray et al., 2007; Graham et al., 2004a;Guralnick and Hill, 2009; Johnson, 2007; Kagan, 2009; Lane et al., 2000; Page,2008; Paton, 2009; Sarkar, 2009a; Sarkar, 2007, 2009b; Soberon and Peterson,2004)。

 

1. 生物多样性信息学和生物信息学的联系和区别 

科学家们认为,BI指利用信息技术,对生物有机体基础数据(Primarydata)的管理、算法的探究、分析和解释,尤其是在物种水平上的应用(Berendsohn and Geoffroy, 2007; Johnson, 2007; Soberonand Peterson, 2004)。因此,它涉及到对信息的收集、存储、提交、检索和分析,它主要关注单个有机体、居群和分类群以及它们的相互关系。它的信息内容覆盖了系统学、进化生物学、居群生物学、行为科学,以及从传粉生物学到寄生病和植物社会学等的大生态等领域。

如同其它信息学科的研究方法一样,作为信息学的一个分支,BI依赖计算机技术和信息学的原则来处理异质性数据的管理和应用。我们可以应用信息学的普遍原则和技巧来处理生物多样性基础信息,但是我们也面临思考一些创造性的方法来解决生物多样性领域信息化的特殊性问题。例如:如何在信息系统中对生物有机体名称和分类概念间建立联系,从而完整记录分

ASP.NET How to Do系列文章汇总

| Comments

1、如何在ASP.NET MVC中利用JQuery TreeView

 

 

 

 

http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx

 

 

 

2、ASP.NET MVC: Using RESTful Architecture

 

 

 

http://blog.wekeroad.com/2007/12/06/aspnet-mvc-using-restful-architecture/

 

 

 

3、Understanding HTML Helpers

 

 

 

 

 

4、ASP.NET MVC Tip #37 – Create an Auto-Complete Text Field

 

 

 

 

 

5、使用Asp.net mvc + Linq + mvc_scaffold_gen_setup.exe 生成一个完整的家庭帐册大管家程序

 

 

 

 

 

6、Autocompletion Textbox in MVC Using jQuery

 

 

 

http://blogs.msdn.com/miah/archive/2008/11/13/autocompletion-textbox-in-mvc-using-jquery.aspx

 

什么是Haml文件格式

| Comments

 

EOL程序的视图发生了很多的变化,已经不再是使用简单的 .rhtml 文件格式了。使用了一个一种以 .haml 结尾的文件。见下图,很奇怪的语法和格式。

 

Haml 是一种用来描述XHTML 的标记语言。 Haml 容易阅读,让开发人员避免把代码写在 XHTML 模板中。他同样遵守 Ruby On Rails 的一些核心原则,比如:不要重复自己;代码优雅 ;容易阅读 。
例如我们有如下的 XHTML文件:

 

 


还有其它一下有用的学习资源:
http://wiki.rubyonrails.org/howtos/templates/haml
http://haml-lang.com/

Linux Ubuntu8.04常用操作命令

| Comments

1. 如何完全的卸载MySQL

1
sudo apt-get --purge remove mysql-server-5.1 mysql-common mysql-client libmysqlclient15-dev libmysql-ruby

卸载过程中会询问你是否要卸载所有相关的配置文件已经数据库,选择Yes。

2. 安装完MySQL后如何设置root用户的密码

1
mysqladmin -u root password new-password

Open Flash Chart in ASP.NET MVC

| Comments

If you’ve ever developed an application of any type, you know that the business function of that application is only half the story. Most business applications also have to take into mind that your business user is going to want reporting. As a developer I find reporting the most boring part of the development process, but it is becoming less and less painful for me as a developer to implement it into my applications. Within the last year Microsoft has released a charting addition to the .Net framework based on the Dundas charts package, but they only output static images. In most cases this is ok, but it doesn’t make for a very compelling experience. Open Flash Chart is one alternative to the .Net charting; it is interactive and dynamic, which can help you build those compelling interfaces that your clients look for. So the point of this walkthrough is to show you how to implement Open Flash Chart into your MVC application.

image

Step 1 – Download the Open Flash Chart package

Obviously you’ll need Open Flash Chart, you can download it from the Official Open Flash Chart. When you download it there is going to be a lot of files, but don’t worry about it I’ll tell you which ones you need.

Step 2 – Import The Files You Need

You are going to need two files at a minimum. There is a .Net library in the package but I’ll show you, you don’t need it. The first file is the open-flash-chart.swf. This file is the major component of the open flash chart package. I transferred this file directly into my content folder in my ASP.NET MVC project.

image

image

The next file you’ll need is the swfobject.js file, this will make placing your charts on the page much cleaner and simpler. Transfer this file into your scripts folder.

image

image

Step 3 – Integrating Open Flash Chart into your View

There are a couple things that I do to get Open Flash Chart into my view. I first modify my master page and add a new ContentPlaceHolder called “Scripts”. This allows me to inject custom scripts per view if necessary. My head tag in the master page looks like the following.

view source

print?

1
<head runat="server">

2
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>

3
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />

4
<script src="/Scripts/swfobject.js" type="text/javascript"></script>

5
<asp:ContentPlaceHolder ID="Scripts" runat="server" />

6
</head>

The next step is to inject the Chart into the page. The following code does that.

view source

print?

1
<asp:Content ContentPlaceHolderID="Scripts" runat="server">

2
<script type="text/javascript">

3
swfobject.embedSWF(

4
"/Content/open-flash-chart.swf", "my_chart", "550", "200",

5
"9.0.0", "expressInstall.swf",

6
{ "data-file": "Home/GetData" }

7
);

8
</script>

9
</asp:Content>

Notice what is done here. You first point to the open-flash-chart.swf in your content folder. Next you specify the div you would like to inject the chart into. Thirdly, you specify the size. Right after that is about the flash version and the install if your client is missing flash on their machine. Lastly, the most important thing, the location of your data. Notice that it points to a controller action. I’ll show you how to code that next.

Step 4 – Data, Data, Data

A chart wouldn’t be a chart without data. This is where we will leverage the power of the newest .Net frameworks with anonymous types. Open Flash Chart uses JSON objects to create you chart, but we don’t want to spend hours creating a library or adding references to assemblies we don’t need. So I went ahead and created an action relating to the one seen above. The code looks like this.

view source

print?

01
public JsonResult GetData()

02
{

03
var data = new

04
{

05
title = new { text = "M

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/12/21/Open+Flash+Chart+in+ASP.NET+MVC/'>http://Apiaceae.github.io/blog/2009/12/21/Open+Flash+Chart+in+ASP.NET+MVC/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

Linq to SQL Like Operator

| Comments

As a response for customer’s question, I decided to write about using Like Operator in Linq to SQL queries.

Starting from a simple query from Northwind Database;

var query = from c in ctx.Customers

where c.City == "London"

select c;

The query that will be sent to the database will be:

SELECT CustomerID, CompanyName, …
FROM    dbo.Customers
WHERE  City = [London]

There are some ways to write a Linq query that reaults in using Like Operator in the SQL statement:

1. Using String.StartsWith or String.Endswith

Writing the following query:

var query = from c in ctx.Customers

where c.City.StartsWith("Lo")

select c;

will generate this SQL statement:

SELECT CustomerID, CompanyName, …
FROM    dbo.Customers
WHERE  City LIKE [Lo%]

which is exactly what we wanted. Same goes with String.EndsWith.

But, what is we want to query the customer with city name like "L_n%"? (starts with a Capital ‘L’, than some character, than ‘n’ and than the rest of the name). Using the query

var query = from c in ctx.Customers

where c.City.StartsWith("L") && c.City.Contains("n")

select c;

generates the statement:

SELECT CustomerID, CompanyName, …
FROM    dbo.Customers
WHERE  City LIKE [L%]
AND      City LIKE [%n%]

which is not exactly what we wanted, and a little more complicated as well.

2. Using SqlMethods.Like method

Digging into System.Data.Linq.SqlClient namespace, I found a little helper class called SqlMethods, which can be very usefull in such scenarios. SqlMethods has a method called Like, that can be used in a Linq to SQL query:

var query = from c in ctx.Customers

where SqlMethods.Like(c.City, "L_n%")

select c;

This method gets the string expression to check (the customer’s city in this example) and the patterns to test against which is provided in the same way you’d write a LIKE clause in SQL.

Using the above query generated the required SQL statement:

SELECT CustomerID, CompanyName, …
FROM    dbo.Customers
WHERE  City LIKE [L_n%]

Enjoy!

原文地址 http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/10/16/linq-to-sql-like-operator.aspx

   original link:
   <a href='http://Apiaceae.github.io/blog/2009/12/20/Linq+to+SQL+Like+Operator/'>http://Apiaceae.github.io/blog/2009/12/20/Linq+to+SQL+Like+Operator/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>

如何创建强类型的ASP.NET MVC视图

| Comments

2009-12-19_201740

1.在你的MVC应用程序根目录添加新文件夹,取名为CodeSmith

2.添加CodeSmith模板文件StrongTypedViews.cst.

3.右键点击CodeSmith文件夹,选择添加一个新的CodeSmith Project,取名为CodeSmith.csp.

2009-12-19_202243

4.右键点击刚生成的CodeSmith.csp文件在弹出的右键菜单选择Manager Output

2009-12-19_202635

5.在弹出的对话框菜单做如下的设置

2009-12-19_202821

2009-12-19_203037

6.右键CodeSmith.csp选择Generate Output生成CotrollerBase.cs

stv4

ControllerBase.cs文件

namespace CNPC.Controllers
{

<span style="color: blue">public partial class </span><span style="color: #2b91af">ControllerBase</span>: <span style="color: #2b91af">Controller
</span>{
    <span style="color: blue">public class </span><span style="color: #2b91af">ViewFolderBase
    </span>{
        <span style="color: blue">protected readonly </span><span style="color: #2b91af">ControllerBase </span><span style="color: #010001">controllerBase</span>;

        <span style="color: blue">public </span><span style="color: #010001">ViewFolderBase</span>(<span style="color: #2b91af">ControllerBase </span><span style="color: #010001">controllerBase</span>)
        { <span style="color: blue">this</span>.<span style="color: #010001">controllerBase </span>= <span style="color: #010001">controllerBase</span>; }
    }

    <span style="color: blue">public new </span><span style="color: #2b91af">ViewResult </span><span style="color: #010001">View</span>(<span style="color: blue">string </span><span style="color: #010001">path</span>, <span style="color: blue">object </span><span style="color: #010001">model</span>)
    {
        <span style="color: blue">return base</span>.<span style="color: #010001">View</span>(<span style="color: #010001">path</span>, <span style="color: #010001">model</span>);
    }

    <span style="color: blue">public new </span><span style="color: #2b91af">PartialViewResult </span><span style="color: #010001">PartialView</span>(<span style="color: blue">string </span><span style="color: #010001">path</span>, <span style="color: blue">object </span><span style="color: #010001">model</span>)
    {
        <span style="color: blue">return base</span>.<span style="color: #010001">PartialView</span>(<span style="color: #010001">path</span>, <span style="color: #010001">model</span>);
    }

    <span style="color: blue">protected </span><span style="color: #2b91af">ViewsFolder </span><span style="color: #010001">Views
    </span>{ <span style="color: blue">get </span>{ <span style="color: blue">return new </span><span style="color: #2b91af">ViewsFolder</span>(<span style="color: blue">this</span>); } }


<span style="color: blue">public class </span><span style="color: #2b91af">ViewsFolder</span>: <span style="color: #2b91af">ViewFolderBase
</span>{
    <span style="color: blue">public </span><span style="color: #010001">ViewsFolder</span>(<span style="color: #2b91af">ControllerBase </span><span style="color: #010001">controllerBase</span>): <span style="color: blue">base</span>(<span style="color: #010001">controllerBase</span>) { }
    </pre>

7.最好需要修改你的控制器类从ControllerBase继承,如下

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace CNPC.Controllers {

<span style="color: blue">public class </span><span style="color: #2b91af">SearchController </span>: <span style="color: #2b91af">ControllerBase//<font color="#ff0000">继承类</font>
</span>{
    <span style="color: #010001">Models</span>.<span style="color: #2b91af">cnpcDataContext </span><span style="color: #010001">cnpc </span>= <span style="color: blue">new </span><span style="color: #010001">CNPC</span>.<span style="color: #010001">Models</span>.<span style="color: #2b91af">cnpcDataContext</span>();

    <span style="color: green">//Example Url: /Search
    //
    </span><span style="color: blue">public </span><span style="color: #2b91af">ActionResult </span><span style="color: #010001">Index</span>()
    {
        <span style="color: blue">return </span><span style="color: #010001">Views</span>.<span style="color: #010001">Search</span>.<span style="color: #010001">Index</s<p class='post-footer'>
   original link:
   <a href='http://Apiaceae.github.io/blog/2009/12/20/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E5%BC%BA%E7%B1%BB%E5%9E%8B%E7%9A%84ASP.NET+MVC%E8%A7%86%E5%9B%BE/'>http://Apiaceae.github.io/blog/2009/12/20/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E5%BC%BA%E7%B1%BB%E5%9E%8B%E7%9A%84ASP.NET+MVC%E8%A7%86%E5%9B%BE/</a><br/>
   &nbsp;written by <a href='http://Apiaceae.github.io'>Hooker</a>
   &nbsp;posted at <a href='http://Apiaceae.github.io'>http://Apiaceae.github.io</a>
   </p>