跳至主要内容

博文

目前显示的是 2015的博文

工具党:Routers

Router 是一种常见的木工工具,主要有两种—— plunge router 和 fixed router。 根据 [laopi 的博客](http://blog.wenxuecity.com/myblog/34276/200912/26860.html) 介绍, > 顾名思义,fix router就是router的bit在切割的过程中不能上下移动,plunger router可以, > fix router有一个可以微调的机构,固定在router table上以后,可以慢慢调节bit的高度, > plunge的虽然也可以用于router table,不过因为完全是靠手的压力来调节,实际用起来很困难, > 现在的很多都会带两种base,这样一个router可以当2个使用,不过我建议还是各买一个, > 一个功率大的固定在router table上,另一个用于其他的用途,这样减少了很多使用上的麻烦, > 因为plunge的可以在某种程度上替代fix的,而fix却不能代替plunge的,所以, > 如果你的预算只能买一个,那就只能买plunge的。 Router 的功率越大价格就越高。在使用直径大的 bit (钻头)的时候,功率越大效果就越好。 不过功率越大也就意味着手动控制难度越高,最好是安置在 Router Table 上使用。 Router 可以搭配很多 bits 来使用,不同的 bit 作用不一,而且尺寸也可能大不同——通常 使用 bit 的直径来衡量,术语是 shank。在使用直径较小的 bit 的时候,可以设定在较高的转速, 反之若是使用直径较大的 bit 那么应当配合较低的转速。大部分的 router 的转速都是可以调节的。 关于 router bits,laopi 建议开始买一套基本款,价格便宜量又足。此后如果发现缺少哪一种可以慢慢添置。以下还是摘录自 laopi 的文章: 市场上router bit的种类非常多,价格差别也大,买上几百个可能还会发现没有买全,router bit的区别除了牌子以外,还有 1. 材质 现在的可能至少都是号称carbide tipped,很少有high steel的了,有些还是全部carbide的,价格很贵,不过carbide本身很脆,掉到地上很可能就一分...

工具党:圆锯探究

Bunnings 上的锯子一堆一堆的,各式各样都有。作为有志于学习手工技术的工具党,自然免不了钻研一番。 ![Circular Saw](http://www.skiltools.com/Parts-And-Service/PublishingImages/CircularSaw1.jpg) 今天花了点儿时间看 Circular Saw (圆锯)相关的资料,总结整理如下—— > As a rule of thumb, the depth of cut is equal to one third of the blade diameter, > plus a bit! For example, depending on the brand, a 185mm circular saw will cut > to a depth of about 64mm to 66mm, a 235mm circular saw will cut to a depth of > around 83mm to 85mm and a 160mm model will be in the vicinity of 54 mm. 简单来说,先看圆锯的锯片,通常直径为 185mm 的锯片可以切割的木料深度可达约 60mm,这意味着可以用来 切割 bench top (厨房料理台面板,通常都很厚实)这样的厚度,对于家用来说应该是足够了。 另外值得一提的是,随着圆锯一起购入的锯片通常都不会很优秀,如果在切割的时候觉得不顺手或是很费力,不妨 另外购入价格高一些的锯片,毕竟是一份价钱一分货…… 有人推荐了 [Diablo 的锯片](http://www.bunnings.com.au/diablo-184mm-40t-circular-saw-blade-_p6370355)。 从品牌来看,Bosch 和 Markita 都算是不错的。此外,如果锯片直径一样,那么功率越大理论上切割起来应该越高效。 ![Makita 1800W 185mm](https://2ecffd01e1ab3e9383f0-07db7b9624bbdf022e3b5395236d5cf8.ssl.cf4.rackcdn.com/Product-190x190/0cd65f9b-750...

VIM Bundle - a plugins manager

[Vundle](https://github.com/VundleVim/Vundle.vim) 是一个为 VIM 设计的插件管理器, 这个名字其实就是 VIM Bundle 的缩写。 第一步是下载 Vundle.vim 文件,可以直接从 GitHub 上克隆: $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 首先要加载 Vundle,要为 VIM 的 runtime path 添加指向 Vundle.vim 的路径, filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins " call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'gmarik/Vundle.vim' 接着指定需要哪些插件 (plugins) " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.or...

捉虫记 (一)

最近在维护几个上线的产品时遇到的几个 bug 都蛮有意思的,记录下来供参考。 第一个问题是在使用 JPA Repository 的时候产生的。业务逻辑很简单,接受一个 `List ` 作为 `eventIds`,针对每个事件找到相应的 subscriber 然后发送一封邮件。 原本的实现是用 Java 8 的 lambda 来完成的, `eventIds.stream().forEach(...)` 在其中调用 Spring Data `JpaRepository.findOne()` 方法。后来被重构过变成了先调用 `JpaRepository.findAll()` 来取得 Entity,再用 Java 8 Stream 的方法来处理。 这个修改乍一看挺好的——假定需要处理 50 个 events,原本的实现会至少查询 50 次数据库,而后者只要一个调用就搞定。但是后来在测试中发现如果传入的数据集合超过 1000 个元素,就无法完成请求。后台的 error log 中显示的是 Oracle 的一场 —— `IN` expression 无法处理超过 1000 个表达式! Oracle Database 经常会给出莫名的 error message,以后有机会慢慢说。不过这个案例中倒是没啥可以批评 Oracle 的,因为的确是 JPA 执行数据库查询的时候引发的问题。 第二个问题是由 `Lob` 引起的。在定义 Entity 的时候,如果原本的 column 是 BLOB 或是 CLOB 类型的数据字段,对应的 Java Class 内需要用 `@Lob` annotation 加以标记。否则会导致不稳定的查询错误,而且这个错误信息很让人困惑…… 为了重现问题尝试了 N 次,有台服务器基本无法重现,而另一台服务器倒是有 1/3 的概率可以重现。 第三个问题是由 JSON 引起的,在上线的产品中大量使用 JSON 从 Server 端返回数据,而 Client (Web) 使用了 AngularJS 这样的框架来执行数据的解析和绑定。在一个新发布的 release 中客户抱怨说之前保存过的数据现在显示不出来了(这是简化版,客户只是抱怨说某些页面上数据缺失,QA无法重现问题,只能靠俺们分析之后得到的结论)。 在处理 form 的时候,Client 以 J...

初探 ReactJS

在Youtube上看了一个名为 [Getting Started with React.js](https://www.youtube.com/watch?v=8HkVHbJZeWY) 的视频。 The DOM is EXPENSIVE to update. Virtual DOM is a lightweight DOM representation. Virtual DOM defines pure render function: f(d) = v f(d') = v' diff(d, d') = changes diff(d', d) = undo 由于 React.js 实现了高效的 diff 算法,使得 Virtual DOM 的更新最终被反映到对应的 DOM 节点上,所以性能上的损失并不明显。 Virtual DOM 支持 State 和 Props 两种概念。props 是 immutable 的,从 Parent component 传入的属性,例如 `className` 或是 `isExpanded`。state 是内部状态,从不对外暴露,在设计的时候应当尽量 minimum。state 是由 common ancestor 来管理的。 最基本的例子,在 id 为 "example" 的页面元素内添加一个 virtual DOM ` `。 // JavaScript React.renderComponent( React.DOM.h1(null, 'Hello world!'), document.getElementById('example') ); // JSX React.renderComponent( Hello world! , document.getElementById('example') ); // Live script react.render-component...

Vocabulary about hobbies

公司做的一个 Ice breaking 是列举你所知道的同事的 hobbies,有不少都挺有意思的,准备后面有空专门挑选几个来引入相关的词汇。 + Acting + Sudoku + Netball + Coin collecting + Volleyball + Sea shell collecting + Darts + Origami + Astronomy + Reading + Scouts of girl guides + Basketball + Break dancing + Roller blading + Playing bass guitar + Knitting + Bird watching + Golf + Home brewing + Board games + Skate boarding + Kite surfing + Gambling + Cycling + Paint ball + Kept a tamagotchi + Ghost hunting + Sky diving + Vehicle restoration + Orienteering + Lego building + Gardening + Sailing + Ice hockey + Table tennis + Bowling + Car racing + Gymnastics + Sewing + Running + Snow boarding + Meditation + Swimming + Motor bike riding + Stone collecting + White water rafting + Yoga + Hunting + Rock climbing + Pottery + Surfing + Collecting comic books + Horse riding + Fishing + Kite flying + Scuba diving + Martial Arts + Rowing + Wood carving + Bungee jumping + Composting

Archlinux in Virtualbox - Basic system

参考 [Josh Braun 的博客](http://wideaperture.net/blog/?p=3851) 来在 VirtualBox 上安装 Arch Linux。 ## 准备磁盘 使用 VirtualBox 来创建虚拟机的第一件事就是挂载一块虚拟磁盘和一张 Linux 发行版的 ISO 文件。为这块虚拟磁盘划分空间并格式化存储区很自然就成为了第一道坎。 先根据磁盘的总大小做规划,例如,我的虚拟磁盘一共是 16GB,被划分为这么几个分区: + Boot loader partition BIOS启动的时候需要查找一些程序用于计算机自举。Boot loader partition 就是存放这类程序的地方。通常BIOS会在 MBR (Master Boot Record) 查找boot loader,MBR 是在驱动器开始处的一块小区域。 + /boot partition lilo 和 grub 都是 boot loader,后者比较大一些。BIOS 在找到这块区域之后,会读入一些代码,继而从磁盘分区(通常是 `/boot` 分区)内读入更多的代码。 + root partition 这就是最基本的 `/` 分区,如果不特别创建 `/var`、`/usr` 或是 `/home` 等挂载点的话,大部分文件都是存放在这个分区内的。 ## 分区 使用 `gdisk` 来创建新的 partition tables, + `?` - print the help information + `l` - list all types + `n` - create a new partition, required arguments include partition number, first sector, last sector and hex code for type + `w` - write the partition tables to disk 可以参考[这里](http://www.taylorbyte.com/docs/wiki/archlinux/arch-install-gpt-ssd) /dev/sda 12G sda1 16MB for boot loader...

尝试自动化VM的创建和管理 —— Vagrant

根据 Vagrant [Getting Started Guide](https://docs.vagrantup.com/v2/getting-started/index.html) 先从官方repository拉下来一个Ubuntu的标准版box: C:\Users\jedi>vagrant box add hashicorp/precise32 ==> box: Loading metadata for box 'hashicorp/precise32' box: URL: https://atlas.hashicorp.com/hashicorp/precise32 ==> box: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox box: Downloading: https://atlas.hashicorp.com/hashicorp/boxes/precise32/vers ions/1.0.0/providers/virtualbox.box ==> box: Box download is resuming from prior download progress box: Progress: 100% (Rate: 54613/s, Estimated time remaining: --:--:--) ==> box: Successfully added box 'hashicorp/precise32' (v1.0.0) for 'virtualbox'! 这仅仅只是第一步,有了box之后可以执行 `vagrant init` 和 `vagrant up` 来启动虚拟机实例。 > 后记: > 我的预期是可以通过脚本来自动化VM的创建,并随着时间的更新来维护VM, > 不过貌似 Vagrant 和我目前的需求有所偏差。所以暂时不会做太多的探索。

解决 VIM 在 Windows 下打开文件乱码的问题

由于在新的 PC 上安装了 Windows 7,一些常用的软件也要跟着重装。突然发现 Vim 7.4 无法打开 UTF-8 编码的文本文件,满屏的乱码真是亮瞎了我的眼啊啊啊啊! 谷歌了几个解决方案,个人认为以下设置最佳: + 设置与编辑文件有关的编码格式 set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,chinese set encoding=utf-8 set termencoding=utf-8 + vim提示信息乱码的解决,包括了启动时显示的关于界面,以及状态栏等 language messages zh_CN.utf-8 + vim的菜单乱码解决 同样在 _vimrc文件里以上的中文设置后加上下列命令, source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim 简单解释一下以上几个选项所代表的意义: 1. `encoding` Vim 内部使用的字符编码方式,包括 Vim 的 buffer (缓冲区)、菜单文本、消息文本等。 2. `fileencoding` Vim 中当前编辑的文件的字符编码方式,Vim 保存文件时也会将文件保存为这种字符编码方式 (不管是否新文件都如此)。 3. `fileencodings` Vim 启动时会按照它所列出的字符编码方式逐一探测即将打开的文件的字符编码方式,并且将 fileencoding 设置为最终探测到的字符编码方式。因此最好将 Unicode 编码方式放到这个列表的最前面,将拉丁语系编码方式 latin1 放到最后面 4. `termencoding` Vim 所工作的终端 (或者 Windows 的 Console 窗口) 的字符编码方式。这个选项在 Windows 下对我们常用的 GUI 模式的 gVim 无效,而对 Console 模式的 Vim 而言就是 Windows 控制台的代码页,并且通常我们不需要改变它。

My CentOS in VirtualBox

1. Install JDK8 on CentOS - follow [this post](http://www.if-not-true-then-false.com/2014/install-oracle-java-8-on-fedora-centos-rhel/) 2. Download Scala from [Scala-lang.org](http://www.scala-lang.org/download/), and run the following commands tar xvf scala-2.11.5.tgz sudo mv ~/Downloads/scala-2.11.5 /usr/scala/ sudo ln -s /usr/scala/scala-2.11.5 /usr/scala/latest sudo alternatives --install /usr/bin/scala scala /usr/scala/latest/bin/scala 100 sudo alternatives --install /usr/bin/scalac scalac /usr/scala/latest/bin/scalac 100 sudo alternatives --install /usr/bin/scalap scalap /usr/scala/latest/bin/scalap 100