南郭之家
南郭大侠的blog ^_^

robbyrussell’s oh-my-zsh at master – GitHub

August 5th, 2010 by Titan

很帅的zshrc配置,支持模块化配置,插件,主题等功能,发个截图上来show一下

via robbyrussell’s oh-my-zsh at master – GitHub.

oh-my-zsh界面截图

Posted in 技术 | No Comments »

新一代 Linux 文件系统 btrfs 简介

August 5th, 2010 by Titan

via 新一代 Linux 文件系统 btrfs 简介.

Posted in 技术 | No Comments »

InfoQ: Agile Team Meets a Fixed Price Contract

July 2nd, 2010 by Titan

InfoQ: Agile Team Meets a Fixed Price Contract.

敏捷团队与定额合同,现在能够接受敏捷方式开发的客户越来越多,但是大部分仍然需要签订定额合同是国内常见的现象,很实际的问题

Posted in 随想 | 1 Comment »

穷人的linux集群测试环境

May 15th, 2010 by Titan

最近在学习搭建rhel下的集群,但是既没有几台测试机器,又没有足够的设备,搭建实验环境比较困难,大部分练习需要依赖在实验室的测试环境,很不利于自己学习,所以研究了如下的解决方案,其中有些解决方案参考了别人的方法,但是本文所有的内容都是本人学习研究后的原创,欢迎指正

  • 虚拟机搭建环境:kvm
  • 集群节点和服务器系统:rhel5.4
  • 宿主机:ubuntu 10.04
  • 使用到的技术:kvm, lvm2 snapshot, cluster

以下是具体步骤:

首先,参考ubuntu的kvm文档的方法安装kvm和virt-manager
`sudo aptitude install kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager`
安装之前需要先检查自己的机器是否支持及开启了虚拟化技术,具体就参考ubuntu的kvm文档

接下来是安装lvm2,

sudo apt-get install lvm2

使用lvm创建分区,我是在机器上面划了一块空间作为lvm空间,所以下面的命令根据自己机器分区的设置可能会不一样

sudo pvcreate /dev/sda3
sudo vgcreate vg0 /dev/sda3
sudo lvcreate -L 4000M vg0 -n node0

这样就在/dev/vg0/node0创建了一个新分区作为集群节点的模板

下面要在这个分区上面安装模板节点

sudo virt-install \
--connect=qemu:///system -n node0 -r 512 --arch=i686\
--os-type=linux --os-variant=rhel5.4 --virt-type kvm \
--cdrom=/media/data/rhel-server-5.4-i386-dvd.iso \
--disk=/dev/vg0/node0

这样就创建了一个内存为512M,kvm全虚拟化,32位的虚拟机,iso文件指向自己存放的位置就可以了

下面在virt-manager里面选中node0,打开,就可以用图形界面安装了,尽量把通用的配置一起性做好,比如yum源等一次配好就不用在clone出来的虚拟机里面一个个配置了,安装的时候把不需要的软件包去掉,可以节省空间。比如因为我们是测试集群,把游戏,办公那些包都去掉就好了。我去掉以后的安装大小是不大到2g,所有上面磁盘创建2.5g应该也是够用的。

安装完成以后做一下基础设置,然后把虚拟机关掉。
下面开始设置其他的虚拟机

sudo lvcreate --snapshot /dev/vg0/node0 -n node1 -L +1G
sudo virt-install --import --disk=/dev/vg0/node1 -n node1 --arch=i686 --virt-type kvm --connect=qemu:///system -r 512

因为只需要复制metadata,所以以上操作都是瞬时完成的。
同样创建node2,node3和server即可

创建完成以后,启动各个虚拟机,设置以下ip和hostname就可以用了。在实验室环境里面,教师的服务器开启了dns服务器,如果这里没条件自己做,可以在各个虚拟机的hosts文件里面设置其他虚拟机的ip

Posted in 技术 | No Comments »

用手机发blog测试

April 22nd, 2010 by Titan

试试看

Posted in 随想 | No Comments »

learning for living

April 16th, 2010 by Titan

Finding myself quite lazy these days. I rejected several projects
several days ago, which will never happen before. Is it because I am more
mature to recognize not realistic projects or I am too weak to do those
jobs, I don’t know.

Talked with a experienced project manager, I found myself lacking lots and
logs of abilities to be capable of being who I want to be. Much much
more have to be learned, such as database management, performance tuning skills
and other must-have for programmers.

The algorithm book require much patience and math background, but it is
still something we programmers have to master, try to join or make a
community, learn from each other.

Be stronger!

Posted in 随想 | No Comments »

Using Spring init and destroy lifecycle callback in non-web apps

March 15th, 2010 by Titan

When using spring to create singleton classes, we often have to use some initialing and teardown mechanisms to acquiring and releasing resources in the program, such as opening and closing files, using connections to databases, etc.

As spring recommends default constructor to ensure the testability of your class, it is necessary to use an init method and teardown method in the class. Although spring provides serveral interfaces(such as InitializingBean and DisposableBean) for programmers to implement, it is to intrusive for a program to couple with spring when a simple init method is introduced.

So spring provides XML-based configuration for this. You only have to declare the init and teardown method in bean definition in xml configuration file, such as
`` and I define init and cleanup method in HelloWorld class, it will invoked by spring automatically. Only one thing to remind, if you use destroy-method configuration in non-web apps, you have to manually invoke `((AbstractApplicationContext)context).registerShutdownHook();` to register shutdown hook after the context is created. Otherwise, the destroy-method will not be invoked by spring.

And spring also provides default-init-method=”" and default-destroy-method=”" on beans node, which will be invoked if specified method is available.

Posted in 技术 | No Comments »

E TextEditor Using Tips

March 12th, 2010 by Titan

e-texteditor is really a awesome text editor for programmers on windows platform, especially for dynamic languages. As it is designed to be a alternative option for textmate on win platform, it can incorporate almost all powerful bundles designed for textmate.

  • php, using the built-in bundle
  • ror, it has perfect built-in bundle for ruby on rails
  • TODO bundle, implementing common todo in comment function

After install all the bundles I needed, I played around for some time, looking for some features I must use everyday.

  • kill line (ctrl + alt + k)
  • quick moving between words (ctrl + left or right)
  • snippet completing (tab)
  • zen-coding expand (ctrl + E)
  • quick open file in project, a very useful feature. (ctrl + shift + T)
  • find symbol in file (ctrl + L)
  • go to line (ctrl + G)
  • find & replace supporting regex
  • quick switch between tabs (ctrl + 1-9, ctrl + 0 for select)
  • language specific features: commenting line or region, command shortcuts, etc

The reason I like e as my programming editor is because it is native windows program. So I can use familiar ctrl + backspace to delete a word, ctrl + c, ctrl + v, and also get the power of a configurable editor as vim or emacs.

Posted in 技术 | No Comments »

New Theme, New Life

March 11th, 2010 by 南郭大侠

马不停蹄的忙了两周,每件事情都是很重要的,都是不能懈怠的。所以牺牲了大量的上班时间拿来做自己的事情了,刚刚完成了那个cms的部署,长长的舒了口气。做cms的过程中,好好的实践了一下前端的技术,自己做了mockup,后来实现到动态的代码里面去,为了扩展性又做了一次完全的重构。

最近一直对前端很感兴趣,所以想到回来收拾一下自己已经长草的博客,换了个主题,黑色灰色和白色,更像是我的颜色~

明天就是周末啦,加油~

Posted in 随想 | No Comments »

cygwin下rails开发环境的搭建

February 12th, 2010 by Titan

首先说一下我用到的工具

  1. cygwin
  2. ruby1.8.7(注意:用了1.8的)
  3. sqlite3-ruby+ sqlite3(好久才搞定)
  4. rails, rake, rspec, cucumber …
  5. console2(用来启动cygwin,可以实现tab方式的终端。)
  6. e-texteditor(据说是windows下面最像textmate的编辑器了)

首先从cygwin开始说吧

用默认的肯定是不行了,我凭记忆说一些需要的包吧:ruby, iconv,git,automake,make,autoconf,subversion,ruby,sqlite,libsqlite3,libsqlite3-devel,tidy, vim。我其他的还装了很多,比如readline等。具体有没有用不知道,反正我用cygwin还有别的作用,所以就装了很多

sqlite3-ruby

这个就比较麻烦了,从/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/driver/dl/api.rb里面可以看到,没考虑cygwin的,不过可以认出来是mswin也行。但是mswin只会找/bin下面的sqlite3.dll。但是cygwin默认装的/bin/cygsqlite3-0.dll。两个方法可以解决:1. 改api.rb 2.给那个dll改名。因为第一种方法可能以后给sqlite3-ruby升级的时候有问题,所以就把dll复制了一份,命名为sqlite3.dll。搞定

rails等

这个就容易了吧,gem install rake rails rspec cucumber webrat

记得装webrat的时候需要几个库,其中有iconv,其他的忘记了。。。。。反正他要哪个就装哪个呗

console2

这个工具中文系统装了以后显示很怪异,其实好解决,他有个readme,可以解决。我用的win7,从console2里面启动cmd窗口,把cmd窗口默认值里面的字体改成新宋体就搞定了,巨丑,没关系,在console2里面再换成好看的consolas就好了。然后把菜单栏和工具条都去掉了,快捷键改成跟ubuntu下面的终端一样的键位了,舒服。ctrl+shift+t开新tab。ctrl+shift+c复制。ctrl+shift+v粘贴。

e-texteditor

支持正版哈,大家尽量不要破解它。很好的工具,希望他继续发展呢。以前对中文支持巨烂,现在慢慢的程序也稳定了,不错的程序,安装的时候报的错误时因为有些文件名windows下面没法处理,全部忽略就可以。然后在cygwin里面git clone git://github.com/gtcaz/ebundles.git,这个是他最新bundle的发布地址。下载最新的bundles复制到安装目录里面就可以cp Bundles/ /cygdrive/c/Program\ Files/e/ -r。bundles就ok了

总结

文章里面可能就是cygwin具体装了那些包我有点忘记了,反正报错就能看到缺啥了,花我最多时间的就是sqlite3了,哎。

上图

界面截图

界面截图

Posted in 随想 | No Comments »

« Previous Entries Next Entries »