Showing posts tagged web

.htaccess

  1. .htaccess Tutorial
  2. .htaccess Guide

Remove index.php in the URL for Codeigniter:

Options -Indexes

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /selfcontrol/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d 

    #Uncomment one of the following rewrite rules. 
    #Some servers require the ? after index.php, some don't

    #RewriteRule ^(.*)$ index.php?/$1 [NC,L,QSA]
    RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

ASCII and Binary

  1. FTP在传送文件时分为ASC和Bin两种格式,只有文字文件(例如 html 文件)使用ASC,其他的通通使用Bin格式(例如图像文件、压缩文件、可执行文件等等)。
  2. 当我们使用ftp时,可简单地把文件分为两种基本类型:文本文件和二进制文件;文本文件也称为ASCII文件,其文件内容遵循ASCII的定义,其主要特征是文件内容由若干行组成,可以使用操作系统的显示、编辑命令来显示和编辑ASCII文件的内容,它使用的传输模式是asc;二进制文件(Binary File)是指除ASCII文件以外的所有文件格式,它使用的传输模式是bin;需要注意的是,可以将ASCII文件按二进制模式传输,但决不能将二进制文件按ASCII模式传输,否则二进制文件的内容会遭到破坏而无法使用。
  3. ASCII 切换传输模式为文字模式(只能用来传送文字文件); BINARY 切换传输模式为二进制模式(除文字文件外皆用此模式);
  4. 文字文件传输推荐ASC而程序或数据文件必须使用BIN。

From: FTP中传输模式:BIN与ASC的差别

.htaccess要用ASCII传。

Read Request Payload in Codeigniter

I was using Codeigniter with Backbone. When I try to call the save() method in the Backbone it sent a POST Request to the server. But it sends data to the server using a Request Payload and not the standard Form Data approach that jQuery, and standard HTML forms submit with.. After a bit study I think there are two easy way to handle this.

On the front end you can enable Backbone.emulateJSON() or on the server side, $requestBody = json_decode(file_get_contents('php://input'),true);.

I heard something like $this->request->body but it never works.

.htaccess Rewrite

One .htaccess File

http://www.farinspace.com/codeigniter-htaccess-file/

Regular expressions

  • ^ begins the line to match.
  • $ ends the line to match. So, ^folder1$ matches folder1 exactly.
  • . stands for “any non-whitespace character” (example: a, B, 3).
  • * means that the previous character can be matched zero or more times. So, ^uploads.*$ matches uploads2009, uploads2010, etc.
  • ^.*$ means “match anything and everything.” This is useful if you don’t know what your users might type for the URL.
  • () designates which portion to preserve for use again in the $1 variable in the second string. This is useful for handling requests for particular files that should be the same in the old and new versions of the URL.

EDM

  1. Gmail下,background:url()里的路径会被自动置空
  2. Gmail下,div的height属性会被替换为min-height
  3. Gmail下,所有position相关属性会被删掉
  4. 支持margin

opera:crossnetworkwarning

内网里用opera上咱们的网站一张图都加载不出来:

Warning
http://hiphotos.baidu.com/baidu/pic/item/***.jpg

A page on the public internet requests data from your private intranet. For security reasons, automatic access is blocked, but you may choose to continue.

Continue

Always continue when data is requested from this server on my private intranet

Generated by Opera.

原来opera还有这一个功能:http://stackoverflow.com/questions/5464599/opera-wont-load-some-javascript-files