跳至主要内容

博文

目前显示的是 五月, 2015的博文

初探 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 和我目前的需求有所偏差。所以暂时不会做太多的探索。