<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d4684235500622716427\x26blogName\x3dCaiwangqin\x27s+blog\x26publishMode\x3dPUBLISH_MODE_HOSTED\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://blog.caiwangqin.com/search\x26blogLocale\x3dzh_CN\x26v\x3d2\x26homepageUrl\x3dhttp://blog.caiwangqin.com/\x26vt\x3d3393395200455623441', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Caiwangqin's blog

Focus on Life, Cloud Service, Smart Hardware, Architecture, Technic and beyond…

Hapy National day and the Mid-Autumn Festival

2006年9月30日星期六

I’ll go home for this long time holiday, our viliage is very beautiful , maybe i’ll Moblog some photo to my moblie blog :)


标签:

posted by Caiwangqin, 09:00 | Permalink | 0 comments |

RubyonRails memcached Session Storage 实践

2006年9月29日星期五

一、安装 memcached


到这里下载安装并启动(Debian 上我使用的是memcached-1.1.13.tar.gz):


./memcached -d -u root -m 10 -l 192.168.0.249 -p 11211



二、安装 memcache-client 和 cached_model , 执行下面的命令或到这里下载安装:


gem install cached_model –include-dependencies



三、配置 Rails App 使用 memcached Session Storage


1. 在 environments.rb 文件后加入以下代码:


require ‘memcache’
require ‘memcache_util’


# memcache defaults, environments may override these settings
unless defined? MEMCACHE_OPTIONS then
MEMCACHE_OPTIONS = {
:debug => false,
:namespace => ‘my_memcache’,
:readonly => false
}
end

# memcache configuration
unless defined? MEMCACHE_CONFIG then
File.open “#{RAILS_ROOT}/config/memcache.yml” do |memcache|
MEMCACHE_CONFIG = YAML::load memcache
end
end

# Connect to memcache
unless defined? CACHE then
CACHE = MemCache.new MEMCACHE_OPTIONS
CACHE.servers = MEMCACHE_CONFIG[RAILS_ENV]
end

# Configure the session manager to use memcache data store
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(
:database_manager => CGI::Session::MemCacheStore,
:cache => CACHE, :expires => 3600 * 12)

 

2.memcache.yml 文件内容:

production:
- 192.168.0.249:11211

development:
- 192.168.0.249:11211

benchmarking:
- 192.168.0.249:11211



四、使用lighttpd + mod_proxy + Mongrel  实现 Scale , 如果安装Mongrel请看我的前一篇Blog:使用Mongrel替代scgi .


1. 实现目标: http://mongrel.rubyforge.org/docs/lighttpd.html 



2.Lighttpd 配置 


server.modules = ( "mod_rewrite", "mod_redirect",
  “mod_access”, “mod_accesslog”, “mod_compress”,
  “mod_proxy”)


$HTTP[”url”] =~ “^/myapp1/” {
proxy.balance = “fair”


proxy.server = (”" => (
(”host”  => “127.0.0.1″,”port” => 4000),


(”host”  => “192.168.0.60″,”port” => 3000)
))
}


$HTTP[”url”] =~ “^/myapp2/” {
proxy.palance = “fair”


proxy.server = (”" => (
(”host” => “127.0.0.1″,”port” => 4001),


(”host”  => “192.168.0.60″,”port” => 3001)

))
}



 

标签:

posted by Caiwangqin, 04:54 | Permalink | 0 comments |

使用Mongrel替代scgi

2006年9月28日星期四

之前在Windows计算机上开发Rails Application , 使用的是 lighttpd+scgi, 后来看到 Mongrel升级了,但由于不支持Ruby 1.8.2 ,所以一直都没有更换。前几天由于需要使用 Multibyte for Rails , 将Ruby 1.8.2 升级为了 1.8.4版本,所以将原来开发环境中使用的 lighttpd+scgi 也更换为了 lighttpd+Mongrel ,这是在Windows平台下开发RubyonRails应用的首选,附安装步骤:


1.安装Mongrel


$ gem install win32-service (pick the most recent one)

$ gem install mongrel (pick the win32 pre-built)

$ gem install mongrel_service


2.运行Mongrel服务(多个应用)


$ mongrel_rails service::install -N myapp1   

   -c c:mypathtomyapp1 -p 4000 -e production 

$ mongrel_rails service::start -N myapp1


$ mongrel_rails service::install -N myapp2   

   -c c:mypathtomyapp2 -p 4001 -e production 

$ mongrel_rails service::start -N myapp2

3.配置Lighttpd


server.modules = (”mod_proxy”,

“mod_rewrite”,

“mod_accesslog”,

“mod_alias” )


$HTTP[”url”] =~ “^/myapp1/” {

proxy.server = (”" => (

(”host” => “127.0.0.1″,”port” => 4000)

)

)

}


$HTTP[”url”] =~ “^/myapp2/” {

proxy.server = (”" => (

(”host” => “127.0.0.1″,”port” => 4001)

)

)

}


3.访问路径


http://localhost/myapp1


http://localhost/myapp2


标签:

posted by Caiwangqin, 06:22 | Permalink | 0 comments |

RoR相对路径配置

2006年9月27日星期三

anuxs在railscn上提问


我写的一个应用,是项目的一部分,做完了,要把它合到现有的项目中去(这个项目是用C++做Apahce 的module扩展来实现的),作为一个子目录比如/task,使用的方法是mongrel + apache + proxy,把这个/task子路径映射到后台的mongrel_rails进程上。也就是反向代理。
网上有文章:http://mongrel.rubyforge.org/docs/apache.html
mongrel的启动参数:


代码:

sudo mongrel_rails start -e production –prefix /task

apache2.2.3的配置:

代码:

ProxyRequests Off
ProxyPass /task http://0.0.0.0:3000/task
ProxyPassReverse /task http://0.0.0.0:3000/task

现在访问http://X.X.X.X/task,应用都比较正常,比如原来的路径是/project/list,现在就是/task/project/list。统统的自动在原来的路径前面加了一级/task/
唯一的问题是:
原来在Rails中手写了一些链接,比如“返回首页”,写的链接路径是“/”,在目前的这个环境中就不正常了,它应该还是回到原来Rails程序的public目录下,而不是回到我现在的apache的根目录下。
原来以来不用link_to或者url_for生成链接,直接手写路径会提高rhtml的解析效率,现在就碰到这样的移植问题。目前已经把应该用link_to/url_for的已经全部换掉了,
再重复一遍我的问题:如何写link_to/url_for,让原来Rails的”/”在我的环境下还是回到Rails的public目录?还有一些链接的静态html文件,如何在移植的环境下,找到服务器上的正确的路径?
路径肯定不能写死。
我记得asp/php下面都有这样的server_map之类的函数,得到一个文件的相对路径。



解决方法:


在 config/environment.rb 中加一行:


ActionController::AbstractRequest.relative_url_root = “/task”


然后在 config/routes.rb 中加一行:


map.connect ‘/’, :controller => “task”, :action => “index”



标签:

posted by Caiwangqin, 06:47 | Permalink | 0 comments |

Multibyte for Rails : ROR中文应用必须的插件

问题的出现:


Rails中处理中文时,会作为单字节处理,如:


“中文”.size => 4


“中文”.reverse => “\304\316\320\326″


解决方法:


安装插件 Multibyte for Rails 后,在rails中使用String#chars访问,如:


“中文”.chars.size => 2


“中文”.chars.reverse => “文中”


其它:


由于其性能并未得到测试,请根据你的应用选择使用。


Resource:


http://wiki.rubyonrails.com/rails/pages/HowToUseUn…


https://fngtps.com/svn/multibyte_for_rails/


http://multibyterails.org/documentation/


标签:

posted by Caiwangqin, 06:36 | Permalink | 0 comments |

Where.uuzone.com

2006年9月25日星期一

Now, we are building where.uuzone.com website, it’s another profile for uuzone to find people and photos. the main line is Where, Who, When and What.



it’s still an alpha version site at sandbox.uuzone.com , powered by rubyonrails ,and only work fine on firefox. welcome for your new experience and give me some comments.


标签:

posted by Caiwangqin, 05:45 | Permalink | 0 comments |

Hangzhou on Rails Meeting Invitation

2006年9月22日星期五

2006年,Ruby on Rails 应用在中国的发展迅速,来自铁道播客的《铁道中文应用开发现状综述》比较全面的介绍了这一发展过程。


2006年10月28~29日, 在杭州举办2006中文网志年会,到时会有很多Web2.0世界的人聚在杭州,我也会去。希望在参加网志年会的同时,和Huangzhou on Rails的朋友聚聚,这是个好机会。为此,我特在ChinaonRails论坛和railscn分别发帖公告,希望去杭州的Rails朋友留言回应,杭州见。


标签:

posted by Caiwangqin, 02:22 | Permalink | 0 comments |

Performance Rails

2006年9月21日星期四

一、Server : Apache, Lighttpd, Mongrel or others


Playing with Lighttpd, Litespeed, FCGI and Mongrel


二、Session: Agile sessions, ActiveRecordStore, SQLSessionStore, memcached or others


Sessions N Such


SqlSessionStore now available as a plugin


三、Optimizing Queries


common Rails performance problems


四、URL: mod_rewrite or rails route


RailsConf2006 Aftermath


五、Efficient Ruby Coding


available for download


六、Resources


http://del.icio.us/caiwangqin/performance


标签:

posted by Caiwangqin, 01:42 | Permalink | 0 comments |

我们距离自由不过几分钟

2006年9月20日星期三

我们距离自由不过几分钟

http://tor.eff.org/download.html.en


http://freehaven.net/~squires/torbutton/


Internet 本来就是非常复杂的东西,如此这样也不过稍微增加了一些些的复杂度,没有任何不妥,极好!


[ read more on livid.cn ]


标签:

posted by Caiwangqin, 04:46 | Permalink | 0 comments |

Ruby 代码-服务器端获取HTTP网站内容

使用Ruby的Network and Web Libraries,能够非常方便的获取一个HTTP网页的内容,如获取优友地带首页的内容:


require ‘net/http’


h = Net::HTTP.new(’www.uuzone.com’, 80)

resp, data = h.get(’/html/friend/’, nil )

puts “Code = #{resp.code}”

puts “Message = #{resp.message}”

resp.each {|key, val| printf “%-14s = %-40.40s\n”, key, val }

p data[0..55]


以上代码片断中的data即为返回的网页内容,关于Ruby 网络应用的详细参考可见《Programming Ruby》中的Network and Web Libraries章节,如果你是在Windows下安装Ruby, 这本书就在Ruby安装目录下:doc/ProgrammingRuby.chm


ZhouRuby扩展还为Ruby扩展了一个HttpRequest类,将Ruby对网络的支持又变得简单易用了很多,非常好用。


标签:

posted by Caiwangqin, 01:33 | Permalink | 0 comments |

TextMate-like Template Syntax for RADRails

TextMate-like Template Syntax for RADRails


Now TextMate users can migrate to RADRails even easier after their 30-day Trial period is over.


I have gone through most of the Rails commands in TextMate and made equivalent templates in RADRails. If anything it will make it easier for rails developers to move back and forth between the two most popular IDEs.


Download: 2006-09-18.RADRails-TextMate_Templates-v1.xml


right click and Save As..


标签:

posted by Caiwangqin, 00:59 | Permalink | 0 comments |

我要去2006中文网志年会

2006年9月19日星期二


cnbloggercon


Originally uploaded by caiwangqin.




我要去2006中文网志年会。响应毛向辉的号召:


Are you ready for this cool webitiviy? Just add this badge to you blog like me! (tag:cnbloggercon)


标签:

posted by Caiwangqin, 02:56 | Permalink | 0 comments |

OpenID in Ruby on Rails

2006年9月18日星期一

Install gems for OpenID:


1.install Ruby OpenID library


gem install ruby-openid


2.install OpenidLoginGenerator


gem install openid_login_generator


3.create rails application openid, don’t forget config you database, the generator weill be create user model for users table.


rails openid


4.run generator for openid_login


./script/generate openid_login auth


Screenshots:



Resources:


http://wiki.rubyonrails.org/rails/pages/OpenID


标签:

posted by Caiwangqin, 03:42 | Permalink | 0 comments |

New skin for my blog

2006年9月17日星期日

今天下午研究了True Blue 1.3.3,一款非常漂亮的K2样式,并且在我的Blog上使用了这一样式。K2是一款设计的非常完美的WordPress主题。iqwolf在他的Blog中写道“K2给其体验者带来的是一种‘黄山归来,天下无山’的感觉。”,I think so:


K2


K2


继完成了Kubrick之后,MichaelChris又和Zeo一起,开发了K2。这部经典的续集同样基于GPL协议发布。


K2的出现,令其他WordPress主题黯然失色。它完全颠覆了主题的传统定义:在我印象里,在K2之前,没有任何一款主题如此完美的运用了 AJAX技术并提供了如此丰富的自定义内容,也没有一款主题如此恰到好处的为各种主流WP插件预留了接口,甚至没有一款主题像它那样用如此精巧的构思简化代码书写工作。K2给其体验者带来的是一种“黄山归来,天下无山”的感觉。强大的功能与易用性的完美结合成就了这部伟大的作品,正如Michael所言:


It won’t make you coffee, sing songs of sweet regret or sit at your bedside when you’re ill, but it might make life just a tad bit easier for you.


这句话的意思我相信每个使用过K2的朋友都能很真实的体会到。K2一直在疯狂的更新,你可以通过SVN得到最新的版本。有空也可以去官方论坛看看,那里有更多的K2 fans和更多的MOD。


标签:

posted by Caiwangqin, 11:31 | Permalink | 0 comments |

ThinkPad笔记本爆炸新案

ThinkPad笔记本爆炸新案

每个场所都有其特定的语言,例如,你绝对要避免在机场提及“炸弹”、“劫持”等词汇,不过,也许用不了多久,“笔记本电池”也会成为禁语--当一台ThinkPad笔记本于候机厅爆炸之后,规则将重新改写。…


标签:

posted by Caiwangqin, 10:18 | Permalink | 0 comments |

Monket Calendar on my blog

2006年9月16日星期六

My Calendar



 


About Monket Calendar


An Ajax enabled online calendar. Drag and drop events to change dates, drag the start/end of an event to create multi-day events, create and edit events without refreshing the page, all with an iCal style interface.


From


http://www.monket.net/wiki/monket-calendar/ 


Bug in Beta 0.9.1


fix  bug with “Default date December 1969″, replace /monket-calendar/monket-cal-source/monket-cal-init.php line 14:


$unix_time    = strtotime($_GET[’getdate’]);


with


if (isset($_GET[’getdate’]) && ($_GET[’getdate’] !== ‘’)) {

$unix_time = strtotime($_GET[’getdate’]);

} else {

$unix_time = strtotime(date(’Ymd’));

}




标签:

posted by Caiwangqin, 09:23 | Permalink | 0 comments |

Rounded corners

Rounded corners


Our rounded corners implementation is based on three different works:



We

took these, combined them, stripped some functionality (kept antialiasing) and simplified the API. There is one

restriction: only DIVs can be rounded with this implementation, which

suited us fine, and made the code a bit shorter.


Usage


You have to attach a class “rounded” to the divs you want round.


Here’s the Javascript that you have to add to the end of your html page:


<script type=“text/javascript”>Rounded(’rounded’, 6, 6);script>

The first parameter, “rounded” stands for the classname

which is used to mark the divs that we want to make round. The other two

parameters are the radius of the corners, the bigger the number, the

rounder you will get.


标签:

posted by Caiwangqin, 05:52 | Permalink | 0 comments |

DHTML: Draw Line, Ellipse, Oval, Circle, Polyline, Polygon, Triangle with JavaScript

 


especially if you aren’t sure about the benefits from


Source: DHTML: Draw Line, Ellipse, Oval, Circle, Polyline, Polygon, Triangle with JavaScript


标签:

posted by Caiwangqin, 04:55 | Permalink | 0 comments |

Donews奇遇记

2006年9月15日星期五

今天登录donews, 看到一大堆令人眼晕的用户名和密码,这是他们推出千像通行证了:



我点新开通,其中HOME,MY,FREE都失败了,不知是什么原因。修改密码时,才知道这个叫千橡通行证,这个通行证也太奇怪了。




标签:

posted by Caiwangqin, 10:37 | Permalink | 0 comments |

Ruby 代码片断-计算两点之间的距离

根据两点的经纬度计算两点之间的距离:


# converts degrees to radians

# params: degree to convert

# returns: answer in radians

def self.convert_to_radians(degree_num)

radians = degree_num.to_f * Math::PI/180

end


# calculate the distance between two zips using the great circle ormula

# params: orig latitude, orig longitude, to latitude, to longitude

# returns: distance in miles

def self.calc_distance_between(orig_lat, orig_long, to_lat, to_long)

# find the delta’s of latitude and longitude

delta_lat = to_lat - orig_lat

delta_long = to_long - orig_long


# compute the sin^2(delta_*/2)

computed_lat = Math.sin(delta_lat/2)

computed_lat = computed_lat * computed_lat

computed_long = Math.sin(delta_long/2)

computed_long = computed_long * computed_long


# find the inner part of the great circle

inner_equation = computed_lat + Math.cos(orig_lat) * Math.cos(to_lat) * computed_long

# find the outer part of the great circle

outer_equation = 2 * Math.atan2(Math.sqrt(inner_equation),Math.sqrt(1-inner_equation))

# find the distance in miles

distance = 3956 * outer_equation

end


标签:

posted by Caiwangqin, 00:38 | Permalink | 0 comments |

Fun With Google Maps

2006年9月13日星期三

Tom Managan’s Fun With Google Maps 提供了两个非常好用的Google API Extension, 使用这两个Extension可以轻松的向Google Map上加入自己希望的Label, 强烈推荐:


TPhoto API Extension


While figuring out how to lay my own images into the Google Maps interface, I ended up with some pretty useful javascript, so I bundled it up as a tightly integrated extension to the official API.


TLabel API Extension


While I was building the Blackbird project, it bothered me that the info windows were so big, even if I didn’t have enough text to fill them. TLabel is my answer to that problem. With it, you can label a point on the map and only take up as much map-space as you need. Now I just need to go back and use it on the Blackbird page.


 


 


其它资源:


http://www.gmaptools.com 提供BpBrowser, BpDownloadUrl, BpLabel, BpMarker, BpMarkerLight, BpMarkerList,BpWindow 等非常有用的Google Map API扩展。


http://www.econym.demon.co.uk/googlemaps/ 介绍了一系列为自定义Google Map的方法。


 


注意:以上网站中国大陆需要使用代理访问。


标签:

posted by Caiwangqin, 11:09 | Permalink | 0 comments |

Rails中文应用开发现状综述



目录

1 前言

1.1 本报告的形成过程和作用范围

1.2 介绍铁道-维基百科的定义

1.3 Ruby on Rails 国外的情况概要

1.4 中文应用开发的历史过程

1.5 中文圈的范围

2 社区整体状况

2.1 中文社区BBS和个人团体blog

2.2 其它知名社区中对ROR的介绍和子分坛

2.3 用即时通信工具作的群组

2.4 宣传推广和反面的论调

2.5 定期和不定期活动

3 主要应用和开发的案例

3.1 对开源和共享代码程序应用或汉化

3.2 对web 2.0 提供现有服务的中文内容应用

3.3 开发的原创作品

4 学习资源

4.1 书籍

4.2 中文的杂志

4.3 学习类的网站

4.4 免费的试验部署环境Web Hosting ROR

4.5 可下载免费的学习材料

5 开源项目汇总

5.1 Hamster

5.2 其它宣称开源的列表

5.3 存放开源的网站和相关工具

6 商业化趋势分析预测

6.1 现有原创站点的商业化倾向

6.2 Railscn论坛商业版的推介

6.3 未来商业化的一般模式

6.4 著名商业团体关注度

7 开发者的介绍

8 结语

9 鸣谢

10 版权说明

PDF版本下载:

http://rorcast.blogger2blogger.com/public/files/statusRailscn.pdf

点击下载报告

Html版本:

http://rorcast.blogger2blogger.com/public/files/statusRailscn.htm

来源: 铁道播客


标签:

posted by Caiwangqin, 03:35 | Permalink | 0 comments |

注意:控制Rails Application的Logging文件大小

这是一个很容易被忽视的问题,尤其是对于新入门的Rails程序员。默认设置时,Rail程序在运行的时候,提供了很详细的Log,Log文件快速增长会占用大量的服务器空间,文件一般保存在rails app/log/目录下。


Log Level


Rails可以通过选择不同的log lever来控制log文件的输出,可以使用的log lever有:debug, :info, :warn, :error, :fatal. :debug level提供最详细的log, 可以将每一条sql都记录下来。:info level是production环境下的默认设置,不会写出sql的执行情况,但也会很详细,如果是ActiveMailer,它会记录下每封信的内容,Log文件内容就是快速增长。为了避免Log把空间塞满的情况发生,要注意定期清除Log,另外是选择:warn level等log level, 只记录重要的信息.


设置方法:


在/config/environment.rb文件中可以设置以下选项


config.log_level = :debug


如果只希望在production环境下,输入少量的log, 则只需要在config/environments/production.rb中增加一项(我就是这样设置的)


config.log_level = :warn


参考资料:HowtoConfigureLogging in Ruby on Rails


 


标签:

posted by Caiwangqin, 02:40 | Permalink | 0 comments |

Ruby 代码小记

2006年9月12日星期二

1. 获取本机IP



require ‘ipaddr’

require ’socket’


$KCODE = ‘u’


p Socket.gethostbyname(’localhost’)

ip = Socket.getaddrinfo(Socket.gethostname,nil)[0][3].split(”.”)[3].to_i


p ip


2.MD5加密


require ‘digest/md5′


def getMD5(userId)


digest = Digest::MD5.hexdigest(userId)


end


puts getMD5(”caiwangqin”)


标签:

posted by Caiwangqin, 10:59 | Permalink | 0 comments |

Tinyfool翻译的Google Maps API中文同步文档正式发布了

posted by Caiwangqin, 10:47 | Permalink | 0 comments |

Build SEO-friendly AJAX Website

2006年9月11日星期一

AJAX能够为Web Application增加良好的User-friendy, 由于今天的search engine robots不能阅读Javascript内容,所以搜索引擎不可收录AJAX的Website, 可以从以下方面做些许改进来建设友好的搜索引擎优化的Website.


一、使用<noscript>标签,要注意在每页的<noscript>标签中书写不同的内容,否则可能被认为是SEO作弊手段中的第三条而被认为是Spam:


<head>

<title>Entry Page to your new Website</title>

<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″/>

<meta name=”Keywords” content=”Keyword for your Website”/>

<meta name=”Description” content=”Excellent convincing sales copy for your website”/>

</head>

<body>

The content of your Websites body begins here. This is where you will call your AJAX information, including the Javascript.

<script type=”text/javascript”>

<!–document.write(”This is just the Beginning!”)//–>

</script>

<noscript>

<p>Begin the information to be covered when the script can not be used. </p>

<p>Your browser does not support JavaScript! This page covers the following information relater to ours product and services. </p>

</noscript>





</body>

<html>


二、好的AJAX程序应该允许用户在完全禁止Javascript的时候也能够正常工作,为第一个AJAX页面准备一个独特的URL, 使用Google Web Toolkit来开发,Google Web Toolkit考虑了AJAX SEO的问题。



参考资料:


Implementing AJAX? SEO and Accessibility Considerations


SEO Considerations for AJAX Development




标签:

posted by Caiwangqin, 09:26 | Permalink | 0 comments |

搜索引擎优化(SEO)实践

李杰SEO学习笔记-前言中看到他推荐的电子书《搜索引擎优化(SEO)知识完全手册》,来进行搜索引擎优化实践。


一:关键字策略


1. 关键字选择


确定核心关键字,再核心关键字进行排列组合产生关键词组或短句


不用与自己无关的关键字


一页中关键词最多不要超过3个为佳


2.关键字密度


在一个页面文本中出现关键字一般要在1%到7%


3.关键字分布


<title>UUZone, 优友地带, 您的网络社交平台.</title>


<meta http-equiv=”title” content=”UUZone, 优友地带, 您的网络社交平台.”>


<meta name=”description” content=”中文网络社交第一站, 结交真朋友, 个人门户, 博客, 相册,档案,小圈子”>


<meta name=”keyword” content=”个人门户, 博客, 相册, 个人档案,小圈子”>


二:网页设计


1.目录结构和URL


扁平式目录层次,一级子目录最好


拥有可以通过首页进行的外部链接


将动态URL转化为静态URL,如:http://www.uuzone.com/message.do?id=2 -> http://www.uuzone.com/message/2


2.导航结构


主栏目导航清晰


“面包屑型”路径,如:UUZone Blog > Blog管理 > 写新blog


使用网站地图(Sitemap)


不使用框架结构


压缩网页大小,优化图像,给图像加ALT属性,Javascript写到JS文件中


三:搜索引擎优化技术支持


1.Robots.txt和Robots META标签


robots.txt必须放置在一个站点的根目录下,而且文件名必须全部小写。如:


User-agent: *


Allow: /


Disallow: /xml?


详细介绍:http://www.emarketer.cn/em/expert/408.htm


2.动态网页优化


URL重写转向(mod_rewirte)


建立静态入口


不可收录带Session Id的内容


四:搜索引擎优化重点是链接策略


1.登录搜索引擎分类目录,如:www.dmoz.org


2.高质量导入链接


五:SEO作弊手段


1.关键字堆砌


2.虚假关键词


3.隐形文本/链接


4.重定向(Re-Direct)


5.偷换网页(Bait-&-Switch)


6.复制站点或内容


7.桥页/门页(Bridge/Doorway/Portal/Entry)


8.隐形页面(Cloaked Page)


9.重复注册


10.垃圾链接


11.包含指向作弊网页的链接


标签:

posted by Caiwangqin, 05:34 | Permalink | 0 comments |

confused with microsoft

2006年9月10日星期日

I have got an invitation for mywallop, and i make our social networking on it long time ago.


yesterday, a friend from taiwan leave a message on my blog for request a wallop invitation. so i open http://mywallop.com/ and signin, but i can not signin and got this message: 


The account for ‘jesse.cai(at)gmail.com’ has been deactivated due to inactivity. You must be re-invited to join Wallop.


I can got my password on Forgot password?, i don’t know why i must be re-invited. so bad mywallop, so bad microsoft.


标签:

posted by Caiwangqin, 02:28 | Permalink | 0 comments |

Ruby on Rails使用utf-8编码在Sql Server数据库中保存中文指南

以下描述在Windows环境下开发RoR,使用UTF-8编码保存SQL Server中文的方法:


一、安装DBI 0.1.0,下载地址为(http://ruby-dbi.sourceforge.net)


二、安装RubyODBC 0.996,安装方法是将zip包中的文件Copy到…/ruby/1.8/i386-mswin32目录下,下载地址为(http://www.ch-werner.de/rubyodbc/)


三、在Rails App的application.rb文件下加入以下代码:


class ApplicationController < ActionController::Base  before_filter :configure_charsets   

def configure_charsets       

@headers[”Content-Type”] = “text/html; charset=utf-8″  

end

end 


四、environment.rb文件末尾中加入以下代码


require ‘odbc_utf8′ 


五、打开Windows控制面版->管理工具->数据源ODBC,创建系统DNS数据源,这里数据源名称命名为“192.168.0.10 


六、修改database.yml文件


development: 


adapter: sqlserver 


mode: odbc 


dsn: 192.168.0.10 


username: sa


password: sa


 


 


 


标签:

posted by Caiwangqin, 01:29 | Permalink | 0 comments |

基于Debian 3.1 linux的Ruby on Rails ODBC安装配置过程

1.   安装相关deb包


a)         Apt-get install unixodbc freedts-dev  (linux的ODBC驱动和 MS SQL and Sybase client library static libs and headers)


2.   配置ODBC DSN


a)         Vi  /etc/freetds/freedts.conf


添加下列信息:


[TEST-DB2]                       (自定义的数据库服务器名)


        host = 192.168.0.10       (数据库服务器的IP地址)


        port = 1433                (数据库服务器端口号)


        tds version =8.0


b)         vi /etc/odbc.ini


          


[TEST-DB2]                                         (DSN名)


Driver         =       /usr/lib/odbc/libtdsodbc.so    (一定要指定libdtsodbc.so的完全路径,否则ruby不能找到驱动)


#Setup        =      /usr/lib/odbc/libtdsS.so     


Server         =       192.168.0.10


Servername   =          TEST-DB2


Database      =       TESTBlog                    (指定缺省数据库)


#Port           =       1433


3.   运行 isql测试数据库连接


                     


 


apachtest:~# isql -v TEST-DB2 sa sa


+—————————————+


| Connected!                            |


|                                       |


| sql-statement                         |


| help [tablename]                      |


| quit                                  |


|                                       |


+—————————————+


SQL>


SQL> select count(*) from UserBlog


+————+


|            |


+————+


| 28239      |


+————+


1 rows affected


1 rows returned


SQL>


连接OK,注意,数据库名是大小写敏感的


 


4.         安装ruby1.8.2


Apt-get install irb   (会自动将ruby1.8.2装上,以及libdbi)


Apt-get install libodbc-ruby1.8   (安装ruby的odbc接口,自动安装好libodbc2)


Apt-get install libdbd-odbc-ruby


 


5.         运行irb


apachtest:~# irb


irb(main):001:0> require “dbi”


=> true


irb(main):002:0>  dbh=DBI.connect(’dbi:ODBC:TEST-DB2′,’sa’,’sa’)


=> #, @trace_mode=2, @handle=#>>irb(main):003:0>


 


返回正常信息OK


 


6.配置ruby


    Vi  config//database.yml:

development:

  adapter: sqlserver

  mode: odbc

  dsn: TEST-DB2

  username: sa

  password: sa

 


运行程序


 


目前ruby还有个问题没有解决,就是使用odbc_utf8时,ruby会报内存不足,然后程序中断,如果不使用UTF8,程序可以正常运行,但网页中不能提交中文内容!


 


该文章由carl.cao整理.


标签:

posted by Caiwangqin, 01:26 | Permalink | 0 comments |

Ruby on Rails中执行存储过程和指定SQL语句的方法

在使用RailsActiveRecord对数据库进行更新操作时,如果使用update(id,:field =>value) 方法更新数据,则此时rails并不是执行以下过程:


 1. Update table set field = value where id = id  而是实际执行了 2. Update table set field = value , field2 = value2 … where id = id 这意味着当数据库中这张表拥有50个字段的时候,Rails就分别更新了50个字段,只是将程序指定的field替换成了指定的value,其它没有指定的field一般不是我们所期望的执行更新的。 解决这个问题的方法是使用ActiveRecord::Baseconnection.execute方法,这个方法可以直接写更新数据库的sql语句,当然也可以执行SQL Server存储过程。使用以下语句就可以执行1中的数据库操作: Connection.execute(“update table set field = value where id = id”) 





标签:

posted by Caiwangqin, 01:24 | Permalink | 0 comments |

详细解读Rails Caching

问题出现:


I am trying to use caches_action and the agile book says that it is keyed

off the URL, however it does not seem to pick up the URL parameters.


http://localhost:3000/controller/action/id?foo=bar

and

http://localhost:3000/controller/action/id?foo=foobar


Returns the same page.


问题原因:


Rails Caching不能Cache Parameter,所以caches_action时会出现上述原因。 


解决方法:


1. 修改rails routes.rb,将原来的”?parameters=”的调用方式更改为/action/:parameters的访问方式,以使用rails cache不同的fragment


2. 安装一个rails-caching的plugin,然后修改environment.rb中增加cache key for action : Action Cache Update Plugin


参考资料:


http://wiki.rubyonrails.org/rails/pages/Action+Cache+Update+Plugin


http://blog.craz8.com/articles/2005/12/26/rails-action-cache-upgrade 


http://scottstuff.net/presentations/rails-caching/


http://lists.rubyonrails.org/pipermail/rails/2006-February/017726.html


 


标签:

posted by Caiwangqin, 01:15 | Permalink | 0 comments |

Test Tag4Writer in Windows Live Writer for WordPress

2006年9月9日星期六

Windows Live writer, UTW and Tag4Writer


[tags]WordPress[/tags][tags]Writer[/tags][tags]Tag4Writer[/tags]


标签:

posted by Caiwangqin, 09:14 | Permalink | 0 comments |

电视娱乐2.0,大头之间的游戏

接连两个周五晚上看了李咏主持的梦想中国,为了体验草根参与的精神,我为熊汝霖投了一票。


在广大Web2.0公司还找不到赚钱方法的时候,电视台和电信这两大媒体却很High的从广大民众口袋里掏出一块一块的人民币。也唯有他们能够把这种松散的会员(电视观众),和粘度极高的用户(手机用户)结合起来,轻松的实现赢得,而且让人们在付钱的时候Have fun.


一直以来,和电信这种有政府撑腰的垄断行业合作都是极度不平等的。Web2.0公司要想让用户Pay for have fun, 我觉得主要还得靠小额支付方式的完善,当网民都象拥有Instant Messenger Account一样,拥有多个支付账号的时候,你想不赚钱都不行了,然而这又牵扯到另一个大头的配合程度--银行。


看来Web2.0注定了生存在夹缝之中。


标签:

posted by Caiwangqin, 00:50 | Permalink | 0 comments |

Weekend! Weekend!

2006年9月8日星期五

Weekend! Weekend!

It is weekend, again. Gave me one day, to relax……


标签:

posted by Caiwangqin, 10:15 | Permalink | 0 comments |

优友地带办公楼

以下是从优友地带插入的Google Map, 地点是优友地带的办公楼,详细请看老冒的BLOG.


打开地图查看

标签:

posted by Caiwangqin, 03:55 | Permalink | 0 comments |

rails 1.1 api chm 版本下载,照样支持索引和全文检索

rails 1.1 api chm 版本下载,照样支持索引和全文检索

rails 1.1 api chm 版本下载,照样支持索引和全文检索


下载


PS: 1.0的还在这里列出


tech.cap 2006-04-05 01:21 发表评论

标签:

posted by Caiwangqin, 01:57 | Permalink | 0 comments |

UUZone, 优友地带, 您的网络社交平台.

posted by Caiwangqin, 01:41 | Permalink | 0 comments |

Wangtam: 看看 mixi.jp

posted by Caiwangqin, 01:32 | Permalink | 0 comments |

windows live mail desktop 开放邀请注册

windows live mail desktop 开放邀请注册

感谢匿名者的投递:
投递者昨天晚上9点36分,收到MS的邮件,全文如下,大致是说可以发送注册邀请使朋友来参与windows live mail desktop beta


标签:

posted by Caiwangqin, 01:23 | Permalink | 0 comments |

links for 2006-09-07

2006年9月7日星期四

posted by Caiwangqin, 23:27 | Permalink | 0 comments |

MashupCampChina








MashupCampChina



Originally uploaded by caiwangqin.



测试一下从Flickr Blog 到 Wordpress, Wordpress 在这些功能上比LBS好的不是一点点,so cool~




标签:

posted by Caiwangqin, 00:52 | Permalink | 0 comments |

很喜欢用Windows Live Writer写Blog

可能是习惯了使用 Word , 也可能是喜欢Live Writer这个名字


标签:

posted by Caiwangqin, 00:40 | Permalink | 0 comments |

Try Windows Live Writer

It’s so cool , i like this because it’s most like office word.



标签:

posted by Caiwangqin, 00:33 | Permalink | 0 comments |

links for 2006-09-06

2006年9月6日星期三

posted by Caiwangqin, 23:27 | Permalink | 0 comments |

Goodbye LBS, Hello Wordpress!

gooooooooooooooooon!


标签:

posted by Caiwangqin, 09:39 | Permalink | 0 comments |

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!


标签:

posted by Caiwangqin, 08:37 | Permalink | 0 comments |

About Me

2006年9月5日星期二

CONTACT CAI WANG QIN



Blog

I'm Jesse Cai, my chinese name is Cai Wang Qin. My blog site is http://blog.caiwangqin.com/. I update it everyday about events in my life. If you find any article interesting, just post your comments there. Your comment is displayed on my home page. I can get notification via email about your post. So I won't miss your comment.

Resume

http://cai.wealink.com/
Interview With Jesse Cai (中文翻译)

Email
jesse.cai(at)gmail.com is my major personal email that I check daily. Send small size email to this address only.


Please send me an email before you add me to your contact. Otherwise, I may have to ignore you. I don't enjoy chatting on business time.


标签: , , ,

posted by Caiwangqin, 19:29 | Permalink | 0 comments |