天氣不錯, 陰天, 18度, 21K成績:1小時50分
今天被很多認識的朋友說 “ㄟ..怎跑半程? 越跑越回去囉?”
走下交流道, 轉身看看還在跑全程的人, 想到如果這次不是報半程, 現在應該還是在上面繼續跑著.
安裝 apache / mod_memcache
準備好這幾個 tarball, 並且解開:
drwxr-xr-x 6 rimmon rimmon 576 Mar 14 17:36 mod_memcached_cache-0.1.0
drwxr-xr-x 7 rimmon rimmon 584 Mar 14 17:09 apr_memcache-0.7.0
drwxr-xr-x 12 rimmon rimmon 1416 Mar 14 16:55 httpd-2.2.11
Hypertext Transfer Protocol — HTTP/1.1 – 這可是現今最偉大的 protocol 呀!
The Hypertext Transfer Protocol (HTTP) is an application-level
protocol for distributed, collaborative, hypermedia information
systems. It is a generic, stateless, protocol which can be used for
many tasks beyond its use for hypertext, such as name servers and
distributed object management systems, through extension of its
request methods, error codes and headers
http://tools.ietf.org/html/rfc2616
Status Code Definitions
http://tools.ietf.org/html/rfc2616#section-10
204 No Content
The server has fulfilled the request but does not need to return an
entity-body, and might want to return updated metainformation. The
response MAY include new or updated metainformation in the form of
entity-headers, which if present SHOULD be associated with the
requested variant.
If the client is a user agent, it SHOULD NOT change its document view
from that which caused the request to be sent. This response is
primarily intended to allow input for actions to take place without
causing a change to the user agent’s active document view, although
any new or updated metainformation SHOULD be applied to the document
currently in the user agent’s active view.
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
可以利用這點作一些事, 譬如記錄 user 的訪問, log 等等
apache 有用的 mod
* www-apache/mod_chroot
Latest version available: 0.5
Latest version installed: [ Not Installed ]
Size of files: 14 kB
Homepage: http://core.segfault.pl/~hobbit/mod_chroot/
Description: mod_chroot allows you to run Apache in a chroot jail with no additional files.
License: GPL-2
* www-apache/mod_extract_forwarded
Latest version available: 2.0.2
Latest version installed: [ Not Installed ]
Size of files: 13 kB
Homepage: http://www.openinfo.co.uk/apache/index.html
Description: Apache module that rewrites X-Forwarded-For to REMOTE_ADDR for reverse proxy configurations.
License: Apache-2.0 Apache-1.1
* www-apache/mod_log_rotate
Latest version available: 1.00
Latest version installed: [ Not Installed ]
Size of files: 4 kB
Homepage: http://www.hexten.net/wiki/index.php/Mod-log-rotate
Description: mod_log_rotate adds log rotation support to mod_log_config based on strftime(3)
License: Apache-2.0
PHP Coding Standards
參考: Mantis : http://www.mantisbt.org/guidelines.php
中文翻譯: http://www.ichiayi.com/wikipage/tech/mantis_coding
First, start off by reading the PHP Coding Standards document. I’ve deviated in a few places but just about everything in the document applies here as well.
Above all, write code that is easy to read and maintain. Comment blocks of code and functions at all times. And get on my case if I deviate too much as well!
Naming Variables
- Use all lower case.
- Use _ to separate words, e.g. $green_color_value
- Use descriptive names (except loop variables).
- Loop variables can be of the usual variety: $i, $j, $k, etc.
- Count variables should follow the format $*_count, e.g. $bug_count
- Global variables should be prefixed with g_
- Temporary variables should be prefixed with t_
- Parameters and variables passed from forms that have been cleaned of any special SQL chars (i.e. slashes) should be prefixed with c_
- Uncleaned function parameters should be prefixed with p_
- Uncleaned variables passed from forms should be prefixed with f_
- Other variables are prefixed with v_, v2_, etc.
- Never prefix with l_ or o_ or q_ (visually confusing)
- $query and $result should be used for SQL query and results respectively
Naming Functions
- Use all lower case.
- Use _ to separate words, e.g. setup_page_breaks()
- Keep functions to 5 words or less
- Functions that print should be prefixed with print_.
- Try to use prefixes to group functions (i.e., email_, news_, etc.)
Naming Classes
- Use FirstLetterOfWordIsCaptilized style
- Variables that are class objects should have the prefix coo_
Naming Files
- Use all lower case.
- Use _ to separate words, e.g. view_new_bugs_page.php
- Use .php file extensions
- Filenames must be less than 32 characters in length. This plays nice with older file systems like Mac OS.
- Included files should be suffixed by _inc.php
SQL formatting
- UPPERCASE all SQL keywords:
$query = "SELECT * FROM $g_mantis_bug_table WHERE id='1'";
- Always assign a query string to a variable. This makes code easier to debug when problems occur. Do not create the query in the call to the function.
- Break up SQL queries over multiple lines to be easy to read.
General Formatting
- Use TABS with a size of 4
- Follow the table formatting of existing pages
- Use <?php ?> for php delimiters.
- Try not to print/echo HTML unless it’s short or in a function loop
- Do not use the EOF construct
Miscellaneous
- Don’t use the ?: construct except in very rare cases. It is confusing and has a lot of bug potential.
- Avoid magic numbers. The only magic numbers in use should be 1 and 0 and their meaning should be obvious.
Page Guidelines
- The first item should be the copyright notice
- At the bottom will be the footer information and closing print_ functions.
Braces and Parantheses
- Parantheses should be right after a function name, e.g. function() not function ()
- Parantheses should have a space right after a keyword (if, while, for), e.g. for (…)
- Formatting of braces is illustrating below. We use unmatched placing.
- Arrays should be referenced with no spaces, e.g. $arr[‘index’] not $arr[ ‘index’ ]
for (...) { blah } or if (...) { blah }
- if … else blocks should be in this format:
if (...) { blah1 } else { blah2 }
Comparisons
- The NOT operator should be placed next to its operand. No spaces, e.g. !$value
- Parentheses should be used for grouping, especially with multiple comparisons, e.g. if ( ( null == $val ) && ( null == $val2 ) )
Strings
- Use spaces around the string concatenation operator, e.g. ‘str ‘ . $value . ‘ str2’;
- Use ‘ instead of " if there are no variables or special characters.
Comments
- Use the # symbol for line commenting, not //
- Use /* */ for block commenting unless you nest /* */ comments. Generally, only use this during development.
- Use @@@ followed by a brief message (BROKEN, TEMPORARY, etc) as a "look at this" indicator. Leaving your name next to is a good idea. This way critical items can easily be found.
Editor Features
- Search and replace in multiple files
- Goto line number
- Syntax highlighting
- Adjustable TAB spacing
get my ip address useing c / sample code
C CODE
/* FILENAME : my_local_ip.c */ #include #include #include #include #include #include #include #include int main(int argc, char **argv) { int s; struct sockaddr_in sin; int slen; int port; if( argc<3 ) { printf("Usage: %s \n", argv[0]); printf("\n\tsample %s 203.66.88.89 80\n",argv[0]); return -1; } port = atoi(argv[2]); s = socket(PF_INET, SOCK_STREAM, 0); memset(&sin, 0, sizeof(sin)); sin.sin_family = PF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = inet_addr(argv[1]); if(connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { printf("127.0.0.1"); return -1; } memset(&sin, 0, sizeof(sin)); slen = sizeof(sin); if(getsockname(s, (struct sockaddr *)&sin, &slen) < 0) { printf("127.0.0.1"); close(s); return -1; } printf("%s", inet_ntoa(sin.sin_addr)); close(s); return 0; }
可以依自己的需求來改這SHELL:
#!/bin/sh ADDR=`my_local_ip 168.95.1.1 53` FILENAME=${ADDR=}".txt" echo $FILENAME
用 pecl inclued 產生關聯圖
這是一隻用 codeigniter 寫的一個簡單的程式 , 然後用 pecl inclued 把它的 include/require 關聯圖畫出來
參考 URL : http://baniclin.blogspot.com/2008/09/pecl-inclued.html
VMware datacenter / ESXi
這個頁面提到VMware 的 virtualization 感覺非常的完整, 真的超級夢幻的 IT datacenter solution 都有了 … 希望有機會可以來試看看
http://www.vmware.com/technology/virtualization-resources.html
ESXi