how to create app store account without credit card

August 14th, 2009

没有美国的信用卡就不能注册美国的 iTunes Store,但 Apple 官方也给出了一个不用信用卡的注册方法,这样就能玩上很多美国站独有的 free app 了,比如 Amazon Kindle。

http://support.apple.com/kb/HT2534

需要注册的是,地址还是要填一个美国的,可以借助 http://www.yellowpages.com/ 随便找一个地址添上(我找了一个美国电影院)

搞定!可以 get free app 了。如果有能用国内信用卡注册美国帐户的方法,请赐教 ;-)

how to build activity-streaming

August 7th, 2009

好友动态在各大社交网站中基本上已经是标配了,而且一般都会显示在用户登录之后的默认首页上,这种做法的确方便用户了解网站和自己朋友的一些动态。设计上应该如何实现呢?Google 了一些资料,整理在下面,欢迎有实际经验的朋友指点!

用户看到的可能是三种情况:

  • 我的动态
  • 好友的动态
  • 全站的动态

朋友动态这种信息,根据网站的实际情况需要考虑几个问题:

1、是否只让用户看到最新n条?(海内的最新动态数量是固定的,采用先进先出原则,用户只能看到最新的n条;而UCH则可以每页150条允许用户翻页

2、用户增减好友后,朋友动态是否能够立刻体现出变化?(在海内,我如果在好友名单中删除一个人,好友动态还会有他的信息,只是不新增他的信息而已;而UCH里面,他的信息立刻消失。加一个人为朋友,也是一样的效果。

3、用户能否删除自己产生的动态?

4、阅读者是否可以删除其朋友动态中某一条动态?(在校内用户可以删除某一条朋友动态,在UCH用户可以屏蔽某人或者所有人的某类动态,在海内你只能看不能屏蔽

5、动态是否有阅读权限?

6、动态所指向的信息被修改、删除,动态是否要同步变化?(如果你修改了日志的标题,校内网的动态是不变的,而海内是变化的

最简单的实现方式是将所有事件记录到一张表里:
Event
- id
- user_id
- type
- data
- created_at
这样做比较适合用于显示全站更新,针对用户推送时,缺点明显:用户加好友后会显示出成为好友前的所有动态,删好友后之前的所有动态也看不到了。另外用户不能对活动进行删除,因为每个活动消息只有一份拷贝。
data 中可以用 json 来记录用户的动作,比如:
{photoId:2089, photoName:A trip to the beach}
PS: QQ新版的消息中心,对于同一好友下不同类型的操作都能合并。这时候如果动态表包括有type的字段,就不太好对付了,可以改成:

data中保存用户的操作日志,也就是本贴讨论的重点。我采用的方法是前面有同学提到json方式。如:

{
“blog”:[  {"id":1,"title":"安利台湾25周年庆"} ],
“photo”:[  {"id":1,"title":"51韶关游"} ]
}

其中blog、photo代表某种应用的标识,可以无限添加。只要显示的时候能分析就行。里面的id和title就是内容的属性,结构自定。至于新旧操作怎么合并,我是采取对event表的插入操作进行拦截实现的——我定义会员所有的操作均调用event的插入方法。在拦截函数中,先select该会员的记录。如返回为空,则直接插入新记录。如返回记录,则将待插入数据与原数据进行合并。如待插入数据为:

{
“blog”:[  {"id":2,"title":"我是谁"} ],

“share”:[  {"url":"http://www.tudou.com","title":"土豆网 - 视频 - 播客 - 每个人都是生活的导演"} ]
}

则合并后的content为:

{
“blog”:[  {"id":2,"title":"我是谁"}  {"id":1,"title":"安利台湾25周年庆"}, ],

“photo”:[  {"id":1,"title":"51韶关游"} ],

“share”:[  {"url":"http://www.tudou.com","title":"土豆网 - 视频 - 播客 - 每个人都是生活的导演"} ]
}

然后使用update方法即可。

为解决上面的问题,可以添加一个 EventUser 表,当用户发生动作后,用户的动作写在 Event 表中,给该用户的所有好友发一个消息,记录在 EventUser 表中
EventUser
- id
- event_id
- friend_user_id
- created_at
需要注意的是一定时间内完成的某些动作,对 Event 表应该更新,而不是插入。比如同时加N个好友可以合并到一个 event 中。另外当用户的动作被撤销后,也要考虑对应的 event 如何撤销。比如用户传了一张照片,然后又删掉了,这时如果传照片可以 event 没删掉,用户在动态列表中还会看到,XXX上传了一张照片,但点进去,照片已经不存在了。
优化:
Event 表可以做 mem cache
EventUser 表可以水平切分,分到多张表中,可以定期清除
写 EventUser 表的操作可以抛个消息,异步操作。或者先写到 mem cache 里,到一定条件时再持久化。
references:
http://i.laoer.com/sns-news-feed-design.html
http://www.javaeye.com/topic/176677
ruby on rails plugin:

minutes about how to start a startup

August 4th, 2009

origin reading: http://www.paulgraham.com/start.html

writing following lines is just for my own minutes

3 big things:

- to start with good people
- make something customers actually want
- spend as little money as possible

useful points:
- the overall plan is straightforward
- don’t think about how to do database matches instead of how stuff works in the real world
- an idea for a startup is only beginning, and from that point all you have to do is execute
- what matters is not ideas, but the people who have them. good people can fix bad ideas, but good ideas can’t save bad people
- in a technology startup, which most startups are, the founders should include technical people
- in nearly every failed startup, the real problem was that customers didn’t want the product

the things every startup need to do:
get a version 1 out as soon as you can, but must include the thing customers want.
the only way to make something customers want is to get a prototype in front of them and refine it based on their reactions.
talk to as many VCs as you can, even if you don’t want their money, because a) they may be on the board of someone who will buy you, and b) if you seem impressive, they’ll be discouraged from investing in your competitors. but you may wonder how much to tell VCs. some of them may one day be funding your competitors. i think the best plan is not to be overtly secretive, but not to tell them everything either.

once you get big (in users or employees) it gets hard change your product.

that’s the key to success as a startup. there is nothing more important than understanding your business. google’s secret weapon waas simply that they understood search.

negative lessons is straightfoward to avoid errors:
- don’t have a lot of meetings
- don’t have chunk of code that multiple people own
- don’t have a sales guy running company
- don’t make a high-end product
- don’t let your code too big
- don’t leave finding bugs to QA people
- don’t go too long between releases
- don’t isolate developers from users

web 3.0 come

August 3rd, 2009

微博客越来越火,围绕 twitter 已经成为了一个美丽的生态系统,感觉到 web 3.0 时代要来了。

看了一些相关资料,做了些对比:

Web 1.0 - as an information portal

- be the first to own the content
- divide www info useable directories
- everyone has their personal corner in the cyberspace
- lacks: context, interaction, scalability

Web 2.0 - as a platform

- focus on the power of community to create & validate (UGC, collaboration)
- tagging organization
- setting up “hooks” for future integration (RSS, API)
- lacks: personalization, true portability, interoperability

Web 3.0 - is semantic web

- HTML describes documents, while RDF describles things
- specs: RDF (FOAF, DOAP), GRDDL, W3C, microformats
- instances: Google, Twine, Swicki, Powerset, Wink, Twitter, FOAF, OpenSocial, Beacon, Joost, Netflix, Slingbox, iPhone, Andriod etc

个人总结是:
web1.0 是资源互联(text, video, music, pictures etc)
web2.0 是人互联(social graph, life streaming)
web3.0 是数据互联 (系统可以更智能的理解数据之间的关联和用户表达的含义,从而更准确的给出用户想要的东西)

2 keypoints of semantic web

July 29th, 2009
  1. add semantics to today’s web, rather than create a future web
  2. human first, machine second

i18n your website with google translate

July 22nd, 2009

在 Google Translate 上面有个很实用的 browser bookmark,实际上是一段 js 脚本,用它可以将当前网页用 Google Translate 翻译成各种语言。

这段 js 一样可以用在你的网站中,这样就能给网站添加一个简化的多语言版本了,最大的问题也就是你网站的界面设计可能不适应翻译过来的语言。

如果想让翻译的页面在新窗口中打开,可以参考这篇博客

方式就是将 location.href = 改成 window_name = window.open(…)