some ADSL command on ubuntu
Monday, January 21st, 2008yikes! I had lost so many times these command! better be mark!
sudo pppoeconf
sudo pon dsl-provider
sudo poff
File-Column实现上传图片的一些问题补充
Sunday, January 20th, 2008在用File-Column实现图片上传时,我是手工下载File-column然后copy到plugin目录内的,但在view里
<% @entry = Entry.find(params[:id]) %>
<%= image_tag url_for_file_column(”entry”, “image”) %>
就提示空对象,狂了起来干脆改做这样,
<%= image_tag url_for_file_column(”@entry”, “image”) %>
还是不行,一直没弄明白是什么原因,也尝试过把File-Column的目录名改为File_Column,但也是不行。后来干脆删了它,然后
./script/plugin install http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk
everything is done!
XP下安装RMagick
Wednesday, January 16th, 2008看了在Win下安装Rmagick!然后跟着操作,就是提示CORE_RL_magick_.dll找不到,我在命令行下,set path看
c:\program files\imagemagick-6.2.9-q8;
不就有他的安装路径嘛,还是报错,几乎晕菜,最后我抱着试一试的心理把下面的添加上去
C:\Program Files\ImageMagick-6.2.9-Q8
irb里测试就可以了。
弄了这么久的原因就是因为区分大小写@-@!
Tags: rmagick
Posted in technology | No Comments »>Arctic’s Internal Alexa Redirect插件失效
Saturday, January 12th, 2008Adds an Alexa Redirect Link to all of your internal links’ onclick property to improve Alexa Ranking but keep URLs SEO friendly. By Arctic.
这是一个帮助wordpress提升排名的插件,广受好评,几乎是wordpress博客必备插件。但今天我发现这插件已经失效了.在首页点击文章标题进入单页面,地址栏显示
http://redirect.alexa.com/redirect?http://www.ignuts.com/?p=92
解决办法:在plugins(插件)栏里停止使用“Arctic’s Internal Alexa Redirect”
重装windows后恢复grub
Saturday, January 12th, 2008之前文章标题是“重装windows后快速恢复ubuntu”是发布在学校的一个论坛上,现在改了改,还是保存在自己blog比较好,查找也方便。
————————–
网上太多这样的教程,看到菜鸟头都太了,所以我加工一下,特为初学者写的。我重装ubuntu也只是3次,所以下面有什么不对的,请大家补充。
这个教程优点:不用安装grub for windows,不用安装光盘。操作简单。
缺点:我只在ubuntu上实验过,red hat ,gentoo,freebsd这些都没尝试过,所以他们能否这样恢复,我不敢肯定。
我们安装了Linux和windows(双系统),我们可能因为windows发生了问题,需要重装。
重装后无法启动GRUB。这时我们就要恢复GRUB了。
首先,我们下载 grub_for_dos-0.4.1
解压,复制grltr到系统盘根目录
PS:解压后有两具grltr文件.一个grltr,另外一个grltr.mbr,只需要grltr文件即可.
或者直接从 这里 下载grltr文件
在boot.ini最后添加
C:\GRLDR=”GRUB”
PS:要按击菜单栏的“工具”,”文件选项“,“查看”去掉“隐藏受保护的系统文件”才能看到boot.ini文件。
重新启动电脑,选择grub
然后选择”enter command line”
输入
root (hdX,Y)
PS:root和(hdX,Y)之间是有一个空格的。hdX的这个X,是硬盘数,从零开始,如果是一个硬盘就是hd0,Y是根所在的分区,像我安装在 sda9,这个Y就用8。对于如何根安装在哪里,这个对于安装了ubuntu的朋友来说,应该不是问题。但为了百分百的菜鸟(像我一样)还是讲一下吧, grub里面按e,编辑,就看到了。正常情况在Linux里的和终端df -h也能看到.我还是添个图出来吧。
最后
setup (hd0)
重启,可爱的GRUB启动栏又回来了!
Tags: grub
Posted in technology | 1 Comment »>ubuntu 6.06 sources for amd64
Tuesday, January 8th, 2008it work for amd64:)
deb-src http://us.archive.ubuntu.com/ubuntu dapper main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu dapper-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu dapper-updates main restricted
## Uncomment the following two lines to add software from the ‘universe’
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not [...]
Firefox里快捷查询英语单词
Saturday, December 29th, 2007爱词霸是我常用的一个在线查单词的网站,但经常要打开它的页面然后输入查询的单词,搞得我非常不耐烦,so…当然要hack一下了!在Bookmarks(书签)里添加一个链接,内容如下:
Name: 爱词霸
Location: http://dict.iciba.com/%s/
Keyword: w
查询单词的时候就在地址栏输入w 查询的单词
如:
w how
(查询how这个单词)
w dictionray
(将查询dictionary这个单词)
注:name一栏你喜欢改什么名字就改什么吧,Location那一栏不能改变,因为是提交给服务器的地址。Keyword是关键字,也随你喜欢改什么就什么。
Tags: shortcut
Posted in technology | No Comments »>js显示相对时间
Sunday, December 16th, 2007TYPO的show_dates_as_local_time()函数是用来显示相对的发贴时间。
首先链接typo.js
<%= javascript_include_tag “typo” %>
在application的help里添加
def js_distance_of_time_in_words_to_now(date)
time = date.utc.strftime(”%a, %d %b %Y %H:%M:%S GMT”)
“<span class=\”typo_date\” title=\”#{time}\”>#{time}</span>”
End
View里
<%= js_distance_of_time_in_words_to_now(date) %>
<script type=”text/javascript”>
//<![CDATA[
show_dates_as_local_time()
//]]>
</script>
OK,不过这js只显示8星期内的相对时间,超过则显示为原始时间。
Tags: javascript
Posted in technology | No Comments »>用ruby完成c程序设计书的习题
Thursday, December 13th, 2007最大公约数和最小公倍数
m对n求余为a, 若a不等于0
则 m <- n, n <- a, 继续求余
否则 n 为最大公约数
最小公倍数 = 两个数的积 / 最大公约数
a=gets.to_i
b=gets.to_i
max=a*b
if a
b,a=a,b
end
re=a%b #remainder
while re!=0
a,b=b,re
re=a%b
end
print “Greatest common divisor: “,b,”\n”,”lease common multiple: “,max/b
水仙花数
for number in 100..999
hundred=number/100
ten=(number-hundred*100)/10
a=(number-hundred*100)%10
total=hundred**3+ten**3+a**3
if number==total
print “#{number} is right\n”
end
end
一个球从100m高度自由落下,每次落地后反跳回原高度的一半,再反弹。求它在第10次落地时,共经过多少米?第10次反弹多高?
x=100.0
y=0.0
10.times do
y+=x/2+x
x=x/2
end
puts y,x
猴子吃桃
=begin
# recursion
def monkey(n)
if n==1
c=1
else
c=(monkey(n-1)+1)*2
end
c
end
puts monkey(10)
=end
x=1
10.times do
puts x
x=(x+1)*2
end
求素数
for m in 1..300000
k=Math.sqrt(m)
is=true
for i in 2..k
if m%i==0
is=false
break
end
end
if is
print m,” ”
end
end
Tags: ruby
Posted in technology | No Comments »>为什么要学ruby?(10 reasons to learn ruby)
Saturday, November 17th, 2007有人翻译成中文(学ruby的十条理由),但删减太多,还是原味的好:-)
Preamble I discovered Ruby fairly recently, through the excellent Ruby on Rails framework.[1] Although I don’t consider myself a Ruby expert by any means, I read the PickAxe[2], I’ve coded a few utilities for my personal use in Ruby and I’m currently developing with Rails during my free time.
Ruby is currently my programming language of [...]