How to twitter

安装Echofon(即Twitterfox),
Windows下修改C:\Documents and Settings\用户名\Application Data\Mozilla\Firefox\Profiles\随机信息.default\extensions\twitternotifier@naan.net\components\nsTwitterFox.js

var TWITTER_API_URL = "https://twitter.com/"一行为
var TWITTER_API_URL = "xxx", 其中'xxx'为自定义API地址.

至于怎么自定义API, 看这里.
或者去找公开的API.

//以此记录这个艰难的岁月
//幸运的是
//这一切都会过去
//总有一天

Posted in 随笔 | Leave a comment

遗忘

曾经的脸庞
绕着指尖如烟般散去了

Posted in 片言只羽 | Leave a comment

最近做了哪些事

1. 窗口管理器换用awesome, 感觉很不错

2. 装了urxvt, 很有professional的感觉, 之前一直用konsole

3. 开始用vimperator, 一般操作没问题

4. 重装了Windows, 体验飞一般的感觉

5. 从KDE4.1升级到KDE4.3, 又一次惊艳, 很像传说中的Win7的界面. 但是在我机器上有点慢, 所以默认WM改成awesome了.

以上做的这些事情部分是因为鼠标坏了, 单击变双击, 右键常抽风. 也有可能是机器老化了, 加上天气热, 对鼠标事件响应有问题. 所以能用键盘解决的尽量用键盘解决.

Posted in GNU/Linux, Windows | 2 Comments

[Movie]V for Vendetta | V字仇杀队

V4Vendetta

V4Vendetta

导演: James McTeigue
编剧: Andy Wachowski / Larry Wachowski
主演: Natalie Portman / Hugo Weaving / Rupert Graves / Stephen Rea

官方网站: http://vforvendetta.warnerbros.com/
制片国家/地区: 美国
上映日期: 2006-03-16 >更多
语言: 英语
又名: 复仇者V / V怪客

imdb链接: tt0434409

>>>

很不错的电影, 非常现实, 尽管它发生在未来

Posted in 娱乐 | Leave a comment

一个好玩的网站

http://www.chromeexperiments.com/

原来浏览器和javascript还可以这样.

有个小游戏挺好玩:

http://www.chromeexperiments.com/detail/twitch/

注意: 要用chrome打开, 用ff的话, 有些内容会卡得不行.

Posted in 随笔 | Tagged , , | Leave a comment

Google-Wave Extensions List(截至2009-07-22)

这是一个Wave中根blip的内容, 但是被某个wavebot删掉了, 在这里做个备份.
其中的BotURL和Dr Weather是我做的, 哈哈.......

Google-Wave Extensions List

(If you want to start a deeper discussion about an extension, create a new wave and link to it from here.

(Feel free to edit this wave to include your own extensions, so that all the extensions can be found here)

When adding a new extension, use this format:

<name linked to demonstration/discussion> - <status, gadget path, or bot contact> - <description>

Don’t forget to sort alphabetically!

Do not place gadgets or robots into this wave!

(This wave is not for testing, keep it clean and concise.)

Robots

(To use robots, add them as a contact, then add the robot-contact to a wave)

Chatbots

Eliza - ogenex@appspot.com - An implementation of the Eliza chatbot borrowed from the NLTK.

Elize - elizarobot@appspot.com - Is one of the first robots that was created by non Googler and is very useful if you are feeling alone in your Google Wave client.

Rude chatbot - notatory@appspot.com - An obnoxious chatbot borrowed from the Natural Language Processing Toolkit.

Conversion

BotURL - boturl@appspot.com - A URL Linker - Replaces full URLs with hyperlinks.

Dice Bot - dice-bot@appspot.com - Dice-rolling bot. Dice Bot will replace XdY (X is the number of dice; Y is the number of sides) with the results of those rolls.

Flippy - flippy-wave@appspot.com - Turns text upside-down.

Hearty Emobot - hearty-emobot@appspot.com - Replaces ASCII art with wingding characters.

IPA Bot - ipa-bot@appspot.com - Changes normal letters into special characters used for phonetics.

Swedish Chef - borkforceone@appspot.com - Changes english into Swedish-Chef Speak. Bork! Bork!

Shortee - Wish - Change “c u l8r” to “see you later” etc.

Games

Hangman - wavehangman@appspot.com - Play Hangman.

Roshambo - roshambowave@appspot.com - Play Roshambo (Rock / Paper / Scissors).

Speedy - Wish - Track the words per minute of all participants, competitive typing!

Groups

Groupy - groupy-robot@appspot.com - Robot to manage groups.

Integration

drop.io - mikeswaverobot@appspot.com - Creates a drop and puts the info into the wave whenever the robot is added as a participant.

OpenAustrailia - In Progress - A robot to allow interaction with the OpenAustralia web site.

PlonieBot - In Progress - ploniebot@appspot.com - Brings wave document editing capabilities to the Plone CMS

Tweety the Twitbot - tweety-wave@appspot.com - You can access your Twitter account.

Twiliobot - twiliobot@appspot.com - Transforms phone numbers into click-to-call links. If user clicks a link, a call is placed to his phone and to the number in the link. The call can be transcribed and inserted into the wave as text with a link to the audio.

Language

PhilBot - Wish - A suggested solution to the problem of waves with languages you can’t read.

Rosy the Translator - rosy@wavesandbox.com - Translator (40 Languages).

Polling

Polly the Pollster - polly-wave@appspot.com - Poll Bot.

Search / Aggregation

Dr Weather - shiny-sky@appspot.com - Gives the weather for a City

Embedded Search Results - wave-sandbox@appspot.com - Web and Image searches inline.

Grauniady - grauniady@appspot.com - Searches the latest items from The Guardianfor a given phrase.

Stocky - stocky-wave@appspot.com - Detects stock symbols from a wave and updates it with the live stock price.

Wavethingy - wavethingy@appspot.com - searches Amazon for DVDs and books, and gives the author a cut of any purchases made off the links.

Utilities

Databot - Wish - Will start as soon as the GData interface is published.

JBREAKOUT BOT ADDED - jbreakout@appspot.com - Debug utility that reports event triggers.

Multi - multi-wave@appspot.com - A quote collector. Reply a blip you want to quote with ‘quote this’ and randomly display a quote with ‘quote <wave@account.com>’. The bot is still being under development but you can try playing with it.

Style Chart Robot - stylechart@appspot.com - Inserts a chart into a wave.

Wave Management

Linear - Wish - Enforce all replies to be to the main wave. If a user replies to a reply, remove it and place it as a reply to the main wavelet.

Sweepy - sweepy-wave@appspot.com - Remove empty, whitespace-only blips.

Taggy - taggy-wave@appspot.com - Recognize #hashtags and add them as tags to the wave.

Tocgen - tocgen@appspot.com - Table of Contents auto-generated and updated based on the h1,h2,h3,h4 in a wave.

Gadgets

(To use these goto Debug > Extensions > Add Gadget > Enter the url into the bottom text box)

Utilities

Bidder - http://wave-api.appspot.com/public/gadgets/bidder.xml - Simple Auction.

Checky - http://wave-gadgets.appspot.com/checky.xml - Basecamp-like checklists with drag-and-drop.

HTML - http://wave-ide.appspot.com/html.xml - Embed any HTML into a wave.

<iframe> - http://wave-ide.appspot.com/iframe.xml - Embed ane web page (as <iframe&gt ;) into a wave.

Licensing - In Progress - http://wave-license.appspot.com/license_gadget.xml - Creative Commons RDF Embedding - Planning Stage.

Maps -http://hosting.gmodules.com/ig/gadgets/file/101415471413908368316/mappy.xml -Embed Google Map.

Napkin - http://my-wave-gadgets.appspot.com/wave/NapkinGadget.xml - Example of Flash/Flex Wave Gadget, similar to Whiteboard gadget above - source on Google Code.

QuakeBot - In Progress - Server information on the Quake 3 protocol.

Ratings - http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/ratings/ratings.xml- Lets participants rate and review a topic (movie, restaurant, etc) in a wave and shows a tally of the result.

Whiteboard gadget - http://vps.michaelrose.id.au/canvas.xml - Draw on a virtual whiteboard.

Who is Coming? - http://wave-api.appspot.com/public/gadgets/areyouin/gadget.xml -Show a list of all people that have said whether they will come or not.

Games

Backgammon - Wish - (from wikipedia) Remove all of one’s own checkers from the board before one’s opponent can do the same.

Battleship - Wish - Displays different board based on user.

Boxes - In Progress - Connect lines to make boxes and win.

Connect 4/Four-in-a-row - In Progress - sdunster@wavesandbox.com -http://www.sdunster.com/wave/four.xml - 2 users + observers, turn locking, just waiting to write win-detection code.

Floodit - http://gadget.wave.to/floodit/game.xml - 2 player race to fill a board with colors.

Magnetic Poetry -http://hosting.gmodules.com/ig/gadgets/file/107558585548952247431/fridge-11.xml - Re-arrange random words to form poetry.

Othello - Wish - Play Reversi.

Sudoku - http://blah.appspot.com/wave/sudoku/sudoku.xml - Play Sudoku.

Hooks

CVS integration - Wish - CVS history can be converted into a wave with playback.

Posted in Python, 技术相关 | Tagged | 4 Comments

翻页算法(Page Turn/Flip Algorithm)

本文描述模拟电子书翻页特效时需要的算法.

1. 波恩的身份(The Bourne Identity)

现实中, 我们翻书的时候, 会将手移动到书页边缘, 然后翻页. 而我们用鼠标在电子书上指指点点时, 鼠标的位置并不总是甚至总是不在"书页"边缘的, 这时需要根据鼠标位置判断书页边缘上的对应点. 那么怎么判断对应点呢? 看下图:

From PageTurn

这是一本打开的书, 当前鼠标位置在B处, 如果我们从此处拖动书页, 那么程序应当认为用户在等价地拖动C点, 也就是书页中心点A与B点的连线与书页边缘的交点.
同样如果从D点拖动书页, 程序应当认为拖动的是E点.
还有一种方法是: 用左右(或上下, 下同)两页书的中心点F代替A点来计算拖动点(即计算直线FB与边缘交点). 这种方法也是可以的, 不过有点不合常理, 我认为不如用A点计算好.

2. 机密圈套(The Bourne Supremacy)

既然找到了拖动点, 现在该做的是让拖动点与鼠标当前位置重合, 即上图中的C与B点重合, 就好象现实中我们扯着书页边缘的C点移动到B点. 这时书页应该已经折过来了一个角. 那么这个角有多大呢? 看下图:

From PageTurn

假如我们将A点拖动到B点, 那么我们作AB的中垂线, 此中垂线即为翻页时的折线.
然而随后我们会发现如果将A点拖动到了B'点(在现实中这种事会导致书页被撕掉), AB'的中垂线与书的中线有交点, 此时该怎么办呢?

3. 最后通牒(The Bourne Ultimatum)

我向来是不惮以最坏的恶意来揣摩用户的.
见下图:

From PageTurn

图中将用户操作区域分为三大部分:
(1) 绿色区域 - 以C为圆心以|CA|为半径的圆面与以D为圆心以|DA|为半径的圆面的交集
(2) 白色区域 - 除了绿色区域与灰色区域以外的部分
(3) 灰色区域 - 直线DA下方与直线CA上方的交集 与 直线DA'的下方与直线CA'上方的交集 的并集, 其中A'是A关于书中线CD的对称点

绿区的处理:
如果鼠标处于此区域, 或者说用户将A点拖动到了此区域, 那么只需要计算此点与A点的中垂线即可, 这个中垂线就是折线, 而且中垂线绝不会与书中线CD(线段)有交点.

白区的处理:
如果鼠标处于此区域, 以B点为例, 需要为B点寻找代理点B', 即程序认为是把A点拖动到了B'点而不是B点. 而B'的寻找方法是: 判断B点相对于A点的位置, 如果在A下方(即B.Y>A.Y), 则以C点为圆心以|CA|画圆r, 求线段BC与圆r的交点, 此交点即为B'; 如果在A上方(E点就是这样的点), 则以D为圆心求代理点.

灰区的处理:
这个区域中的点的特征是与A/A'的连线与CD有交点, 如F点.
此时代理点取对应点A/A' - 在左灰区则取A', 在右灰区则取A.

Posted in Algorithm | Leave a comment

All About Weather API

之前提到, 写了个wave robot ---- Dr. Weather.
"(机器)人"如其名, 用来做天气预报的.
编码过程中了解了不少一些做天气预报的API, 这里总结一下.

1. Google Weather API:
据说这是个未公开的API, 从搜索情况来看, 完全没有官方文档.
不过群众的眼睛是雪亮的力量是强大的:
这里:

1.邮政编码法:(支持美国地区)
http://www.google.com/ig/api?hl=zh-cn&weather=94043
  (94043 为 山景城, 美国加州 的邮政编码)

2.经纬度坐标作法:
http://www.google.com/ig/api?hl=zh-cn&weather=,,,30670000,104019996
  (30670000,104019996 为 成都, 中国大陆 的经纬度坐标)

3.城市名称法:
http://www.google.com/ig/api?weather=Beijing

附:
 支持的国家代码列表:http://www.google.com/ig/countries?output=xml&hl=zh-cn
(查询 Google 所支持的所有国家的代码,并以 zh-cn 简体中文显示)
支持的城市代码列表:http://www.google.com/ig/cities?output=xml&hl=zh-cn&country=cn

不过Google weather API有个缺点, 就是经常抽抽, 有时候会缺少一些信息, 比如温度啊, 阴晴情况啊之类的; 偶尔还会直接返回"查无此人". 这些有时会造成Dr. Weather很迷茫.

2. Yahoo! Weather API
文档在这里
有人说它很废, 的确有点. 因为只能用邮编(仅限于美国)和Location ID来查询.
设计出来完全不是给人类用的.
不过它的天气预报还是很详细的.
主页可以直接通过城市名称查询, 所以在程序里通过城市名称查询还是可能的, 不过需要hack一下了.

3. 其它
NOAA
Weatherbug
这些不是很了解, 似乎查询方式和Yahoo Weather API类似.

Dr. Weather用到了一个工具: python-weather-api, 挺好用的, 不过对其他语言支持不佳完全不支持, 因为编码问题.
如果以后Dr. Weather要支持多语种的话需要自己稍微修改一下. 参照这里的getLocationWeatherXML().

Posted in 随笔 | 1 Comment

无题

重温大一大二的日记

我感觉到了幸福与悲伤

Posted in 片言只羽 | Leave a comment

写了一个Google Wave Bot

开始玩Wave, 发现wave bot挺好玩的,
就用python+gae写了一个简单的天气预报机器人,
简介见这里

地址: shiny-sky@appspot.com
感兴趣并且有帐号的同学可以试用一下, ;)

现在还挺简陋, 纯文本格式,
不知道怎么往blip里面插入富文本格式的内容,
否则可以弄得华丽一点............

另外, 好像Wave, Google Weather API, GAE三个轮番抽抽, 机器人偶尔不能正常工作也是有的.

Posted in 随笔 | Tagged | Leave a comment