作者: admin

  • 个人常用的免费iPad app软件(个人风格突出且不需越狱)

    我的iPad系统是iOS4.3没有越狱,推荐下面这些免费软件给各位iPad玩家。

    这些软件都是通过美国app store下载来的,不用信用卡注册一个美国app store其实很简单,就是购买一个free的软件就行了。某些情况下也许需要翻墙。

    下面推荐的软件都是免费的,在app store中可以搜索名字找到下载。不需要越狱也不需要破解,基本上已经满足了我日常需求。

    先说说我觉得应该有但是现在还不够好(或者我还不知道的)软件:

    1)浏览器,safari无法浏览桌面版google reader,太惨了,是我最不可容忍的。Firefox或者Chrome有iOS版本么?或者有什么软件浏览google reader比较像是正常浏览器的?

    2)pdf阅读软件,我想要的pdf阅读器其实就需要两个功能,一个是固定缩放比例,一个是固定缩放view或者说是切白边的功能,Apabi可以切白边,但是不能固定缩放。而且我也不喜欢翻页模式,如果能做成电脑上那种pdf连续阅读模式就更好了,为什么非要模拟实体书阅读呢?这些程序设计者其实也进入一个误区。

    当然也可以买ibook或者kindle,那是另外一个事情了。

    3)游戏方面,没有特别好玩的,操作感以及游戏大作各方面比较,都比psp差多了,这让我也感到很欣慰,psp不需要下岗。至于愤怒的小鸟,其实不很好玩。玩游戏还是需要有手柄才有感觉。

    我推荐的这些软件主要分几大类,下面让我一一道来:

    编程技术相关

    推荐软件就是一个Zite。由于没有碰到好的RSS阅读软件,或者有些软件(比如MobileRSS之类)的阅读习惯与google reader差别太大,基本不推荐。

    http://itunes.apple.com/us/app/zite/id419752338?mt=8&ls=1

    Zite这个软件号称是可以学习你的阅读习惯,进入软件以后可以先定制自己喜欢的频道,或者加上自己感兴趣的tag keyword,不过要注意这些tag关键字都是Zite预置的,现在还不存在你自己添加个新关键字的可能。

     

    在文章阅读页面,可以选择”喜欢“”不喜欢“,或者“一直给我推荐这个网站文章”“分享到twitter/FB/Email”等等功能。所谓能自我学习,也就是从读者不断地点击喜欢不喜欢来计算权值,进行文章推荐的吧。

     

    由于没有VPN,所以只能把自己喜欢的文章用email发给自己。

     

    英语、时事相关

    推荐《The Economist》《usa today》《nytimes》《CNN》《NPR》。

     

    免费版的经济学人《The Economist》只能看到“Editor’ s highlights”,但是基本上也足够了,因为不像是技术文章那么容易看懂。另外”经济学人“还可以下载音频收听,选择右上角的耳机图标就可以了。

    在通过听看新闻学英语的这些资源中,比较推荐”CNN“和”NPR“,因为他们几乎所有的音视频都有脚本字幕(transcript),如果遇到看不懂听不懂的,看看脚本就可以了。

    杂项新闻相关

    推荐iWeekly周末画报,Zaker,Flipboard。

    其中周末画报相对制作比较精美,而Zaker由于来源比较混杂,排版不是很好看,有了Zite以后,基本上就不用Zaker了。

    游戏相关

    推荐TradeNations。

    除了切水果,跳跃忍者,愤怒的小鸟这一类大家总所周知的游戏,TradeNations算是一个社交加农场养成类的游戏,你可以加好友,然后到好友的农场里进行交易,买花买家具买衣服等等,这个游戏是tinyfool在twitter上推荐,还真是挺好玩,每天稍微打理一下就可以了,如果你也玩了这个游戏,欢迎加我的账号sagasw。

     

    读书相关

    推荐CloudReader,Stanza,Apabi Reader(方正阅读器),ibook,kindle。

    没有特别出色的,相比来说Apabi特点突出一些,但也不是很好用。基本上ibook,kindle,Apabi阅读pdf都属于残废。但是我已经想到一个用ipad阅读pdf的方法,正在研究中。

     

    免费、限期免费相关

    推荐”app每日推送“以及”软件游戏猎手“这两款。

  • Why we need unittest?

    这是我给team member写的一封邮件,感觉很有通用性,值得推广给各位。
    我们的项目主要是以COM interface形式被其它软件使用,所以我写了一个ProjectAutoTest项目来实现功能测试。
    ProjectAutoTest通过config.txt这样的文本形式配合一些必要文件来定义测试用例,实现了不增加修改代码就可引入新测试用例的目的。

    因为针对的不是内部代码而是COM接口,严格的说算不上单元测试。
    但是,ProjectAutoTest可以帮助我提高软件质量,检测潜在的问题,就足够了。

    “Why we need unittest? it wastes time”

    Why we need unittest, because we need good code quality.

    1) The issue comes from ProjectA, and changes in our project.
    And AAA told me why it happens and debug with project,
    but we can’t repeat this step in every code change.

    2) Which files are affected, how to duplicate the issue more simple more easy?
    The unittest of ProjectAutotest is most easy way to get it.

    3) When we fix the issue for ProjectA, for ProjectB,
    it maybe affects our projects or others in same time. How could we know the change good or bad?
    Whether this change affect other defects?

    It is just my suggestion, but if you want to keep the code quality of our project,
    Following steps will be good way to do, and
    I have mentored BBB, CCC to follow the rule, it is not difficult.

    ====================================
    Step1) duplicate the issue with Defect description.

    Step2) convert the issue to ProjectAutoTest testcase. There must be one or two files.
    There must be one or more interface function are called.
    There have incorrect result or no output.

    Step3) run your new adding testcase, it should be able to duplicate the issue too.
    If some incorrect result is output, the incorrect result should same as Defect issue too.

    Step4) Fix the bug. Find the root cause.

    Step5) Change the code, and try with the testcase in ProjectAutoTest.
    It should get correct result.

    Step6) Test with all testcases in ProjectAutoTest, results should be correct too.

    Step7) Test with Defect duplication steps. It should be correct too.

    Step8) Check in the code, and change Defect state.

    !!! Note: the testcase in ProjectAutoTest should be checked in too.
    The testcase must be maintained same as source code, and consider the testcase as same importance too.

    For the code review, it should have changed code, and new testcase in same time.

  • 一些有用的开源project

    主要是Google AppEngine上的(GAE):twitter相关;multi-chat相关;飞信或者短信相关。
    还有新浪SinaAppEngine及新浪微博相关。

    http://code.google.com/p/youngking/downloads/detail?name=mail2sms_beta_20100919.zip&can=2&q=

    http://code.google.com/p/pranav

    https://code.google.com/p/channel-tac-toe/

    *** mirrorrr-plus

    twitter-oauth-login-proxy

    jaikuengine

    jsonbot

    twitteroauth-python

    http://code.google.com/p/gtap

    *** google-app-engine-samples/multi-chat

    http://github.com/superfeedr/notifixlight

    *** google-app-engine-samples/crowdguru

    twitalker

    *** https://github.com/gh05tw01f/twitalkerplus

    *** gae-rproxy

    https://github.com/metachris/feedmailer

    https://github.com/crabasa/Twitter2Mail

    http://code.google.com/p/appengine-mapreduce/

    http://code.google.com/p/gae-bbs/

    https://bitbucket.org/keakon/yui/

    https://bitbucket.org/keakon/doodle

    http://code.google.com/p/xian-min/

    http://code.google.com/p/google-app-engine-samples/

    http://code.google.com/p/rietveld/

    http://www.allbuttonspressed.com/projects/django-nonrel

    http://code.google.com/p/google-app-engine-oil/

    http://code.google.com/p/tipfy/

    http://code.google.com/p/kay-framework/

    https://github.com/xuming/micolog

    https://github.com/steffentchr/twitterengine

    https://github.com/initpy/selficious

    https://github.com/flosch/simpleapi

    https://github.com/garethr/appengine-bugs

    https://github.com/toomore/goristock

    https://github.com/livid/picky

    https://github.com/pelle/talk.org

    https://github.com/garethr/appengine-imified

    http://code.google.com/p/typhoonae/

    https://github.com/k7d/approcket

    http://ihere.appspot.com/

    https://github.com/mcroydon/html2text-appengine

    ======================
    http://apidoc.sinaapp.com/sae/SaeTOAuth.html

  • 高级软件工程师面试问题 Interview SeniorSoftwareEngineers

    hanselman这篇文章很有意思,尽管不是每个问题都很值得作为面试问题出现,但是很多都值得去仔细想想。

    一个优秀的面试问题,尤其是针对Senior Engineer的面试问题,不应该仅仅是问某个api的用法,某个很容易从帮助中找到的内容。有发散性,可以基于问题进行扩展的问题才是一个比较好的问题。

    下面是一个非常长的问题列表,主要是关于面向对象设计,设计模式,以及一些实际工程中会用到概念,都是比较基本的,但是也非常能考察一个高级工程师的水平,因为会牵涉到非常多方面。

    另外要说明的是下面很多概念性问题可以直接从wiki维基百科上找到答案。另外我会标记出个人觉得比较值得问的问题。

    原文在这里 http://www.hanselman.com/blog/NewInterviewQuestionsForSeniorSoftwareEngineers.aspx

    # What is something substantive that you’ve done to improve as a developer in your career?

    有没有做过什么比较实质性的事情来提升你的程序员职业水平?

    好问题。我的回答:这个很难说,我的做法是坚持学习,坚持写技术类博客。另外有些经验在这里提到过http://sunxiunan.com/?p=1799

    # Would you call yourself a craftsman (craftsperson) and what does that word mean to you?

    不敢叫自己大师啊,那得多牛逼?!

    # Implement a <basic data structure> using <some language> on <paper|whiteboard|notepad>.

    用某种语言在纸面上实现一个基本的数据结构。(用近似真实格式的伪代码来表达?)

    好问题。我的回答,找一本基础的数据结构书籍吧,比如这一本《数据结构与算法分析:C语言描述(原书第2版)》

    # What is SOLID?

    参考http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29

    这个solid不是说“结实的”,而是面向对象五大原则的简称:单一责任原则,开闭原则,莱西科夫替换原则,接口分离原则,依赖倒置原则。

    好问题。这几个原则的确应该背下来,太基础了。

    # Why is the Single Responsibility Principle important?

    为什么单一责任原则重要?

    好问题。我的回答,因为职责明确,设计就不容易混乱,即使有后续变化也是可控的。

    # What is Inversion of Control? How does that relate to dependency injection?

    参考http://en.wikipedia.org/wiki/Inversion_of_control

    实际中的例子,通知开会,一种可以打电话通知到每个人(这属于中心控制型的,必须有个controller/manager之类的);也可张贴一个告示,大家自己来看,这属于事件响应型的。

    # How does a 3 tier application differ from a 2 tier one?

    三层应用与两层应用的区别是什么?

    我只知道MVC三层应用。

    # Why are interfaces important?

    为什么接口重要?

    好问题。接口的重要在于消费者(客户端)不需要了解生产者(服务端)的细节,接口相当于合同,当合同不变的时候,谁生产如何生产都不是消费者关心的问题。

    # What is the Repository pattern? The Factory Pattern? Why are patterns important?

    关于设计模式的问题,

    第一个参考http://msdn.microsoft.com/en-us/library/ff649690.aspx

    工厂模式基本上是众人皆知的模式了。

    为何模式重要?我不觉得模式重要,模式的重要性在于让你能“喔!原来是这个”。但是对于一个没有几年编程经验的开发者而言,模式只能让你更混乱。

    设计模式很多情况下是通过加入一个抽象层来解决耦合之类的问题,但是层次越多越复杂,就好比单位中领导的级别越多越官僚一样。

    # What are some examples of anti-patterns?

    反模式?少用模式,多写点清晰的代码吧。

    # Who are the Gang of Four? Why should you care?

    四人组,名字叫不上来,但是他们是设计模式的总结者。

    # How do the MVP, MVC, and MVVM patterns relate? When are they appropriate?

    这也是微软特色,大家只要知道MVC就行了,其实大家现在用的都是MVC,但是由于水平高低,效果就是千差万别。

    啥MVP,MVVM我不知啊(也不是不知,只知道MVVM是wpf的一个概念,可我也不用wpf啊)

    # Explain the concept of Separation of Concerns and it’s pros and cons.

    参考http://en.wikipedia.org/wiki/Separation_of_concerns

    我也不是了解的很细。

    # Name three primary attributes of object-oriented design. Describe what they mean and why they’re important.

    封装/继承/多态?

    参考这里吧http://en.wikipedia.org/wiki/Object-oriented_programming

    学C++这几个概念是基础啊

    # Describe a pattern that is NOT the Factory Pattern? How is it used and when?

    不是工厂模式,我知道个单件模式。还有模板模式/facade模式/strategy模式,具体也要翻翻书,很少有意识的套用。

    # You have just been put in charge of a legacy code project with maintainability problems. What kind of things would you look to improve to get the project on a stable footing?

    第一步,先把代码用最大警告级别编译一遍,然后fix所有值得fix的warning。

    好问题。

    # Show me a portfolio of all the applications you worked on, and tell me how you contributed to design them.

    如果光是看文档,很难说到实质上。

    好问题。

    # What are some alternate ways to store data other than a relational database? Why would you do that, and what are the trade-offs?

    好问题,很多啦,内存/文件/云存储/nosql等等。tradeoff就看你的应用需求了。blabla。。。

    # Explain the concept of convention over configuration, and talk about an example of convention over configuration you have seen in the wild.

    好问题。

    我能想到的就是买车开车,很少有人买到车以后,拿着说明书调试这个那个,一般都是直接上路,因为汽车厂会给你一个比较不错的默认配置,也就是所谓的“方便”。

    这个方便也保证了你开其它车,基本上都差不多,不用重新配置或者学习什么。

    所谓方便”convention“就是把相对不错/比较普遍适用的配置都内置好了,用就是了。

    # Explain the differences between stateless and stateful systems, and impacts of state on parallelism.

    解释有状态与无状态系统,以及有状态系统在并行上的影响。

    好问题。这个说不好。有状态系统因为保持状态,并发运行时的访问/修改需要有锁同步机制。

    # Discuss the differences between Mocks and Stubs/Fakes and where you might use them (answers aren’t that important here, just the discussion that would ensue).

    跟TDD相关的问题。不会哦。

    # Discuss the concept of YAGNI and explain something you did recently that adhered to this practice.

    解释“YAGNI”。

    最简单的例子是当我们定义接口,会特意预留出一两个参数,说是为了将来使用,其实,没有将来。屁嘞!你根本不需要它!

    不是说不考虑可扩展性,但是要基于可预测的基础上。

    # Explain what is meant by a sandbox, why you would use one, and identify examples of sandboxes in the wild.

    比如把虚拟机比如vmware virtualbox作为沙箱,用起来可以隔离风险。大不了重启,或者删除之。

    # Concurrency

    * What’s the difference between Locking and Lockless (Optimistic and Pessimistic) concurrency models?

    * What kinds of problems can you hit with locking model? And a lockless model?

    * What trade offs do you have for resource contention?

    * How might a task-based model differ from a threaded model?

    * What’s the difference between asynchrony and concurrency?

    这些问题不错。并发相关的问题,设计多用户高性能系统必知。

    # Are you still writing code? Do you love it?

    我喜欢编程。

    # You’ve just been assigned to a project in a new technology how would you get started?

    如果是我,先了解这个技术的风险。小心求证,尽量缩小使用范围,否则是很致命的。

    # How does the addition of Service Orientation change systems? When is it appropriate to use?

    不懂。

    # What do you do to stay abreast of the latest technologies and tools?

    我跟的很紧哦!

    # What is the difference between "set" logic, and "procedural" logic. When would you use each one and why?

    不懂要问什么。

    # What Source Control systems have you worked with?

    ClearCase.很难用。最近不少问题都是跟CC相关的。

    # What is Continuous Integration? Have you used it and why is it important?

    持续集成。这个概念跟TDD也挂钩。

    # Describe a software development life cycle that you’ve managed.

    涉及的还是传统模型,不是scrum型的。

    # How do you react to people criticizing your code/documents?

    批评没问题,但是要有道理有根据。

    # Whose blogs or podcasts do you follow? Do you blog or podcast?

    这就很多了,看我以前写的文章吧。

    # Tell me about some of your hobby projects that you’ve written in your off time.

    主要是Lua和Py的,appengine上的比较多。

    # What is the last programming book you read?

    最近看得是《C++ FAQs》中文版。翻译的一般,内容也比较陈旧。更坚定了我使用C风格的C++的决心。

    # Describe, in as much detail as you think is relevant, as deeply as you can, what happens when I type "cnn.com" into a browser and press "Go".

    尽可能详细深入的描述,当你在浏览器敲网址然后go后面的技术细节。

    好问题。很发散,绝对能看出面试者的技术厚度。

    # Describe the structure and contents of a design document, or a set of design documents, for a multi-tiered web application.

    # What’s so great about <cool web technology of the day>?

    # How can you stop your DBA from making off with a list of your users’ passwords?

    # What do you do when you get stuck with a problem you can’t solve?

    参考这里计算机编程新人入行指导 

    http://sunxiunan.com/?p=961

    # If your database was under a lot of strain, what are the first few things you might consider to speed it up?

    先profiling哦!

    # What is SQL injection?

    # What’s the difference between unit test and integration test?

    单元测试应该是程序员做。集成测试就牵扯到tester了。

    # Tell me about 3 times you failed.

    # What is Refactoring ? Have you used it and it is important? Name three common refactorings.

    我一直在重构自己的代码。重构原则参考这里

    C++项目代码规范(偶自用)http://sunxiunan.com/?p=1787

    # You have two computers, and you want to get data from one to the other. How could you do it?

    命名管道,socket,共享文件夹,路子还是很多的。

    # Left to your own devices, what would you create?

    # Given Time, Cost, Client satisfaction and Best Practices, how will you prioritize them for a project you are working on? Explain why.

    这个很值得问。

    # What’s the difference between a web server, web farm and web garden? How would your web application need to change for each?

    # What value do daily builds, automated testing, and peer reviews add to a project? What disadvantages are there?

    都是为了提升代码质量,但是会延长工期。

    # What elements of OO design are most prone to abuse? How would you mitigate that?

    # When do you know your code is ready for production?

    看bug fix的统计曲线。

  • 理解Node.js事件驱动编程

    Node.js现在非常活跃,相关生态社区已经超过Lua(基本上比较知名的功能都有nodejs模块实现)。

    但是我们为何要使用Node.Js?相比传统的webserver服务模式,nodejs有什么优点优势?

    Node.Js是基于javascript语言,建构在google V8 engine以及Linux上的一个非阻塞事件驱动IO框架。nodejs是单进程单线程,但是基于V8的强大驱动力,以及事件驱动模型,nodejs的性能非常高,而且想达到多核或者多进程也不是很难(现在已经有大量的第三方module来实现这个功能)。

    这里主要不是介绍nodejs具体应用代码,而是想介绍一下事件驱动编程。

    在这篇文章(1)里面,Dan York介绍了两种典型的事件驱动实例。

    第一个例子是关于医生看病。

    在美国去看医生,需要填写大量表格,比如保险、个人信息之类,传统的基于线程的系统(thread-based system),接待员叫到你,你需要在前台填写完成这些表格,你站着填单,而接待员坐着看你填单。你让接待员没办法接待下一个客户,除非完成你的业务

    想让这个系统能运行的快一些,只有多加几个接待员,人力成本需要增加不少。

    基于事件的系统(event-based system)中,当你到窗口发现需要填写一些额外的表格而不仅仅是挂个号,接待员把表格和笔给你,告诉你可以找个座位填写,填完了以后再回去找他。你回去坐着填表,而接待员开始接待下一个客户。你没有阻塞接待员的服务

    你填完表格,返回队伍中,等接待员接待完现在的客户,你把表格递给他。如果有什么问题或者需要填写额外的表格,他给你一份新的,然后重复这个过程。

    这个系统已经非常高效了,几乎大部分医生都是这么做的。如果等待的人太多,可以加入额外的接待员进行服务,但是肯定要比基于线程模式的少得多。

    第二个例子是快餐店点餐。

    在基于线程的方式中(thread-based way)你到了柜台前,把你的点餐单给收银员或者给收银员直接点餐,然后等在那直到你要的食物准备好给你。收银员不能接待下一个人,除非你拿到食物离开。想接待更多的客户,容易!加更多的收银员!

    当然,我们知道快餐店其实不是这样工作的。他们其实就是基于事件驱动方式,这样收银员更高效。只要你把点餐单给收银员,某个人已经开始准备你的食物,而同时收银员在进行收款,当你付完钱,你就站在一边而收银员已经开始接待下一个客户。在一些餐馆,甚至会给你一个号码,如果你的食物准备好了,就呼叫你的号码让你去柜台取。关键的一点是,你没有阻塞下一个客户的订餐请求。你订餐的食物做好的事件会导致某个人做某个动作(某个服务员喊你的订单号码,你听到你的号码被喊到去取食物),在编程领域,我们称这个为回调(callback function)。

     

    Node.Js做了什么工作呢?

    传统的web server多为基于线程模型。你启动Apache或者什么server,它开始等待接受连接。当收到一个连接,server保持连接连通直到页面或者什么事务请求完成。如果他需要花几微妙时间去读取磁盘或者访问数据库,web server就阻塞了IO操作(这也被称之为阻塞式IO).想提高这样的web server的性能就只有启动更多的server实例。

    相反的,Node.Js使用事件驱动模型,当web server接收到请求,就把它关闭然后进行处理,然后去服务下一个web请求。当这个请求完成,它被放回处理队列,当到达队列开头,这个结果被返回给用户。这个模型非常高效可扩展性非常强,因为webserver一直接受请求而不等待任何读写操作。(这也被称之为非阻塞式IO或者事件驱动IO)

    考虑下面这个过程:

    1,你用浏览器访问nodejs服务器上的"/about.html"

    2,nodejs服务器接收到你的请求,调用一个函数从磁盘上读取这个文件。

    3,这段时间,nodejs webserver在服务后续的web请求。

    4,当文件读取完毕,有一个回调函数被插入到nodejs的服务队列中。

    5,nodejs webserver运行这个函数,实际上就是渲染(render)了about.html页面返回给你的浏览器。

    好像就节省了几微秒时间,但是这很重要!特别是对于需要相应大量用户的web server。

    这也就是为什么Node.Js这么热这么惹人关注。而且它还使用了一个非常通用的编程语言Javascript,也让开发者可以快速容易的编写高可扩展性服务器。

    (1) http://code.danyork.com/2011/01/25/node-js-doctors-offices-and-fast-food-restaurants-understanding-event-driven-programming/