Skip to main content

About Smart Watches

/galleries/about_smartwatch.jpg

Tablets, smart phones, smart watches...

By making the computing units even smaller, we are trying to bring these intelligent devices much closer to its master, the human beings. From PC to laptops to smart phones, the pioneers have made billions of dollars from their customers, who happily give up the greens for those latest fancy toys.

Now some are trying to replicate the success by offering a smaller accessory: the watch. Samsung is on its way, and there would be a number of well-known names getting on board, too. I am not sure how people would react to the next-gen watches, but I know I am not quite into the thing.

I think smart watch is going to fail...

Read more…

Repeat in Vim

There are many ways to repeat something in Vim. Knowing how and when to repeat would greatly save your time with Vim.

Get Started

Natively Vim provides some basic methods to repeat:

  • the '.' will repeat the latest operation: if you 'dd' to delete a line, '.' will continue deleting another
  • the 'p' pastes contents copied (or in the Vim language, yanked) before. Combined with the use of registers, one can keep multiple copies of different content and pastes them into other places.

Be More Powerful

Besides the basic toys, Vim enables much powerful repeat technique with its record feature, the q command allows to repeat a series of Vim operations, which, when nested or with numbers of repeated operations specified, could be extremely efficient. A life changing feature.

Example: When analyzing logs it is sometimes required to remove the time stamps and compare two logs. There are many ways to remove time stamps in a log file, using the recording feature is one of them. In the example below, I first go into the recording mode, remove the timestamp of the first line, go into the next line, and end recording. The remove-time-stamp operation has been recorded and stored into register 'q'. Because there are still 48 lines to be processed, I simply type '48@q' to repeat the same operation for 48 times and the whole log is cleaned.

/galleries/repeat-in-vim-1.gif

Not everyone would think of it but regular expression is another technique that could be used to repeat operations in Vim. And when you used to it, you will give up anything to be able to do regexp in Vim =) There are many resources available for using regular expression (Google is your best friend...), there is even a [website](vimregex.com) just for this topic! I think it would not be very interesting for me to 'repeat' here...

Make Extra Steps

Besides the native support provided by Vim, there are many plugins available out there to further improve your efficiency. Marvim being one of them, makes it easier to store your frequently-used-and-complicated operations and even easier to repeat them.

Marvim allows saving operation macros by name and groups the stored macros by namespace. On the other hand Marvim provides searching the operations by name: especially helpful when you have a lot of operations saved. A simple but illustrative example is shown below for those who are interested.

/galleries/repeat-in-vim-2.gif

Minimal Setup for Remote Access Linux from Windows with X

When accessing a Linux machine remotely in Windows, many might use VNC or similar remote desktop tools. Some might simply use Putty. Both are not quite satisfying: VNC and the like ask for too much network bandwidth when transferring graphical data, while Putty doesn't support X and limits your use to only in the console.

Some might suggest using Cygwin, which will give you access to the X environment without sacrificing much bandwidth (it transfers the graphical parameters instead of pixel value). But still installing Cygwin is a pain, not to metion its huge size, which could be over 1G easily.

Recently I just realize there is a way to get to work remotely from Windows with X setup, and here is you could do it:

  • Download a Putty client (I would recommend KiTTY, give it a try)
  • Download and install XMing.
  • Start XMing and then run your Putty client. Enable "Enable X11 forwarding" in Category->Connection->SSH->X11.
  • Start a Putty session and try "xclock"

YES! It works! Even better, with minimal space and setup =)

2012

在开始总结过去的一年前,手悬在键盘上估摸着有5分钟的时间:很多事不知从哪个开始——是否说明去年过得很混乱?还是非常充实?

第六年的婚姻。经历了很大的考验,无论是外界还是自己的内心。不过总算是挺了过来,给自己打85分,80分成绩额外加5分态度。接下来,痒之年。

孤独的外婆最后还是离开了人世。在过世后再去怀念悲痛应该算是很虚伪的事情,我能做的只有多陪陪仍在世的亲人。外婆,希望真的有天堂,这样你就可以快乐幸福了。

工作上公司给了一些新鲜活,技术上没有什么挑战,就是多了解了一些工程上的方方面面。也了解到:软件工程师中,三流的仅限于和代码打交道,二流的还能和机器打交道,一流的才可以和人打交道。

没能够好好的看几本书,只有算法导论粗略过了一遍,不得要领。翻译了一个小册子,顺带做了些小。虽然景仰那些没事就弄个小gadget出来玩玩的人,我还是不能好高骛远,定位好自己,做力所能及之事。身边不少朋友都在玩Lua,明年若有空,也希望可以入个门。

接受主入我心已经两年,尽管不时警醒自己要正确做事为人,但仍难以让自己完全不受撒旦的引诱。或自轻,或易怒,或迷失。通俗点说,道行尚浅。它为我们设计了完美的人生,我们唯一要做的,仅仅是要知道如何按主的设计去生活而已

一年的忙碌还有部分归功于多次的旅行。我们一起找到了南十字星,一起泡温泉,一起在樱花和枫叶前留影。2012我们还回了3次家,只是海南粉还没吃够。

忽忽悠悠一年也就过去了。乱,确实挺乱的。

不过自己怎么乱,也不及这个乱象丛生的时代。几乎每天都可以听到令人咋舌的新闻,不是无耻之至,就是无知之极。然而在这样的年代,新闻过夜就会被人淡忘,越来越多的人习惯于义愤填膺后继续偷鸡摸狗,早上戴红袖章清理卫生死角,傍晚就出来遛狗大小便顺带清清自己喉咙里的浓痰。新闻即娱乐,真的勇士流出的鲜血,到现在连看客的数量都无法保证了。

不过,惹不起,总躲得起吧? 2012做的最大的事,肉身翻墙。想想真有点没出息。不过,以自己的能力,能做的目前看来也就只限于此了。 而这也只是个开头,后面还有太多的要做。

世界末日终究还是没有来。新的一年,希望自己能沉稳,能有序,能有所收获,能尽力担当。

铁婚•铁与锈

与婚后第六年比起来,过去的就像是小孩子过家家。

先是雯的住院,无论是心理还是生理都是两个人从未经历的折磨。 感谢主,感谢家人和朋友的关心和照顾,几经磨练,我们才得以最终战胜各种困难。 出院的那天,有一种从战场归来的喜悦,也有一种考试结束的轻松。

然后在一次聚会上,大米夫妇戏称现在彼此间已经是亲戚关系。大笑过后,看看我们,竟然也颇有些亲戚的感觉了。 我们已经习惯了对方的存在,习惯了关心对方的同时也被对方关心。我们一起生活,一起出游,一同快乐,一同承担。但与此同时在我们之间已经失去了若干年前的一些激情,一些冲动,却是滋长了一些无奈,一些迟钝。 这么些年的同欢共难,我们结成愈加坚固的钢铁,而历经年月的外表也已锈迹斑斑的布满老茧。 茧是死皮,锈是腐铁。

我们已经熟悉对方的一切,熟悉对方的优点更对缺点倒背如流。在对方需要的时候,我们都可以给出很好的意见。而在他不需要的时候,我们也会固执的指指点点。 “我最深爱的人伤害我却最深”,最了解你的人最有能力深戳你的痛处。或许,考验才刚刚开始吧。

这个周年没有在家庆祝,在一家烧烤店里我们用两片烤肉代替碰杯:希望今年的愿望明年成真,希望明年的庆祝更热闹一点点,希望我们一直相扶走下去。

有一种说法:婚姻是坟墓,每隔一段时间就要去扫墓,否则就会杂草丛生。 希望像我这样每年打扫一次能够留下足够的记忆,除去多余的杂草,扫干净我们的小小坟包。

秋游日本归来

十一月,我们去了一趟日本玩。 同事听说了表示不解:你不要命啦?这个时候去日本? 家里人知道后表示担心:要注意安全啊,现在关系那么紧张。

我们在大阪、奈良、京都、宇治走了7天,赏枫喝茶走大街。满载而归回到家里。 由于日本人英语普遍不太好,我们大多数用的蹩脚的日语问路、问菜、问价格。由于我们的日语实在蹩脚,问题里面还掺杂了一堆英文。所有我们问过的人都知道我们来自中国,但我们得到的是极其热情的帮助和充满善意的微笑:

一位先生用了半分钟弄清楚我想要去的丸龜製麵,示意让我等等,用了两分钟在Google地图上确定了面馆的位置并思考应该怎样告诉我如何走过去。他思考的结果是,亲自带我去。 一对老夫妇在高岛屋百货买了一套魔术道具,我在后面看着觉得很有趣。他们在和我对话后知道我是中国人,显得非常高兴,老太太马上用不怎么流利的英文问我的行程,对日本的感觉,并推荐我买这款道具,并在最后祝我旅途愉快。 在去東福寺的路上我们找不到车站,只好找旁边的一位交通协管问路。他弄清楚问题以后叽哩呱啦一通日语告诉我怎么走,看到我一脸糊涂像才醒悟过来我不是日本人,于是带我走到路边,慢慢比划着告诉我怎么找到那个车站。在我示意我明白以后,还向我敬了个礼。

坐在回程的飞机上,我在想,如果我是个日本人而我在中国某处旅行会是怎样? 也许我会在面馆被泼一脸的面汤? 或者是刚看到Muji就发现店门紧闭玻璃上挂着巨大的红旗? 至于协管城管我已经不敢想象了。

抛开别的不说,至少从这一点上,我见过的日本人是要更爱国,更爱生活,更爱和平一些的。

开关

晚上吃完饭,我在沙发上抱着电脑看视频,老婆背对着我上网也玩得起劲。 “过半个小时,也就是9点,我去洗碗,你去洗澡,然后我们看碟。”,制定了方案,老婆继续趴在网上。 “好的”。我继续看。没有用耳机,房间里只有我视频的声音。

9点到了。 “老婆,去洗碗吧” “嗯……你也去洗澡吧。”很明显,她还是趴在网上,没有要去洗碗的意思。看来真的有什么吸引到她了。 哟,敌不动我不动?有点意思。

我打算做个测试。

9点15分。我忽然把视频的声音关掉。 整个房间马上安静了下来。 大概感觉到我要去洗澡了,虽然没有回头看我,但是她挪了挪身子准备起来。 在她的背后,我继续测试,忽然又把视频声音打开。 “嗯……”伸了个懒腰,她又挪回到原来的姿势,继续趴网。 再次把声音关掉,眼前的这个家伙又开始挪动准备去洗碗。 “哈哈” 我忍不住笑出来,结束了我的测试。 “果真是我不动你也不动哦!”全盘托出我的试验之后,她也没忍住,不停的笑骂我的心机太重。

在某一个地方,每个人都有自己的开关。 有些时候很多事不是我们不会做或是不能做,而是心里想不想做。 在没有找到开关之前,总是会有这样那样的“不可能”出现:“我不知道怎么做”、“他不可能做出这种事的”…… 一旦那一个开关被拨动,过去想不到的就会被想到,别人认为做不出的就会做出来。快速得像电灯通电一样,简单得同汽车发动一般。 那么,这回你的开关,在哪里?

Hello Octopress

This weekend I decided to migrate this blog from Wordpress to Octopress, because of many reasons searchable in google, and because with Octopress now I can write posts anywhere with Vim and Git. To help those who are now exploring Octopress (and myself sometime later), I've made some notes on the obstacles that I've seen as well as the solutions:

Migration from Wordpress to Octopress

The migration was pretty easy, once you export from Wordpress to an XML file, exitwp generates the markdown files for you with a few key strokes. The only thing lost during the migration is the comment, but your life would made easy if you are going to use Disqus:

Migration of Comments

To move your comments from Wordpress to Octopress, first install the Disqus plugin on your Wordpress and then export the comments into Discus. It is said that the import might take up to 24 hours but I guess it will be much shorter for many of us. After the import completes, go to [your account].disqus.com/admin/tools/migrate/, build a CSV file following the example and upload the file for URL mapping. That is it for comment migration. Easy~

Customization

The next step is customization. There are not too many themes available for Octopress when I setup this site, and it appears that I have two options if I need something different:

  1. follow the instructions @ the official site
  2. get the Slash theme

As you could see I am too lazy to hack and therefore just go for option 2.

Localization Support

For bloggers who write posts in Chinese, the current Octopress has a limitation: lack of Chinese category support. There are also two ways out:

  1. To name the categories under 'category_dir' in Chinese codings like RFC1738. This method works when I preview the pages locally, but failed after deploying the changes to Github.
  2. To name the categories in english, but display the nick names (in Chinese or other localizations). The second method asks for not only changing the category_generator.rb, but also some of the framework files. It works perfectly locally and on the server side. I would recommend this approach.

LaTeX Support

Even though Octopress claims itself as A blogging framework for hackers, LaTeX is not supported by default. To blog with some mathematics, you could try the following to obtain this capability:

  1. in _config.yml, change

    markdown: rdiscount

    to

    markdown: kramdown

  2. install kramdown by doing

    gem install kramdown

    in bash

  3. in source/_include/custom/head.html add the code below:

<script type="text/javascript"
    src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
  1. try the following

    R_{ab} - {textstyle 1 over 2}R,g_{ab} + Lambdag_{ab} = kappa, T_{ab}

    and you should see

    R_{ab} - {textstyle 1 over 2}R,g_{ab} + Lambdag_{ab} = kappa, T_{ab}

God Might Be a Supercomputer

This will be a very unique article in the blog: it tries to depict my imagination of God that comes to me when I was coding.

God is a supercomputer, while we are just some little dum devices, some with a 8051, quite a few with MSP430. God designs and creates all of us, giving us the ability to run programs, which also by him.

God writes bug free programs, which are specialized to each device. There is no defect in God's programs, when the programs are correctly run, all little devices do well.

God loves everyone he creates and give them freedom. God loves us so much and gives us the freedom to choose what to run, otherwise we will be puppets that can only run the program downloaded. Therefore each device has the freedom to run whatever it likes, including those not designed by God.

God feels sad when his creation doesn't follow his design. God loves his creations and provide them the best (program). When we do something other than the program offered by God, he will be sad because he knows that is not for us.

The Bible is God's design book, from which one could learn God's design and know what his program is. By reading the bible we know what God's program looks like, and only when we know what is God's design we would be able to tell his program from others.

Knowing God is a supercomputer, we could answer many questions easily:

  • Why doesn't God help me even when I pray and ask for his help so badly?

    God has designed the best program for you and given you the freedom to run it. He will not help you because if he does he would either have to change the program, or force you to run his program. He will do change the program because God write bug free programs, he has offered the best program. No change is needed, nor possible. He will not force you to run his program because God loves everyone he creates and give them freedom.

  • Why do I need to read the Bible?

    You don't have to. But if you do, you will have a chance to know what God's design is for you. And you know what is the correct decision to make when you are facing challenges. If you know what is the right thing to do and do it, you make no mistakes and will not regret because you've run the program provided by God. This is because The Bible is God's design book and God write bug free programs.

  • I don't see what I am doing is wrong, though people in the Bible study group disagree. Can I just do it?

    You can do anything you like because God loves everyone he creates and give them freedom. You have the freedom. But if you choose not to follow God's program you will definitely make mistake and regret because God writes bug free programs. You don't see anything wrong not to follow God's instruction because God is a supercomputerAs little devices we have too simple instruction sets and therefore would not have the capability to understand what can go wrong and how. Simply follow God's program and everything will be fine.

  • I know I did something wrong, can I make it up by repenting? I have no time to read the Bible. Other than that, would God help me?

    When you did something wrong, your life is off the design by God. Depends on the mistake you made, it might bring you back by repenting. It might also ask for more to correct your mistake. God's help is in the Bible. The best way to correct your mistake is to turn to the bible and to do what it tells you to. Other than that God will not help to do anything, because:

  1. God writes bug free programs for you but you choose not to follow.
  2. The Bible is God's design book and you choose not to read.
  3. God loves everyone he create and gives them freedom so he will not force you to do the correct thing.

I am not sure if the above is truth, as no one could say it is wrong. But I find it logical and helpful to clear many confusions. Hope that helps you, too =)