Google URL Shortener官方API

Google终于正式推出自家的URL Shortener http://goo.gl/供用户使用了。那么接口自然会是有的,不再需要像之前一样需要自己hack才能从外部调用goo.gl压缩网址。

API地址 http://goo.gl/api/shorten
参数 security_token 和 url
未登录就将security_token值设置未null

以下是Python代码写的示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# encoding: utf-8
import urllib,httplib
def test():
	url = 'goo.gl'
	form_fields = {'security_token':'null',
	               'url':'http://google.com'}
	params = urllib.urlencode(form_fields)
	headers = {'Host':'goo.gl',
               'User-Align':'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.10',
               'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
               'Connection':'Keep-Alive',
               'Keep-Alive':115,
               'X-Requested-With':'XMLHttpRequest',
               'Referer':'http://goo.gl/',
               'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
               "Cookie":'authed=1'}
	conn = httplib.HTTPConnection(url)
	conn.request(method='POST',url = '/api/shorten',body=params,headers=headers)
	response = conn.getresponse()
	print response.status
 
	res = response.read()
	print res
 
	getheaders = response.getheaders()
	for head in getheaders:
	    print head[0],':',head[1]
	conn.close()
 
if __name__ == '__main__':
    test()

需要注意的是请求header信息里面必须携带Content-Type信息,否则会得到Bad request的400错误信息。
-EOF-

苹果iTunes截取音乐任意部分的方法

想要截取段mp3音乐做为铃声,但是没软件不知道咋整。网上一查原来通过iTunes就可以截取成ACC格式的音乐,正好它也可以作为铃声使用。随手打开iTunes,做如下操作:

  1. 记住你希望保留的那部分音乐的开始时间和结束时间。
  2. 右击进入歌曲 显示简介->选项,里面有“起始时间”和“停止时间”两个选择,填入你刚才记录的时间段。
  3. 选中歌曲,右击选择“转换所选内容为ACC”。就完成音乐截取了。

-EOF-

找回xCode的StartUp窗口

比较悲惨的xCode的StartUp窗口的钩给去掉以后就再也不能找到地方将其显示回来了。

然而这个东西肯定是有地方存储值的,实在不行那就找找配置文件看。于是解决方法便有了,使用xCode打开这个文件:
~/Library/Preferences/com.apple.Xcode.plist
然后找到XCShowSplashScreen将其后的框钩上(既布尔值为真)然后保存并关闭xCode。

重新打开xCode,StartUp窗口又回来了。
-EOF-

Android Market新增更多付费国家或地区

Android Market 今天起允许29个国家或地区的开发者可以销售付费程序,今天新增加了20个名单如下:

Argentina, Australia, Belgium, Brazil, Canada, Denmark, Finland, Hong Kong, Ireland, Israel, Mexico, New Zealand, Norway, Portugal, Russia, Singapore, South Korea, Sweden, Switzerland and Taiwan

同时在接下来的2周内新的18个国家或地区的用户也购买这些付费程序,共32个国家或地区的用户可以购买付费应用。新增加的名单如下:

Argentina, Brazil, Belgium, Czech Republic, Denmark, Finland, Hong Kong, India, Ireland, Israel, Mexico, Norway, Poland, Portugal, Russia, Singapore, Sweden, and Taiwan

-EOF-