लास्ट.फम ओं ubuntu
Last.fm 是目前很热门的社会化音乐分享网站,ubuntu下当然也不能少。ok,downloadubuntu edgy软件包安装...
or
cd ~/downloads/
sudo dpgk -i lastfm_1.4.2.58240_i386.deb
录制Last.fm 上的音乐可以选择TheLastRipper:
详见linuxtoy
Read more!
Rails上的Opensocial实现
什么是OpenSocial
OpenSocial是一套API,具体说是由两种类型的API组成。第一种,REST 形式的API是向Social Network或其他遵循 该协议的应用,发送个人资料,好友,活动和persistence components[?]。第二种,Javascript API是以表单的形式实现第一种的REST应用。
Rails上的OpenSocial
本段译自Google's OpenSocial with Ruby on Rails根据OpenSocial documentation上的显示,目前OpenSocial开放了2中类型资源:people,一个用户的好友,和activities,这些好友的活动/行为。这种结构正好符合rails对集中资源的理解,在一个user Controller中,我们可以狠容易的得到用户的好友和他们的活动。
OpenSocial的API是按照REST结构设计,但是它并不完全符合Rails的观点,首先,通过URL访问资源的形式并不是Rails的标准形式。其次,它不包含format extension,这意味着你不能直接使用respond_to块。
但是上面两个问题可以通过在routes文件增加一组路由描述和增加一个自定义的mimetype来解决。
下面的路由规则是在描述如何在我们的user_controller中对应OpenSocial 中的people资源的。
# config/environment.rb
Mime::Type.register "application/x-opensocial", :opensocial
# config/routes.rb
map.opensocial_person '/feeds/people/:id', :controller => 'users', \
:action => 'show', :format => 'opensocial',\
:conditions => {:method => :get}
map.opensocial_person '/feeds/people/:id', :controller => 'users',\
:action => 'update', :format => 'opensocial', \
:conditions => {:method => :put}
map.opensocial_person '/feeds/people/:id', :controller => 'users', \
:action => 'destroy', :format => 'opensocial', \
:conditions => {:method => :delete}
# app/controllers/users_controller.rb
respond_to do |format|
...
format.opensocial
end如果上面的比较麻烦,可以下载作者发的插件。这样你的route文件可以这样写:
# config/routes.rb
map.resources :users do |user|
user.resources :activities
user.resources :relationships
end
map.opensocial_people :users do |user|
user.opensocial_friends :relationships
user.opensocial_activities :activities
end里克:google上看到的是两种资源,一种持久性方案,下面这个单元就介绍了OpenSocial Container
OpenSocial Container
本段整理自OpenSocial? What's that?
OpenSocial Application
OpenSocial Application使用XML文档来最终render[一个狠程序化的词,我感觉应该不翻译为好]给用户。这个xml包含了metadata,html,和javascript。下面是Last.fm上的OpenSocial应用。
http://www.last.fm/opensocial/myfavouritemusic.xml
< ?xml version="1.0" encoding="UTF-8"?>
< ![CDATA[
]]>
OpenSocial Container
OpenSocial Container的设计,是用来给网站提供用户的选择,配置,加强网站的用户应用,尤其在用户属性页面。OpenSocial Container需要能够理解XMl文件格式,并实现OpenSocial Javascript API。
OpenSocial Container如何工作
里克:下面的话还在捉摸
The OpenSocial Container boils down quite simply to an IFRAME with the text of the element from the application's XML dumped in to the body. One difficulty for building a container is dealing with the security risks of exposing cookies set by the "Host Network" to the Application's content, since the Host is doing the embedding. To ensure privacy and a certain degree of security the Container needs to originate from a different domain name than the Host. By doing this the Host/Container (they are the same entity) trick the browser into protecting the Host cookies from the Container's (and thus the Application's) Javascript.
The Container also makes extensive use of AJAX to request data from the Host/Container. This is how the Application gets access to the profile, friendship, activities, and persistence information.
为什么这么做?我们要注意什么?
OpenSocial standardizes social networking APIs. That alone is not particularly novel. But this is Google we're talking about here. With that kind of backing and buzz this may stick. As a developer this means that you only need to learn one API to be able to build social applications. One particularly interesting aspect of the OpenSocial API is the persistence layer. Using this portion of the API a developer can, quite easily, create a full featured interactive application which is entirely self contained in a single static XML file. All of the persistence and communication is handled by the Container and the Host. Now that is cool.
If this takes off like is appears to be poised to do, then we could be in for some excitement akin to the growth and fragmentation of the early social networks; except this will be happing above the social network layer. One interesting possible side effect will be a growth in the popularity of niche social networks. OpenSocial appears to lower the castle walls of the established networks. I expect the crossover in data and user-base between networks will skyrocket as once "proprietary" profile data becomes easily moved and shared.
下载OpenSocial Container 0.2.0
ruby script/plugin install
http://opensocial.rubyforge.org/svn/plugin/tags/0_2_0/opensocial_container
下载OpenSocial Container 0.3.0
ruby script/plugin install
http://opensocial.rubyforge.org/svn/plugin/tags/0_3_0/opensocial_container
参考资料:
OpenSocial Container0.2.0
OpenSocial Container 0.3.0
OpenSocial? What's that?
Google's OpenSocial with Ruby on Rails
OpenSocial
其他:
Installing and Configuring Nginx and Mongrel for Rails
Database Optimization for Rails Apps
原文详见:http://railser.cn/archives/tag/opensocial
Read more!
关于google的音乐
一个疯狂的Google Head,Yariv Ben Yehuda(via digg & Philipp)自己制作了一张非官方的Google音乐专辑,并且做了个类似Google风格的网站,把专辑公开发布在上面。网站里的"News、Maps、Videos、Images"等链接都是有效的,点击后会进入不同的网页。其中整张专辑的曲目以Google搜索结果的形式列出来:
专辑主打歌曲"The Googler",不过歌曲一般。
再来一段google话剧
Read more!
ubuntu平台安装Eclipse+phpeclipse
1.安装JAVA环境支持
sudo apt-get install sun-java6-jre
安装JDK:
sudo apt-get install sun-java6-jdk
设置当前默认的java解释器:
sudo update-alternatives --config java
配置JAVA环境变量:
sudo gedit /etc/environment
在其中添加如下两行:
CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME=/usr/lib/jvm/java-6-sun
sudo gedit /etc/jvm
将文件中的
/usr/lib/jvm/java-6-sun
这一行填入到配置块的顶部
重新启动计算机,用命令测试jdk的版本
java -version
显示如下信息:成功安装
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
2. 在Eclipse官方网站上下载Eclipse http://www.eclipse.org/downloads/下载完eclipse后解压就可以运行了
创建桌面连接
$ sudo gedit /usr/share/applications/eclipse.desktop
加入下面内容
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse SDK
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Application;Development;
保存后完成了eclipse安装。 应用程序->编程->Eclipse 点此菜单运行eclipse.
3.使用在线更新来安装phpeclipse插件:
打开Eclipse的help->software updates->find and install,选择search for new features to install,添加一个update site:
Name: PHPeclipse Update Site
URL: http://phpeclipse.sourceforge.net/update/releases
finish,更新,->phpeclipse->选中next,install all
片刻之后大功告成
Read more!
