ITeye博客

moyuan

klfo · 共 95 篇文章

[置顶] open-flash-chart

http://pullmonkey.com/2008/7/23/open-flash-chart-ii-plugin-for-ruby-on-rails-ofc2 http://pullmonkey.com/projects/open_flash_chart2/ 英文配置步骤 rails testing_ofc_2 cd testing_ofc_2 script/plugin install git://github.com/pullmonkey/open_flash_chart.git If the above line did not work for you, you can also…

2008-11-07 14:07 · ruby on rails · 评论(0)

[置顶] rss maker

http://gdgdlog.net/log/show/130 def rss_test require 'rss/maker' rss = RSS::Maker.make("2.0") do |maker| # channelの設定 maker.channel.about = url_for(:controller=>"rss", :action=>"new") maker.channel.title = "ぐだろぐ" maker.channel.description = "日記やメモなど、ぐだぐだ書いていくソーシャルネットワークに疲れた人向けのサービスです。" maker.channe…

2008-11-07 11:43 · ruby on rails · 评论(0)

[置顶] rails で model の変更を監視するプラグイン

acts_as_modified モデルの変更を監視して、各 attribute が変更されたかどうかを確認することができます。 「あるカラムに変更があった際にだけ、なにかしらの処理を行う」などという場合に便利。 インストールは普通にすればOK ./script/plugin install acts_as_modified 使用法をまとめると以下のような感じ class Person < ActiveRecord::Base acts_as_modified end p = Person.find( :first ) p.name # => "げんさん" p.modified? # => …

2008-11-07 11:12 · ruby on rails · 评论(0)

[置顶] exception_notification

1 applicattion.rb 配置 include ExceptionNotifiable consider_local "127.0.0.1", "192.168.1.109" 2 environment.rb ExceptionNotifier.sender_address = %("Project Application Error" <email@email.com>) ExceptionNotifier.email_prefix = "[project error] " ExceptionNotifier.exception_recipients = %w(email@ema…

2008-11-07 11:03 · ruby on rails · 评论(0)

[置顶] RMagick

http://doruby.kbmj.com/nakahira_on_rails/20071227/RMagick_ はじめまして、kbmjでruby on railsの開発をしている中平です。 今回私は、RMagickというrubyで画像処理を行うライブラリの使い方を説明いたします。 まず、RMagickについて。 RMagickとはその名のとおり、ImageMagickをrubyで扱えるようにしたものです。 ですのでRMagickを使う場合は、 ruby本体,ImageMagick,RMagickの3つが必要です。 今回はインストール方法は省きまして、インストール後の使い方とか機能につい…

2008-11-07 10:57 · ruby on rails · 评论(0)

[置顶] acts_as_paranoidプラグインをインストールします。

acts_as_paranoidプラグインをインストールします。 http://doruby.kbmj.com/ 1 安装步骤 $ ruby script/plugin source http://techno-weenie.net/svn/projects/plugins $ ruby script/plugin install acts_as_paranoid 2 $ script/generate migration AddBooksDeletedAt #マイグレーションファイルの作成 $ less db/migrate/002_add_books_deleted_at.rb #マイグ…

2008-11-07 10:50 · ruby on rails · 评论(0)

[置顶] Active Record: Sexy migrations

转载 :http://blog.csdn.net/meteorlWJ/archive/2008/02/03/2079356.aspx 现在我们有一种新的migration文件中声明的格式。以前我们是这样写的: Ruby代码 复制代码 create_table :people do |t| t.column, "account_id", :integer t.column, "first_name", :string, :null => false t.column, "last_name", :string, :null => false t.column, "description", :…

2008-11-06 11:44 · ruby on rails · 评论(0)

[置顶] http://blog.csdn.net/meteorlWJ/archive/2008/02/03/

Action Pack: HTTP Loving 如你所期望的那样,Rails2.0的Action Pack更加贴近HTTP,并且充分利用HTTP协议,例如资源、多种视图,还有更多的呢。我们添加了一个模块来处理HTTP的Basic验证,它能够让授权的API轻松跨越SSL协议,而且他是如此的简单易用。下面是一个例子(更多的例子请参考 ActionController::HttpAuthentication): Ruby代码 复制代码 class PostsController < ApplicationController USER_NAME, PASSWORD = "dhh", "secre…

2008-11-06 11:31 · ruby on rails · 评论(0)

[置顶] 鼠标 选择文字

javascript 用鼠标 选择 文字 然后替换 很酷的 <script type="text/javascript"> function changes(obj){ var TextIn=document.getElementById("textin"); if(TextIn.createTextRange){ //ie兼容 TextIn.focus(); document.selection.createRange().duplicate().text=obj; }else{ //firefox兼容 var iStart = TextIn.selectionStart; var iEn…

2008-08-13 15:04 · javascript · 评论(0)

[置顶] 使用Javascript来动态创建 script 标记

使用Javascript来动态创建 script 标记 var head = document.getElementsByTagName("head").item(0); var script = document.createElement ("script"); script.src = "XXX.js"; head.appendChild (script);

2008-08-11 10:45 · javascript · 评论(0)

[置顶] Ruby on Rails中的Rake教程(Rake如何把我灌醉!)

原文: Ruby on Rails Rake Tutorial (aka. How rake turned me into an alcoholic) 引言:作为一个rails的开发者,你可能很熟悉使用rake进行你的测试,或者使用rake db:migrate运行你的migrations,但是你真的知道Rake的背后故事吗?你意识到可以自己写一个Rake任务或者一个有用的lib吗? 下面是我们使用Rake任务的例子: 1、给列表中的用户发送邮件 2、每晚数据的计算和报告 3、过期或重新生成缓存 4、备份数据和svn版本(how's this : subversion repository)…

2008-07-23 11:15 · ruby on rails · 评论(0)

[置顶] spawn plugin 后台运行任务插件

后台 运行 任务 下载spawn 放在vendor/plugins 目录下 在config/environment.rb中配置: config.active_record.allow_concurrency=true def test spawn do sleep 11 12.times { puts "i" } end render :action=>"test" end 很开心的是 该程序不会sleep 11 而是执行到这步时候 render :action=>"test" 直接跳转 跳转后你会发现 在console中 过一会才会出现 i 连续 12次 所以run background …

2008-07-08 11:58 · ruby on rails · 评论(0)

[置顶] 编码检测 和 转换

def detect_encode require 'hpricot' require 'open-uri' @doc = open("http://www.baidu.com") { |f| Hpricot(f) } guess_res = NKF.guess(@doc.to_s) case guess_res when NKF::SJIS @encode = "Shift_JIS" when NKF::EUC @encode = "EUC" when NKF::JIS @encode = "JIS" when NKF::UTF8 @encode = "UTF-8" end pp @enc…

2008-06-18 12:09 · ruby on rails · 评论(0)

asp.net导出csv的例子

http://wiki.asp.net/page.aspx/401/export-to-csv-fi First let’s see what the CSV file is: CSV file is a text based file in which data are separated by comma. It can be opened by excel so you can use excel functionality. Each row of data including the title is in separate line. Meanwhile, each row ha…

2012-10-26 14:35 · asp.net · 评论(0)

在Visual Studio 2010中使用Visual Leak Detector

http://blog.csdn.net/xinyaping/article/details/6751940 Visual Leak Detector是过去(Visual Studio 2008的时代)我们常用的C/C++内存泄露检查工具。在Visual Studio 2010中依然可以使用该工具,但有两点需注意: 版本问题 设置变化 版本问题: 在codeproject.com上面提供的最新版本依然是 1.9d , 但是请注意,该版本在Visual Studio 2010下面表现非常差。网上有很多人注意到了这一点,很多人推荐用1.0版,因为1.0版在Visual Studio 2010下工…

2012-10-26 14:08 · asp.net · 评论(0)