About This Blog

This is Chunhao's Blog

I'm writing something about life and technology here. As a practice of English writing.

My Chinese Blog: http://blog.chunhao.net

My Chinese Page: http://chunhao.net/index-cn.html

Subscribe

The books I’m reading

The items I’m interested in

License

24 February 2009 - 0:12How to write an auto-downloading script

如何写一个自动下载的脚本?

用Linux有一个很好的地方就是你可以很方便地让计算机为你做体力活。当然,前提是你要了解Linux的思维方式。下面就是一个活生生的例子,大家可以看看用Linux是怎么做事情的。

如果你喜欢听评书,这里是个不错的地方。这个网站有很多评书,还有百家讲坛,甚至有声的金庸小说。上面的东西不光可以在线听,而且都可以免费下载,不用注册。但是,只能一个链接一个链接地下载。例如,如果想下载《大唐惊雷》第1回,就要进入一个页面,然后点下载;要下载第2回,就要进入另一个页面,然后再点下载。这样,就无法批量下载一整部评书了。

如果你用Windows,那么你要么人肉点击这些链接,一个一个地下载(可能有100+回);要么就用C或者Java写一个程序自动下载,前提是你要懂网络编程的细节。

下面,我就说一说在Linux下如何用Shell写一个自动下载脚本:

Read more…

3 Comments | Tags: linux, programming

22 February 2009 - 23:02Unify the themes

My site is based on various applications. The blog is based on Wordpress, the wiki is based on Dokuwiki, the photo gallery the Simpleviewer. Other pages are written by hand.

Originally, each part had its own theme. It’s hard to acces other parts directly from one part. For example, there are no links from my blog or wiki to my homepage. I decided to change this. Eventually, the goal is achieved.

The theme of my blog is blue-pix. I like it for its briefness. The first thing I did is to port this theme on my home page. This work is pretty simple. I only changed the tags of the CSS file. Then, I modified the blog’s theme, added a link to homepage. The themes of homepage and blog was unified.

Next thing is my wiki. I have no idea about how to create template on dokuwiki at the beginning. When I refered to this link, I started my work. I did a lot of change on CSS and PHP files. Finally, my own template of dokuwiki was created. Now the themes of the whole site is unified, except for the photo gallery.

For the blog’s theme, blue-pix, I also did lots of modification. The originally version did not support widget, and it did not support Google Analytics and other things. It also did not support thread comments. Now, it works fine. If you are interested in this theme, just feel free to contact me.

I am not an expert on PHP, CSS, and HTML. However, I like hacking. All the problems are solved with the help of Google. I believe one sentence–don’t learn to hack, just hack to learn.

———–

Supplement:

Just now, I finished the modification of my photo gallery. Now, everything in my site are following the same theme!

1 Comment | Tags: other, programming

13 February 2009 - 14:08How to synchronize with SSH

I will share my experience in synchronizing files with SSH here. Following are demonstrated by synchronizing Dokuwiki. Of course, you can synchronize everything as you like.

The wiki I used in my homepage is Dokuwiki. The most great feature is that it does not require database connection. It’s very convenience for personal usage.

I have two Dokuwiki maintained. One is located in localhost, another in the webserver. I always edit the pages on localhost, and synchronize them to the webserver at times. Since Dokuwiki is totally PHP based, without database such as MySQL, I only need to synchronize some files.

All the changes on wiki are reflected on the folder “data” in your Dokuwiki path. So every time, I only need to synchronize this folder.

The best way to communicate with webserver is SSH. Fortunately, my webserver Godaddy support SSH access. Another thing need to concern is synchronizer. Here I use Unison. The best description of Unison comes from it’s the author of this software:

Read more…

No Comments | Tags: Software, linux

9 February 2009 - 22:57Site moved here

I have successfully backordered this new domain name “chunhao.net“, which is better to stand for me than my old domain name “chunhao86.cn”.

I am using 000webhost for the old site, which is really a good free host provider. However, due to my misoperation,  the new domain cannot be located in the free web host any more. I switched to another non-free host provider–GoDaddy.

Now, most part of the site have been transferred to the new domain here. All the posts and comments in my blog have also been moved properly. The old domain(chunhao86.cn) will keep alive for a long time. However, no upgrading will be presented there any more.

Most things are the same with old ones, except for some some changes. There most significant is  Wordpress. This new blog is built using Wordpress 2.7, while the old one Wordpress 2.3. There are lots of changes between the two versions, escpecially in the admin page. The new version is more user-friendly and integrated with much new feathers. Thanks for the small quantity of the posts and comments in my old sites, it’s very easy to move them correctly!

So sorry for you inconvenience! And thank you for touching my new site here. Please keep trace of my new site: http://chunhao.net, as well as my blog: http://chunhao.net/blog.

No Comments | Tags: other