Time of Update: 2018-12-07
CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1 FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, name, DateTime.Now, DateTime.Now.AddMinutes(20), false, mrole.id.ToString(
Time of Update: 2018-12-07
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 require 'nokogiri' 2 require 'open-uri' 3 require "iconv" 4 5 task :dreamtype => :environment do 6 # doc = Nokogiri::HTML(File.open("a.html"
Time of Update: 2018-12-07
代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$(function(){ $("#area_parentID").change(function(){ $("#next_select").html("<select name='streat' id='streat'></select>");
Time of Update: 2018-12-07
html代碼: Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
rails3.0新的驗證方法已經從Active Model中抽取出來,它接受一個屬性和哈稀驗證選項,不在像3.0以前針對每個屬性使用一個驗證方法,極大的簡化了驗證流程.以前的方法雖然還在,但不推薦使用了,因為我們夠懶.下面我們先來看一個簡單的樣本:class Person < ActiveRecord::Base validates :email, :presence => trueend新的驗證方法接收以下選項:1. :acceptance => Boolean2.
Time of Update: 2018-12-07
有相當多的爬蟲對網站會造成非常高的負載,因此識別爬蟲的來源IP是很容易的事情。最簡單的辦法就是用netstat檢查80連接埠的串連: C代碼netstat -nt | grep youhostip:80 | awk '{print $5}' | awk -F":" '{print $1}'| sort | uniq -c | sort -r -nnetstat -nt | grep youhostip:80 | awk '{print $5}' | awk -F":" '{print $1}'|
Time of Update: 2018-12-07
代碼 Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
在做ror開發的時候,簡直感覺就是在堆砌外掛程式,於是決定放棄各種圖片上傳外掛程式,自來來寫寫圖片上傳,感覺也不是太麻煩.(一)把上傳放在一個單獨類中 代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
1.名稱含義在Unix中,shebang其實就是指“#!”,它取自#(SHArp)和!(bang)。 2.作用它是很多指令檔中第一行的前兩個字元,用來告訴Unix系統要用shebang後面指定的解譯器來解釋該指令碼。所以,在很多指令碼中,第一行往往都是這麼寫的:#! /abs/path/to/interpreter 3.來源根據wikipedia上的解釋,shebang最初由Dennis Ritchie引入的,時間大概是在Version 7和Version
Time of Update: 2018-12-07
原系統登入後,預設顯示到Redmine首頁,顯示最新新聞、最新項目, 但對於大多數使用者而言,顯示“我的工作台”會更合適點。 解決方案有兩種,任選一種: 1.修改account_controller.rb 將successful_authentication中的redirect_back_or_default那一行 改成redirect_to : controller => "my", :action => "page" 缺點:如果是通過issue連結想直接查看issue內容,
Time of Update: 2018-12-07
上一篇隨筆對Redmine進行了配置。之後不就,我就發現了新的問題。配置完的Redmine使用本機訪問時,一切正常。但是如果是區域網路內使用其他客戶機訪問伺服器,則訪問異常緩慢。筆者查閱網上意見,發現是由於Redmine內建的WebrickWeb發布的問題,需要使用Mongrel組件來替換Webrick。在此放在這裡方便大家,形成一套完整的Redmine搭建方案。1. 替換其內建的伺服器webrick 為mongrel,方法:
Time of Update: 2018-12-07
validates_presence_of :login, :message => "使用者名稱不可為空!"validates_length_of :login, :minimum => 4, :message => "使用者名稱長度須為4到20位字母或數字!" validates_uniqueness_of :login,:case_sensitive => false, :message => "該使用者名稱已存在!
Time of Update: 2018-12-07
文章目錄 安裝準備安裝與配置
Time of Update: 2018-12-07
Redmine的code review外掛程式可以顯示代碼的具體內容,但是缺少代碼的作者、發布時間等等資訊,所以需要對外掛程式進行修改,添加這個功能。為沒有修改時的顯示頁面: 可以看到,圖中只有代碼。 我們要做的就是在上面添加顯示基本資料,研究過code_review原始碼之後,發現相關的內容是在/app/views/code_review/_update_diff_view.html.erb中,添加如下程式碼片段:<div
Time of Update: 2018-12-07
代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->public static string ObjectToJson<T>(string jsonName, IList<T> IL) { StringBuilder Json = new StringBuilder();
Time of Update: 2018-12-07
首先,確保你已經配置好了database.yml,假設我們要建立一個名為person的model,現在我們可以通過db:migrate任務來避免直接使用SQL來操作資料庫:rails g model person name:string age:int這條命令將在你的db/migrate目錄下建立001_create_people.rb檔案,我們可以通過它來建立people(people是person的複數)表:$ rake db:migrate== CreatePeople:
Time of Update: 2018-12-07
模版標籤主要分為兩大類,欄目相關標籤和文章相關標籤,由於分屬於兩個表,對應不同的實體類,在替換模版標籤的時候就出現了些問題.先把枋心類貼出來,好說明問題.string patter = @"<!--(.+?):\{(.+?)\}-->([\s\S]*?)<!--\1-->"; MatchCollection maction = Regex.Matches(tempContext, patter, RegexOptions.Compiled); foreach
Time of Update: 2018-12-07
這幾天無事,把自己以前寫的一套CMS程式拿來改改,想用parallel.foreach來提高產生HTML的效率 模版解析類就沒動,直接把以前的for迴圈改成parallel.foreach,就出現了未將對象引用設定到對象執行個體的錯誤,尋找了半天,才發現問題出現在模版解析類的載入模版裡 代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--
Time of Update: 2018-12-07
最近無事把一把2.3.8的小網站人肉升級到了3.0,記錄一下2與3的一些區別 (1):編碼問題,使用ruby 1.9.2一定要記得在檔案頭加上 # encoding: utf-8 (2)適應ActiveRecord的新寫法,3.0中還相容以前的寫法,到3.2就會移除,現在不適應,到時會哭
Time of Update: 2018-12-07
Debian是最早的Linux發行版之一。它能引起公眾注意就因為它讓安裝與卸載軟體非常簡單。在其他發行版還陷在依賴性的泥潭裡時,Debian使用者因為有更好的包管理系統而免受這些困擾。 Debian又一次充當了開路先鋒的角色。她首創了APT(Advanced Packaging Tool)。這一工具後來被Conectiva移植到紅帽子系統中用於對rpm包的管理。在其他一些發行版中我們也能看到她的身影。