XML [CommandButton] que rellena campos de un Bean

<af:commandButton text="Continuar">
                  <af:setActionListener from="#{row.FILA}" to="#{CentrosBean.ATRIBUTOBEAN}"/>
                  <af:returnActionListener/>
                </af:commandButton>

Rails 通过目录和文件进行递归

Dir['**/*.jpg'].foreach do |filename|
  ... process your filename here
end

Bash 复制目录(unix)

cp -R /verzsource/ /target

Ruby CruiseControl.rb的Twitter通知程序

gem "twitter4r", ">=0.3.0"
require "twitter"
require "time"

class TwitterNotifier

  attr_writer :login, :password

  def initialize(project)
    @project = project

    Twitter::Client.configure do |conf|
      conf.user_agent = 'cruisecontrolrb'
      conf.application_name = 'CruiseControl.rb'
      conf.application_version = 'v1.2.1'
      conf.application_url = 'http://cruisecontrolrb.thoughtworks.com/'
    end

    def build_finished(build)
      return unless @login and build.failed?
      Twitter::Client.new(:login => @login, :password => @password).
        status(:post, "#{build.project.name} build #{build.label} failed") rescue nil
    end

    def build_fixed(build, previous_build)
      return unless @login
      Twitter::Client.new(:login => @login, :password => @password).
        status(:post, "#{build.project.name} build #{build.label} fixed") rescue nil
    end

  end

end

Project.plugin :twitter_notifier

Java 简单的尾巴就像断言

public class TailAssertor {

    private static final long sec = 1000L;

    private static final Log log = LogService.getLog(TailAssertor.class.getName());

    private static long sampleInterval = 5000;

    public static void assertNewLinesWithTail(final File logfile, final String expectedLine, int durationInSec) {

        long filePointer = logfile.length();// The file pointer keeps track of where we are in the file
        RandomAccessFile file = null;
        try {
            file = new RandomAccessFile(logfile, "r");
            for (final Date startTime = new Date(); new Date().getTime() - startTime.getTime() < durationInSec * sec;) {
                long fileLength = logfile.length();
                if (fileLength < filePointer) {// file has been cleared
                    file = new RandomAccessFile(logfile, "r");
                    filePointer = 0;
                }
                if (fileLength > filePointer) {
                    file.seek(filePointer);// There is new data to read
                    for (String line = file.readLine(); line != null;) {
                        if (line.contains(expectedLine)) {
                            return;
                        }
                        line = file.readLine();
                    }
                    filePointer = file.getFilePointer();
                }
                Thread.sleep(sampleInterval);// Sleep for the specified interval
            }
        } catch (Exception e) {
            log.error(e);
        } finally {
            closeFile(file);
        }
        throw new AssertionError("the requested line wasn't found within the required time frame!");
    }

    private static void closeFile(RandomAccessFile file) {
        if (file != null) {
            try {
                file.close();
            } catch (IOException e) {
                log.error(e);
            }
        }
    }
}

HTML DTD综述

HTML 3.2

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

HTML 4.01 	Strict, Transitional, Frameset 	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">
	

XHTML 1.0 	Strict, Transitional, Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
	

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Apache 在Apache上运行Wordpress的相当永久链接

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /designblog/
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule . /designblog/index.php [L]
</IfModule>

Apache 保护您的wp-includes文件夹

Order Allow,Deny
Deny from all
<Files ~ ".(css|jpe?g|png|gif|js|swf)$">
Allow from all

PHP 表管理类

class $1 extends db {
	// SQL Table: ${2:tbl_$1}
	// Columns: id,$3
	
	function $1 (){
		
	}
	
	public function get$1(){
		db::connect();
		\$query = "SELECT id,$3 FROM $2";
		\$result = mysql_query(\$query);
		
		return \$result;
	}
	
	public function get$1instance(\$id){
		db::connect();
		\$query = "SELECT id,$3 FROM $2 WHERE id=" . \$id;
		\$result = mysql_query(\$query);
		
		return \$result;
	}
	
	public function insert$1(\$$1details){
		db::connect();
		\$query = "INSERT INTO $2 ($3) VALUES ('"
			\$$1details[$4] . "'" . $0
			")";
				
		mysql_query(\$query);
			
		return mysql_insert_id();
	}
	
	public function delete$1(\$id){
		db::connect();
		\$query = "DELETE FROM $2 WHERE id = " . \$id;
		
		mysql_query(\$query);
		
		return \$id;
	}
	
	public function update$1(\$id,\$$1details){
		db::connect();
		\$query = "UPDATE $2 SET 
			$4 = '" . \$$1details[$4] . "'
			WHERE id = " . \$id;
		
		mysql_query(\$query);
		
		return \$id;
	}
}

C# 将Eventhandler添加到DataGrid行

//Codebehind  
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {            
            e.Row.Attributes.Add("onmouseover", "MouseOn(this)");
            e.Row.Style["cursor"] = "pointer;hand;";
            e.Row.Attributes.Add("onmouseout", "MouseOff(this)");
            e.Row.Attributes.Add("onclick", "window.location=\'ViewDetailRecord.aspx?ItemId=" + e.Row.Cells[0].Text + "\'");
        }
    }

//Page HTML
    <script type="text/javascript" language="javascript">
      var holding = "white"; 
      function MouseOn(elem)
      {
        holding = elem.style.backgroundColor; 
        elem.style.backgroundColor = "#f2f2f2"; 
        //alert(elem.style.backgroundColor);
      }
      function MouseOff(elem)
      {
        //alert(holding); 
        elem.style.backgroundColor = holding;           
      }
    </script>