Mar 24 2008

六步卸载ruby on rails

Posted by admin

sudo gem uninstall Rails
sudo gem uninstall Rake
sudo gem uninstall Actionwebservice
sudo gem uninstall Actionmailer
sudo gem uninstall Actionpack
sudo gem uninstall Activesupport
到现在为止,我还只是upgrade&&upgrade,可没想过卸载,但在ruby on rails中文论坛上还是看到有些人想卸载。于是找了下,就这六步。samply and easy.

Filed under : technology | No Comments »
Mar 22 2008

“Couldn’t find Article with ID=orderpublished_at DESC“解决办法

Posted by admin

Tags:

typo的Dirtylicious主题,如果你试图点击左上方的”articles”链接来看历史的文章,你会惊讶的发现会弹出一个错误“”Couldn’t find Article with ID=orderpublished_at DESC”,这是因为articles控制器下的archives方法里没有了:all选项造成查询不了ID。
解决办法:
将\typo\app\controllers目录的articles_controller.rb文件下

def archives
@articles = Article.find_published(:order => 'published_at DESC')
@page_title = "Archives"
end

改为

def archives
@articles = Article.find_published(:all, :order => ‘published_at DESC’)
@page_title = “Archives”
end

Filed under : technology | No Comments »
Mar 22 2008

Typo5.0.3释出

Posted by admin

Tags:

对于一个普通用户来说,与旧版相比,最大的改进莫过于是rich editor用上FCKEditor,试想一下在textile下发个链接要用的’ “” ‘,加个图片要用’ !! ‘ ,可不好受!

默认theme改得有点像mephisto的默认theme的样子。

添加了feedback:
用Jabber account来发邮件通知。

cache的缓存,二种选择:
HTML page caching
use semi static caching (default)

title的优化,可选择三种方案:
At the beginning of page title
At the end of page title
Don’t show blog name in page title

span也弄得有点像wordpress,可选择Akismet Key。 Read more »

Filed under : technology | No Comments »
Feb 21 2008

google chart的使用

Posted by admin

google chart作的图表只是简单的填上相应的数据,漂亮的图表便出来了,这全都有赖于google chart!而且相应的图片还不用上传到自己的服务器,省下了大量的带宽。

google chart支持线形图、柱状图、饼状图、维恩图(集合之间的关系)、散点图。如果你要求不是特别高,一般都可以应付下来了。

还是把实际的实现方法说一说吧 Read more »

Filed under : technology | No Comments »
Feb 07 2008

安装Mephisto

Posted by admin

Tags:

没有什么特别的,只是要注意一点,你的rake是8.1。你rake db:bootstrap的时候可能会出现

Invoke db:bootstrap (first_time)
Execute db:bootstrap
rake aborted!
wrong number of arguments (0 for 1)

这时你不要相信google group里的升级到最新版本,而是应该roll back才对。
rake7.3或rake7.2(我用7.2的通过)。并且要rails冻结到1.2.3。
rake rails:freeze:edge TAG=rel_1-2-3

Filed under : technology | No Comments »
Feb 07 2008

dot5hosting的优惠入口(3.99/month)

Posted by admin

听说并且看到别人在dot5hosting的blgo速度很快,于是跑上去看看,当填到credit cart时,我把页面往后退了一下,弹了一个窗口说“继续,如果你这次买就优惠”,就发现这入口了。
ps: dot5hosting的详细信息请自己google,恕不copy&paste

Filed under : technology | 2 Comments »
Jan 26 2008

在wordpress中添加统计代码

Posted by admin

在wordpress中添加统计代码(51la),一般都是添加在
wp-content/themes/default/footer.php
</body>之前,但如果这样就算完成就有点粗糙,最好再设个display:none,把DIV隐藏起来,再把img里的alt=“”里面的信息改为你想要显示的(51la的默认为51la.la.统计),这样来SEO一把。

Filed under : technology | No Comments »
Jan 24 2008

把扩展名rhtml改为html.erb的命令

Posted by admin

Dir["**/*.rhtml"].each {|file| if file =~ /^(.+)\.rhtml$/; File.rename(file,”#{$1}.html.rb”) end }
刚开始这样写,very ugly!, and then
Dir["**/*.rhtml"].each {|file| File.rename(file,”#{$1}.html.rb”) if file =~ /^(.+)\.rhtml$/ }

把thistle_0.1a下载下来玩玩,但因为它是用rails.1.2.3写的,还是rhtml后缀,现在的rails2.0用不了。于是有了上面的脚本。
PS:
“**/*” 递归遍历。
File.rename 改名。
=~ 正则匹配

Filed under : technology | No Comments »
Jan 24 2008

undefined method `gem’ for main:Object的解决方法。

Posted by admin

遇到这个问题的朋友不少。。
undefined method `gem' for main:Object (NoMethodError)
一般来说都是因为gem版本太低造成。
所以只要
sudo gem update --system
就可以了。
但有一些还是不行的,或者可以尝试一下。
把原是require_gem的改为gem看看(You’ll need to replace require_gem by just gem.)。

Filed under : technology | No Comments »
Jan 21 2008

some ADSL command on ubuntu

Posted by admin

yikes! I had lost so many times these command! better be mark!

sudo pppoeconf
sudo pon dsl-provider
sudo poff

Filed under : technology | No Comments »