![logo](/img/logo.jpg)
David's Blog
-
encoding message Sep 12
关于practicingruby
practicingruby是Gregory Brown定期撰写的关于ruby编程的文章。很有深度,欢迎大家订阅。
The anatomy of information in software systems
9月份的文章是关于如何把消息编码。内容如下的IRC消息,应该如何解释
PRIVMSG #practicing ruby testing :Seasons greetings to you all!\r\n
在ruby里可以表示为
Read More...["PRIVMSG...
-
meet elixir Sep 9
Meet Elixir ScreenCast
Elixir马上就要发布1.0版,估计以后的语法不会有大的改动了。
看Elixir的书和screencast的其中一个问题是等到你看的时候,Elixir的语法已经和制作书和screencast时的语法不一样了。
最近看了Meet Elixir,并把screencast里的例子更新到使用最新的Elixir版本(0.15.1)。放在 https://github.com/ruanwz/mystreamers
Read More... -
review confident ruby(handling failure) Sep 6
介绍 Handling Failure
自信地处理错误情况。这本书只讨论BRE(begin/rescue/end) block,因为BRE在代码里是如此醒目, 会把注意力引离method要做的事,所以需要想办法不要让它出现在程序的主要逻辑里。
Handling Failure的模式
- Prefer top-level rescue clause
- Use checked methods for risky operations
- Use bouncer methods
Prefer top...
Read More... -
review confident ruby(delivering results) Sep 5
介绍 Delivering Results
为method的caller提供output
Delivering Results的模式
- Write total functions
- Call back instead of returning
- Represent failure with benign value
- Represent failure with a special case object
- Return a status object
- Yield a status object
-
review confident ruby(collecting input) Sep 4
介绍 Collecting Input
method需要input,当决定好method的算法所需要的input,我们需要决定如何获取input。 有3种策略用于确保方法有可靠的collaborators来执行他们的role
- Coerce objects into the roles we need them to play.
- Reject unexpected values which cannot play the needed roles.
- Substitute known-good...
-
review confident ruby Sep 3
再读confident ruby(performing work部分)
再读confident ruby,记下以下要点。
每个函数应包含4部分
- collecting input
- performing work
- delivering result
- handling failures
performing work的模式
这个部分只有一个pattern
sending a strong message
要发消息给trused object,需要3个条件
- 识别要完成工作所需...
-
Developing Rails App Using Docker by fig Aug 23
基于虚拟机或容器创建开发环境的优点
- 可以方便地切换不同的项目
- 在团队内共享项目的开发环境,避免所有人都浪费时间来设置环境
- 避免不同项目的设置冲突
- 可以使开发环境更加接近部署的环境
Docker vs VirtualBox
以前试过使用VirtualBox虚拟机来做开发环境,因为团队里同时使用Linux和Windows。 但发现有2个问题,一是速度太慢,二是在windows下,编辑器保存文件后并不能触发 VirtualBox里的自动化编译或刷新。
因此尝试使用Docker,因为现...
Read More... -
Decision Tree Jul 24
数据分析服务: BigML
今天我看到一个数据分析的服务,可以上传CSV的数据,分析后可以预测新的结果。
它有几个步骤
- 上传CSV数据,并设定每行的数据类型,如数字,字符。数据最后一列必须是结果列
- 建立数据集,这个过程需要几秒或几小时。需要选定需要分析的属性,最终会给出一个属性列表,显示属性的一些统计数据:缺失数据,错误和直方图
- 建立模型,通过数据集生成模型
- 为新输入预测结果
- 建立ensembles,可以用所有的输入行和列来生产多个model,合成一个ensemble,用户可以这样...
-
Try facebook testing lib Jest May 19
The new testing framework from facebook
Facebook released their new testing framework: Jest
It seems to be very nice that can help you to mock the dependencies automatically:
In order to write an effective unit test, you want to be able to isolate...
-
Reading notes of a rubymotion book Mar 27
Use NSLog instead of puts
Because puts wouldn’t output to device logs
RubyMotion provide help for 3 things
- flexible workflow(editor, command line, repl)
- use ruby language
- skip the large set of new API have to learn
Value Object
There are 4 value...
Read More...
Page 1 of 4