Ruby FastCGI lighttpd mysql

#cd /usr/src
#export PATH=”/usr/local/bin:/usr/local/sbin:$PATH”
// 安装 readline
#wget http://download.huihoo.com/ruby/readline-5.1.tar.gz
#tar xzvf readline-5.1.tar.gz
#cd readline-5.1
#./configure –prefix=/usr/local
#make
#sudo make install
#cd ..
// 安装 ruby
#wget http://download.huihoo.com/ruby/ruby-1.8.4.tar.gz
#tar xzvf ruby-1.8.4.tar.gz
#cd ruby-1.8.4
#./configure –prefix=/usr/local –enable-pthread –with-readline-dir=/usr/local
#make
#sudo make install
#cd ..
|————————–|
| RubyGems depends on zlib |
|apt-get install zlib1g-dev|我使用yum install zlib1g-dev
|————————–|
没用apt-get这个命令
// 安装apt-get
#wget http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt/apt-0.5.5cnc6-fr1.i386.rpm
#rpm -ivh apt-0.5.5cnc6-fr1.i386.rpm
#apt-get update
// 安装 ruby-zlib
#wget http://download.huihoo.com/ruby/ruby-zlib-0.6.0.tar.gz
#tar zxvf ruby-zlib-0.6.0.tar.gz
#cd ruby-zlib-0.6.0
#/usr/local/bin/ruby extconf.rb
#make
#sudo make install
// 安装 rubygems
#wget http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-0.9.0.tgz
#tar xzvf rubygems-0.9.0.tgz
#cd rubygems-0.9.0
#sudo /usr/local/bin/ruby setup.rb
#sudo gem install rubygems-update
#cd ..
可能出现的错误
ERROR: While executing gem … (SocketError)
getaddrinfo: Temporary failure in name resolution
// 安装 Ruby on Rails
#sudo gem install rails –include-dependencies
可能出现的错误 (ia64-linux)
ERROR: While executing gem … (Zlib::GzipFile::CRCError)
invalid compressed data — crc error

//安装 FastCGI
#wget http://download.huihoo.com/ruby/fcgi-2.4.0.tar.gz
#tar xzvf fcgi-2.4.0.tar.gz
#cd fcgi-2.4.0
#./configure –prefix=/usr/local
#make
#sudo make install
#cd ..
// 添加 Ruby-FastCGI 绑定
#wget http://download.huihoo.com/ruby/ruby-fcgi-0.8.6.tar.gz
#tar xzvf ruby-fcgi-0.8.6.tar.gz
#cd ruby-fcgi-0.8.6
#/usr/local/bin/ruby install.rb config –prefix=/usr/local
#/usr/local/bin/ruby install.rb setup
#sudo /usr/local/bin/ruby install.rb install
#cd ..

#sudo /usr/local/bin/gem install fcgi
—–利用
#wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz
#tar xzvf ruby-fcgi-0.8.6.tar.gz
#cd /usr/ports/www/fcgi
#make install
#cd ruby-fcgi-0.8.6
#/usr/local/bin/ruby install.rb config — \ –with-fcgi-include=/usr/local/include \ –with-fcgi-lib=/usr/local/lib
#/usr/local/bin/ruby install.rb setup
#/usr/local/bin/ruby install.rb install
// 安装 PCRE
#wget http://download.huihoo.com/ruby/pcre-6.6.tar.gz
#tar xzvf pcre-6.6.tar.gz
#cd pcre-6.6
#./configure –prefix=/usr/local CFLAGS=-O1
#make
#sudo make install
#cd ..
// 安装 lighttpd
#wget http://download.huihoo.com/network/http/lighttpd/lighttpd-1.4.11.tar.gz
#tar xzvf lighttpd-1.4.11.tar.gz
#cd lighttpd-1.4.11
#./configure –prefix=/usr/local –with-pcre=/usr/local
#make
#sudo make install
#cd ..
// 安装 mysql
省略 MySQL 的安装
// 绑定 mysql
#sudo gem install mysql –with-mysql-dir=/usr/local/mysql
ERROR: Interrupted
ERROR: While executing gem … (SocketError)
getaddrinfo: Temporary failure in name resolution
Select which gem to install for your platform (i686-linux)
1. mysql 2.7.1 (mswin32)
2. mysql 2.7 (ruby)
3. mysql 2.6 (ruby)
4. mysql 2.5.1 (ruby)
5. Cancel installation
> 2 // 选择2
如果出现
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
|——————————————|
|#sudo apt-get install libmysql-ruby |
|#sudo apt-get install libmysqlclient15-dev|
|——————————————|
#make install
#mkdir -p /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib
#/usr/bin/install -c -m 0755 mysql.so /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib
Successfully installed mysql-2.7
// 创建第一个Ruby on Rails应用
#sudo mkdir /usr/local/ruby
#sudo /usr/local/bin/rails usr/local/ruby/application
#cd usr/local/ruby/application
#sudo /usr/local/bin/ruby script/server
#cp usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/configs/lighttpd.conf to
#vi /usr/local/ruby/application/config
#vi /usr/local/ruby/application/lighttpd.conf
启动 ruby
#ruby script/server
=> Booting lighttpd (use ’script/server webrick’ to force WEBrick)
=> Rails application started on http://127.0.0.1:80
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
此时启动了 Lighttpd web server
http://localhost
OK 一切顺利,Ruby 的环境安装好了。

Illustrator图标作

教程作品。。
前后居然折腾了1hour!!啊
主要是教程里的AI是中文版,偶用的是英文版。
本来knife tools叫的好好的,中文版偏偏叫美工刀。。。。无语。。。。
颜色总是觉得有点异常。。难道是用了cmyk?
TvT做个图标真不容易。。。还是像素美啊。。。

Ruby读取天气预报

读取tq1**里深圳的天气预报,输出html
突然想玩玩erb模板就用多了几行代码。。
结果就不贴图了,就那么几个字,找到好看的天气图片再弄上去

#————————————————
#— You should install rubyful_soup gem first —-
#———————————@ceilwoo——-
require 'open-uri'
weather=open('http://weather.tq121.com.cn/mapanel/index1_new.php?city=%C9%EE%DB%DA')
require 'rubyful_soup'
soup = BeautifulSoup.new(weather.read,:parse_only_these=>'td')
today = “#{Time.now.day}日-#{Time.now.day.next}日”
wt = soup.find(nil,:attrs=>{'class'=>'weather'}).string
temperature = soup.find(nil,:attrs=>{'class'=>'weatheren'}).string
require 'erb'
html= ERB.new %q{

深圳:<%=a%>

<%=b%>

<%=c%>

}
a=today
b=wt
c=temperature
open('weather.html','w'){|File|File.puts(html.result(binding))}

毕设

space转过来浇浇花吧…

2007/5/7
http://www.smashingmagazine.com/2007/02/09/83-beautiful-wordpress-themes-you-probably-havent-seen
83 Beautiful WordPress Themes You (Probably) Haven’t Seen
http://www.smashingmagazine.com/2007/01/19/53-css-techniques-you-couldnt-live-without
53 CSS-Techniques You Couldn’t Live Without
wordpress感觉做的不错,有空的时候要看看,顺便补补php。
smashing介绍的53个CSS应用目前完成了前面16个的研究,暂时卡在prototype上面,要抽时间看看他的源码。
时间哪~怎么没有更多。

8号上午答辩,wish

2007/5/8
答辩顺利结束顺利得难以置信,teacher问的问题太简单了。。。枉我还特意把XMPP的几个规范看了N遍
接下来就要准备下午的英语考试。

其实这是一个关于爱与正义的blog