行者无疆 始于足下 - 行走,思考,在路上

it民工搞gentoo与农民种庄稼之间的关系

夜半果然是头脑发达四肢简单的时光啊。忽然想到自己花一个月时间安装调试的gentoo系统和农民种庄稼是一个道理。种庄稼的流程大体是:

while(1)
{

    先在荒山野岭开辟一块地,打上标号;   \\gentoo:硬盘里面划出一块分区,给个分区号/dev/sdaX

    拔草松土浇水整地;                           \\gentoo:格式化文件系统

    准备锄头,铁锨,人力,物力,必要时加上电力;    \\gentoo:准备基本系统工具,gnutoolchain,编译器,基本目录结构

    买种子化肥,根据地面情况和气候环境情况进行不同的搭配;    \\gentoo:下载内核,根据系统硬件不同做不同的组合配置

    播种施肥种庄稼,必须保证天时地利人和,才能有好收成;       \\gentoo:编译内核,compiling,compiling,compiling,注意compiling过程中不能断电死机,否则重 新来过,隔断时间需要人力保证系统正常运行编译

    庄稼在成长,根据不同地区气候条件生长周期也不一样;          \\gentoo:内核在编译。根据硬件配置编译时间长短不一

    秋天到了,天气转冷,开始收获庄稼;                                  \\gentoo:cpu温度降了,说明内核编译完了,开始检查是否正确

    找亮卡车,告诉他哪块地,让它在一定时间内把庄稼拉回来;    \\gentoo:装个引导器,设置好分区和timeout,看能否启动系统

    if(收成好)
    {
        加工倒卖;                                                          \\gentoo:各种美化配置字体窗口环境,最终手续若干,得到成品
    }
    else
    {
        continue;                                                        \\gentoo: 重新来过
    }
}

妙哉妙哉!有空再完善下。睡了睡了。

放浪形骸之功,略有小成

这是3月25日晚上的照片。

首先是解决了emacs和ibus输入法冲突的问题,总结起来,大概原因有三:

一是系统环境变量LC_CTYPE设置错误,应该设置城zh_CN.UTF-8,下面是我的locale:

LANG=en_US.UTF-8
LC_CTYPE=zh_CN.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

二是没有设定好正确的ibus启动环境,应该在系统启动文件(如~/.xprofile, ~/.xinitrc等,看系统版本而定)中加入如下语句:

export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"
ibus-daemon -x -d -r

三是字体问题。昨天出于系统洁癖原因,卸载了xorg-11,装上了xorg-server更精简的包,这么一卸一装少了几十款恐怕一辈子都用不到的字体。可是emacs却无法使用ibus输入法了。无奈,重新装上xorg-x11,重启后问题得到解决。

有的论坛说修改一下emacs中ctrl+space快捷键的设置。其实不对的。默认情况下xim快捷键的优先级应该比emacs的快捷键高,ctrl+space默认应该被x系统截取,调出ibus输入法的。

解决完了ibus的问题,晚上去zjg做实验,还是verilog,只是这次换了两台电脑,依然没有找到“成品”。无奈只得自己动手丰衣足食。好在照着前人的一份实验报告,折腾了良久,竟然成功了。三个仿真一个板载,运行成功。天,有史以来第一次靠着自己的力量搞懂了verilog代码完成了实验。不过xilinx还是比较恶心。bug不断,所谓下载到板子上究竟是怎么回事,鬼才知道。学生也就就着糊涂装糊涂,copy来copy去,索然无味。不过好好学还是有收获的,逻辑,组成加体系结构,三门理论碰上三门实验,抵得上国外大学体系结构的真家伙了。

无奈做完实验已经没有公交了,等校车又得等半个小时,给某人打电话,心境不佳,索性走回yq。十三公里左右,从9点半走到11点半。

路上碰见一家超市,遂进去拿了凭雪花,勇闯天涯,心情舒畅,大快。边走边饮,边饮边唱,边唱边笑,放浪形骸。爽也。路上短信和wj大谈linux发展之路,指点江山,激昂文字,好不快活。

晚上回寝,随便逛了逛论坛,倒头便睡。至日照三杆,吃过午饭,步行至图书馆。一个下午,看了两章《Linux Administration Handbook》,搞定了zhq社团的文案,还写了一篇煽情的文字给两位同志,ms很有效果。

9点回寝,执笔给高中老师写了一封信,兑现自己之前的一个承诺,总结了下自己的过去,展望下未来。mm说,“是否工作疲惫,生活劳累,这时候停下脚步,回头看看自己走过的路,又会充满前行的动力”。也对的。明天早起写完两天报告,补补课。后天去zjg做一个单车入门讲座。实验室学长给我短信,说有个项目,需要连续奋斗二十天,问我是否有意。我还在犹豫,恐怕不得安排。要看的lpi,要补的课,要刷的zoj题目,反正,总算进入学期正轨了。

加油吧。奋斗的日子。再这样下去,每天日照三杆,恐怕不行。以后恐怕要以实验室和图书馆为家了。Knuth说,程序就像蓝色的诗歌,本人东施效颦,以代码格式贴上这首歌:

《我们都站在雨中》---- 《连城诀》主题曲

把双眼紧闭,剑要往哪里刺去
谁说秋风最能懂落叶思绪
致命的一击,真的对手是自己
只剩下了无声的叹息

酒逢知己,千杯也难尽兴
英雄醉了也一样会慢慢倒下去
望星辰转移,江湖又下起暴雨
我们都站在雨里
穿过刀光剑影之后,我还是那个我
只是把受伤的心独自对着明月说
天涯的尽头有没有一处安静的角落
让浪迹的人在走累的时候躲一躲

安。

conky

Conky is a free, light-weight system monitor for X, that displays any information on your desktop. Conky is licensed under the GPL and runs on Linux and BSD.

Features

Conky has more than 300 built in objects, including support for:

  • a plethora of OS stats (uname, uptime, CPU usage, mem usage, disk usage, "top" like process stats, and network monitoring, just to name a few)
  • built in IMAP and POP3 support
  • built in support for many popular music players (MPD, XMMS2, BMPx, Audacious)
  • can be extended using built in Lua support, or any of your own scripts and programs (tell me more!)
  • built in Imlib2 and Cairo bindings for arbitrary drawing with Lua (tell me more!)

... and much much more.

Conky can display this info either as text, or using simple progress bars and graph widgets, with different fonts and colours.

Installation

In gentoo, it is very simple to install a software, just emerge what you want. But before you really do it, try -pv options to see what will be installed and make your own choice:

Calculating dependencies... done!
[ebuild   R   ] app-admin/conky-1.7.2-r2  USE="X alsa apcupsd imlib portmon truetype vim-syntax weather-xoap -audacious -curl -debug -eve -hddtemp -iostats -lua -lua-cairo -lua-imlib -math -moc -mpd -nano-syntax -nvidia -rss -thinkpad -weather-metar -wifi" 0 kB

For example, if you use moc as a console music player you must add moc USE. What is  USE? Refer to gentoo handbook.

For archlinux, just type "pacman -S conky" and for ubuntu and deb, maybe "apt-get install conky". Refer to your system handbook.

Cofiguration

Usually there is a sample configuration file located in /etc. My file is /etc/conky/conky.conf, just copy this file into your home diretory and rename it to .conkyrc:

sudo cp /etc/conky/conky.conf ~/.conkyrc

then let conky startup with the system.  If you use startx, add this line to your ~/.xinitrc

conky -d 

-d means conky would run as a daemon process.

If you use a desktop environment such as gnome or kde, use the graphical tools, easy job.

And if you feel disappointed about the ugly default configuration, you can configure it by yourself. First you should refer to the man page to know some details about the configuration grammer and configuration choices. Then, I think you'd better refer to google to download a sample .conkyrc and modify it. Here is a sample configuration file:

########## basic configuration ##########
use_spacer right
use_xft yes
font Comic Sans MS:size=9
xftfont Comic Sans MS:size=9
override_utf8_locale yes
update_interval 1.0
own_window no
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 206 5
maximum_width 400
draw_shades yes
draw_outline yes
draw_borders no
draw_graph_borders yes
default_color 00ffe1
default_shade_color ffffff
default_outline_color 000000
alignment top_right
gap_x 10
gap_y 10
cpu_avg_samples 2
uppercase no # set to yes if you want all text to be in uppercase

# predefined color for title
color0 5511dd
# predefined color for hr line
color1 ffd700
# predefined color for graph_bar
color2 ff00ff
# predefined color for any use
color5 ffaa00
color6 b5ff00
########## basic configuration end ##########


TEXT
########## time ##########

${font Comic Sans MS:style=Bold:pixelsize=40}${alignc}${time %H:%M:%S}${font}
${color1}${stippled_hr}${font}$color
#
########## system information ##########
#
OS: $alignr${color}$sysname $kernel${color}
Uptime: $alignr$uptime
Processes:${alignr}$processes ($running_processes running)
#
########## CPU information ##########
#
${cpugraph cpu1 00FF00 FF0000}${cpugraph cpu1}${alignr}
${cpugraph cpu2 0000FF 00FF00}${cpugraph cpu2}${alignr}
# CPU frequency information
# ${color #00FFE1}CPU Frequency: ${color #00ff00}${alignr}${freq 0} MHz
#
########## processes information ##########
#
${font Comic Sans MS:size=14}${color0}Processes ${color1}${stippled_hr 1}$font$color
${color}Highest CPU $alignr CPU% MEM%${color5}
${top name 1}$alignr${top cpu 1}   ${top mem 1}
${top name 2}$alignr${top cpu 2}   ${top mem 2}
${top name 3}$alignr${top cpu 3}   ${top mem 3}
${top name 4}$alignr${top cpu 4}   ${top mem 4}
${top name 5}$alignr${top cpu 5}   ${top mem 5}
${color}Highest MEM $alignr CPU% MEM%${color6}
${top_mem name 1}$alignr${top_mem cpu 1}   ${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}   ${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}   ${top_mem mem 3}
#
########## ram and disk usage ##########
#
${font Comic Sans MS:size=14}${color0}RAM and Disk ${color1}${stippled_hr 1}$font$color
${color}RAM:${color #4169e1}$alignr ${color}$mem ${color #98c2c7}/${color}$memmax${color #4169e1}${color #FF3500} $memperc%
${color2}${membar}
${color}Root: ${color}${alignr}${fs_free /} / ${fs_size /}
${color2}${fs_bar 4 /}
${color}Home: ${color}${alignr}${fs_free /home} / ${fs_size /home}
${color2}${fs_bar 4 /home}
#
########## networking information ##########
#
${font Comic Sans MS:regular:size=14}${color0}NetWorking ${color1}${stippled_hr 1}$font$color
${color}Down:${color} ${downspeed eth0} k/s ${alignr}${color #00FFE1}Up:${color} ${upspeed eth0} k/s
${downspeedgraph eth0 20,115 556B2F 9ACD32}${alignr}${upspeedgraph eth0 20,115 556B2F 9ACD32}
${color}Totat: ${totaldown eth0}${alignr} Total: ${totalup eth0}$color

The grammer is simple, the first part is some basic settings, the second part is the content to show. But the grammer itself is not elegant, to second part is similar to markup language, ${font}${color}Something${color}${font}, just like this, but not so good.

And the following is the result:

Not bad. Enjoy it.

且听风吟

朴树 - 且听风吟
作词:朴树
作曲:朴树
编曲:张亚东


突然落下的夜晚
灯火已隔世般阑珊
昨天已经去得很远
我的窗前已模糊一片
大风声  像没发生  太多的记忆
又怎样放开我的手
怕你说  那些被风吹起的日子
在深夜收紧我的心

日子快消失了一半
那些梦又怎能做完
你还在拼命的追赶
这条路究竟是要去哪儿
大风声  像没发生  太多的记忆
又怎样放开我的手
怕你说  那些被风吹起的日子
在深夜收紧我的心
哎呀
时光真疯狂
我一路执迷与匆忙
依稀悲伤
来不及遗忘
只有待风将她埋葬
咿呀  咿呀
待风将她埋葬
咿呀  咿呀
待风将她埋葬
咿呀  咿呀
我们曾在路上
咿呀  咿呀
待风将她埋葬

gentoo-fvwm-crystal

gentoo系统基本完成,各项功能基本齐全完备,安装过程先后解决了内核编译、Xorg、显卡驱动、USE使用、gentoolkits使用、overlay和layman、网络vpn连接、字体美化、wm管理器定制、alsa配置、中文乱码、ibus输入法和emacs冲突、texlive和xecjk配置等诸多问题。收获很大,对linux体系结构加深了理解。有机会有时间一定总结一下,写个笔记,题目就定为《效率之上——打造完美Gentoo工作站》。

晚上简单配置了synaptics touchpad,实现了Mac多点触摸的部分功能,唯一不足就是外置无线网卡驱动搞不定。暂时放下。

承诺一周完成的文档到现在还没有完成,于心有愧。今天通宵加上明天白天,一定弄出个模子来。

另外今天很窘的一件事是听音乐的时候我发现人声效果很差但是伴奏却依然完美,搞得我以为是alsa没有配置好和amarok的equalizer没有弄好。后来回到寝室换了个耳机就好了。于是上网百度“耳机 人声”方知原委在于耳机接口接触不良,汗啊汗……

zoj 1057

编程还是很菜。很简单的题,基本的输入输出格式弄了很久。没脸见人了。zoj的选拔标准有变,我看能否在两个月之内拿下三百道题。还得把lpi考掉,恐怕要顺延到暑假了。加油加油。

晚上的计算机体系结构实验搞的很崩溃,硬件的课程,该怎么办呢。也不知道对自己以后能有多大的帮助,目前策略是得过且过……组了个队,同组的竟然是个04级的,令我颇为差异。看来,计算机的毕业也不是那么简单。

is-programmer博客系统越来越强大了。最近加入的代码高亮真的是非常的棒!赞!

顺便,86版五笔初有小成,逐渐转移到五笔输入法,效率之上的生活! 

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
    int cases;

    const int max_size = 20;

    int a[max_size];
    int b[max_size];

    int sum_a;
    int sum_b;

    int times = 0;
    while (cin >> cases)
    {
        if (cases == 0)
        {
            break;
        }
        else
        {
            times++;
            
            if (times >= 2)
            {
                cout << endl << endl;
            }
        }
        
        sum_a = sum_b = 0;

        for (int i = 0; i < cases; ++i)
        {
            cin >> a[i];
        }

        for (int i = 0; i < cases; ++i)
        {
            cin >> b[i];
        }

        for (int i = 0; i < cases; ++i)
        {
            if (a[i] == 1 && b[i] == 2)
            {
                sum_a += 6;
            }
            else if (a[i] == 2 && b[i] == 1)
            {
                sum_b += 6;
            }
            else if (a[i] - b[i] == 1)
            {
                sum_b += a[i] + b[i];
            }
            else if (b[i] - a[i] == 1)
            {
                sum_a += a[i] + b[i];
            }
            else if (a[i] - b[i] >= 2)
            {
                sum_a += a[i];
            }
            else if (b[i] - a[i] >= 2)
            {
                sum_b += b[i];
            }
            else;
        }

        cout << "A has " << sum_a << " points. B has " << sum_b << " points.";
    }

    return 0;
}

 




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee