This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 因为使用ssh2的时候,总是出错,所以改用ssh1 | |
require 'rubygems' | |
gem 'net-ssh', '1.1.4' | |
require 'net/ssh' | |
# 用来更新32和63的ruby小脚本 | |
cmd = Proc.new do |shell| | |
shell.cd("/opt/gst") | |
print "current directory:",shell.pwd.stdout | |
print "current ruby version:",shell.ruby("-v").stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup from uptolife.blogspot.com | |
$KCODE='gbk' | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
gem 'activerecord','2.1.2' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql', | |
:database => 'test', :host => '192.168.1.184', :username => 'root', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup from uptolife.blogspot.com | |
$KCODE='gbk' | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
gem 'activerecord','2.1.2' | |
require 'active_record' | |
require 'thread' | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup from uptolife.blogspot.com | |
$KCODE='gbk' | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
gem 'activerecord','2.1.2' | |
require 'active_record' | |
require 'thread' | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blogbus_login = 'http://www.blogbus.com/' | |
blogs = 'http://www.blogbus.com/user/?blogid=1477842&mm=Post&aa=Index&page=' | |
require 'rubygems' | |
require 'mechanize' | |
agent = WWW::Mechanize.new | |
page = agent.get(blogbus_login) | |
form = page.form('frmLogin') | |
form.username="mccxj" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def require_or_load(file_name, const_path = nil) | |
log_call file_name, const_path | |
# file_name = $1 if file_name =~ /^(.*)\.rb$/ | |
file_name = $1 if file_name =~ /^(.*)\.(rb|class)$/ | |
expanded = File.expand_path(file_name) | |
return if loaded.include?(expanded) | |
# Record that we've seen this file *before* loading it to avoid an | |
# infinite loop with mutual dependencies. | |
loaded << expanded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package auction.web.filter; | |
import org.apache.commons.logging.*; | |
import org.hibernate.*; | |
import auction.persistence.HibernateUtil; | |
import org.hibernate.context.ManagedSessionContext; | |
import javax.servlet.Filter; | |
import javax.servlet.*; | |
import javax.servlet.http.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package auction.web.filter; | |
import org.apache.commons.logging.*; | |
import org.hibernate.*; | |
import auction.persistence.HibernateUtil; | |
import javax.servlet.*; | |
import javax.servlet.Filter; | |
import java.io.IOException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package auction.exceptions; | |
/** | |
* This exception is used to mark access violations. | |
* | |
* @author Christian Bauer | |
*/ | |
public class PermissionException | |
extends RuntimeException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package auction.exceptions; | |
/** | |
* This exception is used to mark business rule violations. | |
* | |
* @author Christian Bauer | |
*/ | |
public class BusinessException | |
extends RuntimeException { |
OlderNewer