switch to octopress

使用 octopress 来写blog了, 位置在 code6.github.com, 目前还没搞定cname, 如果搞好了可能就换一个名字了。

Switch to win7 64bits

偶然下了一个一点多G的镜像来玩,才发现是64位的,似乎vmplayer是不能跑,于是冲动之下就将win 7 32bits换成64bits的了。

用win 7 自带的刻录工具,买了一个DVD光盘,刻了一个win 7-sp1-x64, 顺便用移动硬盘载了个带网卡驱动的驱动精灵,然后开干。重启后安装系统,然后用驱动精灵安装xx驱动,剩下就是补软件了。

列几个小软件

goagent

你懂的好工具,现在开来比fg方便多了。

everything

迷你的桌面搜索工具

editplus && vim

目前的主要编辑工具

secureCRT

用的很爽的一个ssh终端工具, 不过没配置真是太丑了,还得重新配置一下。

vim颜色配置

Q:

I've got syntax highlighting on with VIM currently, but noticed that I'm not able to see colors within SecureCRT as I am with other shell clients. Is this by design? I tried searching a bit, but wasn't able to find anything specific as three-letter searches are disabled in the forums. I probably could've searched for 'syntax highlighting' but I just thought of that now. If this is by design, would it be possible to have this changed in future releases? I'm a tech. support rep. that uses SecureCRT all day, every day, for work. I do a lot of text-editing, especially different types of code and HTML and would love to see this feature added in the future.

A:

It is the terminal emulator that provides color support, and the correct terminal type must be specified in the Unix/Linux environment (TERM environment variable) to allow color-aware apps (vim, ls, etc.) to provide color. The terminal type must support color (eg. xterm does, vt100 standard does not).Check your TERM environment variable, and ensure ANSI colors are enabled in SecureCRT.

 

Backspace 不能用

Option - Session - Terminal - Mapped Keys - choose "backspace sends delete"

 

背景色

 Option - Session - Apperarance - current color scheme -- choose traditional

 

乱码

本来想用lucida console的,不过配置一乱码,最后使用Sim-Sun-ExtB勉强一下。编码选择 Option - Session - Apperarance - Character -- choose UTF-8

 

按Ctrl + S 假死

CTRL-S and CTRL-Q are called flow-control characters. They represent an antiquated way of stopping and restarting the flow of output from one device to another (e.g., from the computer to your terminal) that was useful when the speed of such output was low. They are rather obsolete in these days of high-speed networks. In fact, under the latter conditions, CTRL-S and CTRL-Q are basically a nuisance. The only thing you really need to know about them is that if your screen output becomes “stuck,” then you may have hit CTRL-S by accident. Type CTRL-Q to restart the output; any keys you may have hit in between will then take effect.

 

配置button bar

似乎是不错的东西,不过我这边目前除了编辑和新建,无法删除,故暂时隐藏吧,目前没有明显需求。

Editing with vim -1-

慢慢写点东西,培养这种习惯,这次从vim下手吧。

工作后开始使用vim,算起来也用了好久了,目前还是入门选手,不是很熟,偶尔多学了一点技巧,对vim的喜爱就更加深一点。简单记录一些,当做备忘来着。

Next/Prev

很经常是希望回到上一个位置或者下一个位置,这时候记一些快捷键就很方便了。

  • 查询vim帮助时, 比如在标签|bars| 上然后输入 CTRL-],则跳转到这一主题, CTRL-T 或 CTRL-O 跳回。
  • 键入 '/' 时查找特定字符串时, 可以按 n 查找下一个,按 ? 查找上一个。直接在词上按 * 则查找下一个, 按 # 则查找上一个。
  • 比如我喜欢使用多标签页而非多个split窗口,则可以将 tabpervious, tabnext 映射一下,比如Ctrl+N, Ctrl+P
" Switch tabs
nmap <C-N> :tabnext<CR>
nmap <C-P> :tabprevious<CR>

Replace

替换基本上只需要一个简单的式子即可:

:[range]s/pattern/string/[c,e,g,i]

其中c会询问每次替换是否执行, g为整行, i为不区分大小写。
有时区域的约束还不够的时候,我们可以先进行行级别查找再替换, 即

g/foo/s/bar/zzz/g

Select

一个比较实用的是在normal模式下使用Ctrl + V可以进行块选择
在Ctrl + V选择若干行后, 按 I 进入编辑模式, 输入字符串后再按两下 Esc 则会在选择的行前都加上此字符串(Ctrl + V + I + str + Esc + Esc)。

plugin

之前都不太用插件,后来稍微研究了下,现在有在用的也差不多就是NERDTree吧,确实还挺好用的。感觉一般常用vimrc配置一下也差不多即可了,我的vimrc也是在前人的基础上简单修改的,目前放到

Some Links

Facebook Hackercup 2012 Round 1

我想不开始搞搞,这个窝只会越来越荒废。晚上打算做做1月29号的这场比赛,一开始看成两点开始的比赛,确实如此,不过持续24小时没看到,幸亏没有爬起来做。29号的时候想了下,然后用了点力,终于搞完了,但愿别挂。好久没有搞题目了,希望一直搞下去,简单说说吧。

 

Squished Status

给定一个字符串和M,问能切成多少种由不带前导0且数字不大于M的数字组成的序列,其中字符串长度小于1000, M<=255。|
最弱一道题,简单的$O(N^2)$的DP即可,dp[i]表示前i个字符的方案数,然后搞。

update : 由于一个傻逼的下标写错,导致挂了!

Checkpoint

实际上已知

  • $C_{x_1 + y_1}^{x_1} \times C_{x_2 + y_2}^{x_2} = S$

  • $x_1+y_1>0, x_2+y_2>0,x_1+x_2>0,y_1+y_2>0$

  • $S<=10^7$

求 $\min x_1+y_1+x_2+y_2$

由于S很小,可以暴力枚举 S = u * v, 下面即求 $u = C_{x_1 + y_1}^{x_1}$ 然后求 $\min x_1+y_1$
我们可以从1到107暴力枚举$C_y^x$,当y确定,随着x的增大,组合数是先增后减的,且是对称的。
对于$C_y^x < C_y^{x-1}$ 我们可以退出,对于$C_y^x < 10^7$ 我们也可以退出,然后用map记录每个u能达到的最小y即可,默认值为u($C_u^1$)。

Recover the Sequence

对1到N的一个排列进行归并排序,给出每次比较的结果(取左边的数则为1,右边的数则为2),要求通过比较结果数列还原原始数列。

这题不错,想法也挺好玩的。因为有了比较结果序列,那么我们可以知道每次归并数列的变化情况,又我们知道最终的数列为[1,2,3, .. n],那么我们可以拿位置数列[1,2,3, .. n]去重放归并的过程, 然后得到一个位置的排列, 他等于 1, 2, 3, ...n 这个排列,映射一下就得到原来的数列了。

 

这次主要是时间比较长,所有有时间做,接下来也得积极参加才行。回头还希望能多写一点技术方面的东西,总结总结才好,共勉。

update 2012.1.30 14:43
由于最简单那题的傻逼错误导致没能晋级了,真悲剧!!

ps: 感觉用tex数学公式编辑看起来有点不相称,暂时不知道怎么搞漂亮些。

做一个快乐的coder

做一个快乐的coder

然后找一个地方写写自己的心情

找一个地方写写对于coding的理解

以上即可