2009年4月28日星期二

2009年3月22日星期日

2009年3月13日星期五

JavaEye闲聊客户端(Ruby+Shoes)





支持Windows系列,Linux,Mac ox等系统。欢迎大家测试~~目前功能还很简单。

最后,本着无图无真相的原则,传个图片:-)

2009年3月2日星期一

Basic Auth HTTP Request in Ruby

目前大部分国内微博(mini blog)开放api都是以HTTP Basic Access Authentication为验证方式。包括饭否,叽歪,甚至JavaEye的闲聊。Twitter现在已经是用OAuth方式认证了。
现总结一下用ruby进行HTTP Basic 认证方法:

=============华丽的分割线=================
require'net/http'
require'base64'
url="http://api.javaeye.com/api/auth/verify"
user="your_username"
password="your_password"
basic_str="Basic #{Base64.b64encode(user+":"+password)}"
url=URI.parse(url)
http=Net::HTTP.new(url.host,url.port)
resp=http.get(url.path,{"Authorization"=>basic_str})
puts resp.code
puts resp.body

=============华丽的分割线===========
require'net/http'
url="http://api.javaeye.com/api/auth/verify"
url=URI.parse(url)
Net::HTTP.start(url.host) do http
req=Net::HTTP::Get.new(url.path)
req.basic_auth "usernae","password"
resp=http.request(req)
print resp.code,resp.body
end
==================分割线======================
3.user open-uri



2009年2月25日星期三

用Twe2免费接收Twitter短息[译言翻译]

2008年8月,Twitter取消了免费的Twitter更新短信提醒服务,仅保留了美国、加拿大和印度。英国用户只能发送,但是不能接收。Twe2开发者对此感到非常失望,推出了自己的免费服务,你现在就可以用手机接收Twitter更新了,几乎支持所有国家和地区。

功能

在默认状态下,当你在Twitter上收到直接消息或者回复时,Twe2就会给你发送一条手机短信,为了维持该服务,Twe2在每条短信后边都添加了一条简短广告。

Twe2的开发者还开发了著名的FriendDeck软件。Twe2增加了很多有趣的功能,比如用户可以通过Twe2定制搜索关键词,一旦你的消息里面出现了关键词,Twe2就会发送短信给你。

为了方便用户管理短信发送更新,用户可以设定通知频率(每小时不超过100条)。

以下是设定步骤:

1.登录Twe2网站:http://www.twe2.com/Default.aspx,输入Twitter用户名和密码,点击登录(login):

2.选择国家,输入手机号,申请确认短信:

3.输入确认码。

A Small Tinyurl API

Ruby Code:
require'cgi'

require'open-uri'
def get_tiny_url(url)
url=CGI::escape(url)
open("http://tinyurl.com/api-create.php?url="+url).read
end

Google Data On Rails

Monday, February 23, 2009 at 9:04 AM



"Where's Ruby on the list of client libraries?"

My colleague Jeff Fisher recently open sourced a Ruby utility library for the Google Data APIs. Mind you, it's not a full-blown client library, but it does handle the fundamentals like authentication and basic XML manipulation using the REXML module.

We've got a comprehensive article and sample application, the DocList Manager (full source), to demonstrate the basics.

Please visit us in the Google Data APIs forum to ask questions or submit feedback.

Hello Hooopo

Hello Hooopo