2007年8月30日星期四

Standard Documentation Formats - 参考文献格式的一些介绍

这里有参考文献格式的一些介绍,如果你需要向英文国际刊物投稿的话,那么可以看一下。

Printable PDF Version
Fair-Use Policy
Traditional Endnotes or Footnotes
MLA Parenthetical System | APA Parenthetical System
Numbered-Note System | Electronic Sources

Different disciplines use their own systems to set out information about sources, but learning one or two of them should serve for most of your studies. These samples of the four main systems show the items of information that different disciplines consider important, as well as the different details of punctuation and indentation they use.

For more thorough advice, see the manuals mentioned with each system or look at general handbooks such as Hacker, Canadian Writer's Reference (PE 1408 H33) or Northey and Procter, Writer's Choice: A Portable Guide for Canadian Students (LB 2369 N677 1998).

(NOTE: The appearance of the examples may be altered by your browser. If in doubt about matters such as spacing or indentation, check the reference works mentioned.) Please note also that many of the examples cited are fictional.

2007年8月28日星期二

RewriteRule ISAPI_rewrite URL rewriting Reference

http://www.isapirewrite.com/docs/

Here is part of the docs


Introduction

ISAPI_Rewrite is a powerful regular expressions-based URL manipulation engine. It acts mostly like Apache's mod_Rewrite, but it is designed especially for Microsoft Internet Information Server and Microsoft Security and Acceleration Server 2004. If you ever wanted to change your web site's URL scheme, this product is for you!

Some key benefits of ISAPI_Rewrite:

* Speed

ISAPI_Rewrite is extremely fast and highly scalable solution. It is written by using only pure C/C++ code, Win32 API and ISAPI. It uses intelligent configuration cache mechanism. All work is done just in one stage and there are no recursively requests or any other operations that may take a long time.
* Security

ISAPI_Rewrite is designed for operation in a shared environment. It can serve as many sites as you have. ISP and hosting providers can safely permit their users to configure ISAPI_Rewrite and be sure that any configuration changes will affect only local user's environment. ISAPI_Rewrite can even solve many security problems, for example, block an access to some folders or file extensions or create more complex rules.
* Power

Flexibility and power of ISAPI_Rewrite come from its regular expression nature. With regular expressions you don't need to write a thousands check strings. The comparison and replace of URLs can be done with a few string patterns. So, ISAPI_Rewrite can do many things that cannot be done using other solutions available for IIS. See examples section for more information.


Here is something about
Create Dynamic Sub-domains in (Windows/IIS) using isapi_rewrite

Introduction

Do you have a web site that is hosted on a Windows Server that has been growing and now it makes more sense to redefine the architecture and separate that web site into subdomains? In this article, we will be discussing two methods of setting this up. And later in the article, we'll provide you with a comparison analysis and our conclusions.

Requirements

1. Ability to update DNS records
2. IIS web server admin access
3. isapi_rewrite component (for Solution 2)

Solution 1: Create Multiple IIS Web Sites

Setup DNS Server

You have two options. Since you probably have a limited number of subdomains to manage, you can either list them out individually or just use a wildcard.

Wildcard method: Add the following entry into your DNS server and change the domain and IP address accordingly.

*.example.com IN A 1.2.3.4

Declare manually: Add an entry for each of the subdomains.

sub1.example.com IN A 1.2.3.4
sub2.example.com IN A 1.2.3.4
sub3.example.com IN A 1.2.3.4

Setup the Web Server

First make sure you have created a root directory for each of the subdomains, as if you are working with a new web site. Your directory might look like the following:

d:\inetpub\wwwroot\example.com\sub1\
d:\inetpub\wwwroot\example.com\sub2\
d:\inetpub\wwwroot\example.com\sub3\
d:\inetpub\wwwroot\example.com\js\
d:\inetpub\wwwroot\example.com\css\
d:\inetpub\wwwroot\example.com\img\

Next, we create a web site for each of the subdomains. Let's create the first one and you can repeat this for all others.

* Open IIS Management Console
* Click on the Web Sites folder and select New : Web Site
* Click on Next to continue.
* Enter the description for your site then click Next. An example would be: sub1.example.com.
* On the IP Address and Port Setting, enter sub1.example.com into the Host header for this Web site field.
* On the next page, enter the path d:\inetpub\wwwroot\example.com\sub1\
* On the next page, select your options click Next and you're done.

Now here's the fun part. Since you have created a new site for each subdomain, but there are files that are shared across them, such as javascript, style sheets, and images, what you could do is to create a virtual directory to link them to each of the web sites. Here's how you do it.

* Right click on the subdomain you have just created in IIS Management Console and select New : Virtual Directory
* As an example we'll share the style sheet folder (css). Click on Next and enter css in the Alias field.
* Enter the path d:\inetpub\wwwroot\example.com\css\ into the Path field and click on Next.
* Specify the permission on the next page and you're done.

Solution 1: Summary

What we have accomplished here is we have separated your web site into multiple subdomains, while still keeping only one copy of the shared files across them.

Solution 2: Using isapi_rewrite

Whoa! That's a lot of steps to create all the subdomains I want. Is there an easier way? Well there is an alternative way. Let's get started first then we'll run the comparisons.

Setup DNS Server

Add the following entry into your DNS server and change the domain and IP address accordingly.

*.example.com IN A 1.2.3.4

Setup the Web Server

We are assuming that you already have a web site created for your main site: www.example.com. So let's just double check to make sure it will be able to accept all variations of the subdomains.

* Open IIS Management Console and select your web site.
* Right click on it and select Properties.
* Click on Web Site tab.
* Click on Advanced button.
* Make sure there is one entry under the Multiple identities for this Web Site with Host Header Name field blank. This entry will intercept all requests that comes to this IP address.
* Make sure the IP address is only used by this web site.

Setup httpd.ini for isapi_rewrite

Add the following code to your httpd.ini in the web root. Make sure they are in the right order.

# Convert http://example.com to http://www.example.com/
RewriteCond Host: ^example.com
RewriteRule (.*) http\://www\.example.com$1 [I,RP]

# Assuming we have limited number of shared folders.
# We will execute them accordingly regardless of the subdomain.
# Example: http://sub1.example.com/img/logo.jpg -> /img/logo.jpg
# Example: http://www.example.com/img/logo.jpg -> /img/logo.jpg
RewriteRule (/css/.*) $1 [I,O,L]
RewriteRule (/js/.*) $1 [I,O,L]
RewriteRule (/img/.*) $1 [I,O,L]

#Redirect all other subdirectories not matching
#to the list above as subdomains
#example: www.example.com\sub1 -> sub1.example.com
RewriteCond Host: www\.highspeed\.com
RewriteRule /(\w*)/(.*) http\://$1\.example\.com$2 [I,RP]

# If the web site starts with www then point the file to the root folder
# If you specifically created a folder /www/ then you can comment out this section.
RewriteCond Host: (?:www\.)example.com
RewriteRule (.*) $1 [I,O,L]

# Any web site starts other than www will be re-mapped to //
# Example: http://sub1.example.com/default.asp -> /sub1/default.asp
# Note: if the folder does not exists, then the user will get a 404 error automatically.
RewriteCond Host: (.*)\.example.com
RewriteRule (.*) /$1$2 [I,O,L]

#Fix missing slash char on folders
#This has to be at the end because if invalid dir exists,
#we should show 404 first
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,RP]

Test the Subdomains

Assuming we have the company website and two subdomains created: sub1, sub2.

URI ヲ Location on Server

http://www.example.com ヲ /
http://sub1.example.com/img/logo.jpg ヲ /img/logo.jpg
http://sub2.example.com ヲ /sub2/
http://abc.example.com ヲ /abc/ -> 404 Not Found

Solution 2: Summary

The second solution is easier to implement and only requires one instance of the website, the user has to be careful about creating the folders. For example, the user can not create a folder d:\inetpub\wwwroot\example.com\sub1\img\ because it would conflict with the isapi_rewrite Rule of (/img/.*). Therefore the files in that folder will not be accessible.

Comparisons

Multiple IIS Webs - Pros

* No conflicts to worry about between folders.
* Separate log files to track them individually.
* Can be setup for server farms and load balancing easily.

Multiple IIS Webs - Cons

* Need to create new site per subdomain.
* Requires access to IIS server.

isapi_rewrite - Pros

* Easy to setup.
* One server instance and log file.
* To add a subdomain, just add a new folder.

isapi_rewrite - Cons

* Need to keep track of directories to avoid conflicts.
* Need dedicated IP address.
* Additional resource for processing each file.
* Need to find server that supports isapi_rewrite.

Conclusion

While isapi_rewrite solution is much easier to implement, it is recommended for smaller sites with one development team. This is because of added resource and exceptions that the team has to keep track of. For a larger site, even though the admin has to setup multiple instances of the servers, these only need to be done once. Plus, the subdomains are probably developed by different teams and are distinct enough to warrant their own web instance.

So which one should you choose? Give the isapi_rewrite a try first. When you think your sites are big enough you can always switch to the other method anytime.

Happy coding!

2007年8月27日星期一

Javascript Reference and Tutorial

这里是一个比较详细的Java Script 的教程。
http://www.moko.ru/doc/Java_Script/index.html
JavaScript is a compact, object-based scripting language for developing client and server Internet applications. Netscape Navigator interprets JavaScript statements embedded in an HTML page, and LiveWire enables you to create server-based applications similar to Common Gateway Interface (CGI) programs. This book describes the JavaScript language and its use in Navigator. For information on developing server-based JavaScript applications, see the LiveWire Developer's Guide.