Sunday, October 12, 2008

MAC上播放APE,FLAC等无损音乐工具(转)

ToolPlayer & cog & play (MAC上播放APE,FLAC等无损音乐工具)(转)
Cog
一款优秀的音乐播放器。在mac上,大家一般都用iTunes来听音乐,iTunes确实优秀,但就是支持的音乐格式少了些。Cog完全可以作为iTunes的互补软件来使用,它虽然不能播放MP3,但可以播放.ape和.flac等等格式的音乐文件。

toolplayer
一款小巧简洁的音乐播放器,支持一些如 FLAC, MP3, AAC, OGG, Apple Lossless, AIFF, WAV, IT, MOD, XM 等格式,同时包含许多效果,如音调切换、回音…等等。
您要播放FLAC, OGG, MOD…等等吗?试试 ToolPlayer。

play
Play。这个名字没个性的播放软件不仅只是可以放APE和Mp3那么简单,他的管方网站上说他除了可以放上述两种之外还可以播放FLAC, Ogg (Vorbis), Ogg (FLAC), Musepack, WavPack, AAC, Apple Lossless等等。
播放界面相当简单易用,很容易上手。

Saturday, September 13, 2008

[Intel]性能无损运行Windows程序,Darwine配置教程(转载)

转载来源:麦客孤独 帖子

Darwine源于Wine项目,该项目为UNIX提供运行Windows程序的环境。
装好Darwine后插入已染毒的U盘并不会使Mac中毒,但是不要双击病毒文件,它可能真的会运行,比如“熊猫烧香”可以很好的运行,但是不用担心,UNIX构架会保护你的系统不会有太大损害。

首先下载Darwine,去下面的网址下载Darwine:
http://www.kronenberg.org/darwine/
有两个,一个是稳定版1.0,一个是不稳定版1.1.2,建议下载1.1.2,因为以我对Wine的一向了解,不管是哪一个版本,Wine的bug就没少过。
Tiger还要注意安装x11。

下载后将Darwine整个文件夹拖到Applications里。
下面进行设置:
进入Darwine文件夹里的Sample WineLib Applications文件夹,双击运行winecfg.exe,这个程序会自动建立你的Wine环境,这一步是必须做的;完成后你的主文件夹里会多出一个文件夹:.wine,但因为是隐藏文件夹,你看不见,请打开主文件夹,在Finder菜单中选择“前往”,“前往文件夹”,手动输入.wine就能进入了。
这里你会看到一个driver_c文件夹,这就是虚拟出来的C盘,双击进入。

刚才你也许注意到了,winecfg.exe程序上的内容都是乱码,这是因为缺少中文字体,我们需要从Windows下拷贝微软雅黑字体(MSYH.TTF MSYHBD.TTF,下载见帖子后面,字体有版权)到当前文件夹->Windows->Fonts中,打开终端:输入

然后复制以下内容到终端:
REGEDIT4 

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial"="Microsoft YaHei" 
"Arial CE,238"="Microsoft YaHei" 
"Arial CYR,204"="Microsoft YaHei" 
"Arial Greek,161"="Microsoft YaHei" 
"Arial TUR,162"="Microsoft YaHei" 
"Courier New"="Microsoft YaHei" 
"Courier New CE,238"="Microsoft YaHei" 
"Courier New CYR,204"="Microsoft YaHei" 
"Courier New Greek,161"="Microsoft YaHei" 
"Courier New TUR,162"="Microsoft YaHei" 
"FixedSys"="Microsoft YaHei" 
"Helv"="Microsoft YaHei" 
"Helvetica"="Microsoft YaHei" 
"MS Sans Serif"="Microsoft YaHei" 
"MS Shell Dlg"="Microsoft YaHei" 
"MS Shell Dlg 2"="Microsoft YaHei" 
"System"="Microsoft YaHei" 
"Tahoma"="Microsoft YaHei" 
"Times"="Microsoft YaHei" 
"Times New Roman CE,238"="Microsoft YaHei" 
"Times New Roman CYR,204"="Microsoft YaHei" 
"Times New Roman Greek,161"="Microsoft YaHei" 
"Times New Roman TUR,162"="Microsoft YaHei" 
"Tms Rmn"="Microsoft YaHei"

按下control+d结束输入进程,关闭终端。
然后双击windows文件夹中的regedit.exe,导入主文件夹下的cn.reg。

再次运行winecfg.exe,此时中文字体就能看见了,关于Darwine可能是会显示繁体中文的问题,大家不用担心,并不影响简体中文软件的使用。

关于装好的软件会找不到快捷方式的问题,这里有一个解决方法:
编写脚本,例如WinRAR,所在文件夹是~/.wine/drive_c/Program\ Files/WinRAR/,那么编写脚本是这样的:

#! /bin/bash
env WINEPREFIX=~/.wine/ /Applications/Darwine/Wine.bundle/Contents/bin/wine "c:\Program Files\WinRAR\WinRAR.exe"
exit 0

文本编辑器似乎无法编写纯文本文件,请使用cat、vi或nano(都是终端程序)编写,写好后放在桌面,如上面的例子,生成的脚本叫做WinRAR。
请打开终端:输入chmod 755 (不回车,后有空格),将脚本拖入终端,回车,脚本就可以双击运行了。

微软雅黑字体下载:
Part1:http://www.mediafire.com/?kkqaa4io1ah

C语言中,fpritf(), fscanf() 文件格式化读取

PS: double 双精度数浮点数的格式输入输出用 “%lf”


看下面一段code,fscanf()格式里\n 没有,就会出现重复读取的错误。


#include "test.h"

#include

#include

#include


int main(){


FILE *in;

int i,j=0;

char a='a';

int b1,b2,c;


in=fopen("in.dat","w+");

for(i=0;i<5;i++){

j+=8;

fprintf(in,"%c %d %d %d\n",a,i,i+1,j);

}

rewind(in);


for(i=0;i<5;i++){

fscanf(in,"%c %d %d %d\n",&a,&b1,&b2,&c);

 printf("get i=%d : %c %d %d %d\n",i,a,b1,b2,c);

}

fclose(in);

 printf("--------------------------------\n");

in=fopen("in.dat","r");

i=0;

while(1){

 if(fscanf(in,"%c %d %d %d",&a,&b1,&b2,&c)<=0) break;

 else{

 printf("get i=%d : %c %d %d %d\n",i,a,b1,b2,c);

 i++;}

}

fclose(in);

return 0;

}


[Session started at 2008-09-12 23:02:33 +0200.]

get i=0 : a 0 1 8

get i=1 : a 1 2 16

get i=2 : a 2 3 24

get i=3 : a 3 4 32

get i=4 : a 4 5 40

--------------------------------

get i=0 : a 0 1 8

get i=1 : 

 0 1 8

get i=2 : a 1 2 16

get i=3 : 

 1 2 16

get i=4 : a 2 3 24

get i=5 : 

 2 3 24

get i=6 : a 3 4 32

get i=7 : 

 3 4 32

get i=8 : a 4 5 40

get i=9 : 

 4 5 40

Thursday, September 11, 2008

ICHAT登录校内通的方法(转载)

首先启动ICHAT,进入ICHAT偏好设置。左下角新建一个帐户(+)帐户类型选择 Jabber 帐户

帐户名为 校内ID@talk.xiaonei.com
密码为 校内密码
服务器选项--> 服务器 talk.xiaonei.com
完成
此时ICHAT会尝试登录校内通,提示不被信任的证书。点显示证书,将总是信任此证书勾选上,输入密码即可。
之后ICHAT便可顺畅登录校内通了!还可正常显示新鲜事噢~~


关于校内ID,可以进自己的个人主页,网址中的最后几位数字就是你的校内ID!
支持 XMPP(Jabber)的服务器都可以登录。

Wednesday, September 3, 2008

Bring Back Tiger's X11 to Leopard in 3 Steps (ZZ)

The original article is here "Bring Back Tiger's X11 to Leopard in 3 Steps"
   (Discovered by Tim Baur and reported on the x11-users mailing list).

Mac OS 10.5 (Leopard) ships with a very broken version of X11. It's totally unusable for anyone (like me) who spends a significant portion of their day in X11.

The good news is you can get the version of X11 from Tiger to run on Leopard. Here's how you do it:

Step 1: First you need to remove the new and crappy version of X11. I did this with the following commands in the terminal:
sudo rm /System/Library/LaunchAgents/org.x.X11.plist 
sudo rm /Library/Receipts/X11User.pkg 
sudo pkgutil --forget com.apple.pkg.X11User # UPDATE [2007/10/29]: I forgot to include this in the original steps.
Note: X11User.pkg may not exist in /Library/Receipts. That's OK.

Step 2: Install Tiger's X11.app. If you have your Mac's installer CDs, the package you need to double-click the file X11User.pkg found inside System/Installation/Packages/ on the installer CD.
Note: There are lots of versions of X11.app for Tiger. The original Tiger CD ships with one that was PPC only, which I accidentally installed when I did this the first time. If you have a recent Installer CD that came with your mac, I would use that. Otherwise, it appears you can download it here, but I haven't tried that.

Step 3: The final step is to edit the file /etc/X11/xinit/xinitrc and go to the bottom of the file and replace "exec quartz-wm" with "exec /usr/X11R6/bin/quartz-wm".

That's it! Now X11.app doesn't suck as bad anymore.

Monday, September 1, 2008

Livestation----Mac 上面的网络卫星电视

前一阵,奥运火热,虽然身在异乡,但是一直很关注,想方设法看网络直播,因为用的是mac,早就抛弃IE,好多网络直播都没办法看,给我希望就是利用Darwine安装Tvants,然后结合VLC播放(参考Tvants on Mac OS X 10.4),虽然不支持中文,但是至少能分辨CCTV5,呵呵,不错,不过步骤好像比较麻烦。

现在容重推出Livestationmac上的网络电视,来自麦客孤独的推荐,转载文章挺麻烦,来到这里的朋友还是直接点击看论坛的文章,需要先在软件网站注册,才能使用,我这里只放了注册和下载软件的连接。

注册地址:http://www.livestation.com/account/login
下载地址:http://www.livestation.com/releases/Livestation-2.0.13.dmg

Thursday, August 28, 2008

Macports on Leopard

As a student, to buy softwares is not what I can afford, and I don’t like to search and use the crack version of the commercial software. Open source software project in UNIX world is really good for me. I believe that Mac OS is UNIX based operating system, so I want to make my macbook with leopard os well compatible with open source projects.
Just as any Unix system, an easy to use system for compiling ,installing, and upgrading open-source software in your operating system is really necessary to open source fans. There are in fact two different projects doing this for Mac OS X. One is called MacPorts (upgraded from the old Darwinports), and the other is Fink.
There are some discussions about “Darwinports vs Fink”- which is better? I didn’t do much research , but I think Macports community is more active then Fink. So Macprot becomes my choice.
There is no trick during installing Macports on Leopard, as there is a simple .dmg file on the official website of the Macports. And the guide on the website should be enough for your to get start.

Saturday, August 23, 2008

Blogger如何贴代码框?(ZZ)

其实很简单,就是先要在你的模板中加入一个CSS代码。

Step1:进入到 控制台-模板-修改HTML ,“扩展窗口小部件模板” 前不用打勾。在模板内容里找到下面这段代码,你可以通过按Ctrl+F搜索“skin”两次找到



]] ></b:skin>
</head>

然后将下面的代码段拷贝加到上面代码的前面,就是那两个中括号前面



CODE {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 8pt;
overflow:auto;
background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
max-height:200px;
line-height: 1.2em;
}


Step2:在Html模式下,把文章中将要引用的代码前后分别用<code> 和 包起来,这样就可以显示成代码框了。 需要注意的是如果引用的程序中含有<> 括号,要把"<"用双/单引号括起或者&lt代替,“>”用双/单引号括起或者&gt代替,不然<>的内容就会被Blogger的编辑器当成代码执行而不显示。

[来源百度知道]

Wednesday, August 20, 2008

Mac Tip: Add Quit to the Finder Menu (zz)


Finder.pngMac OS X only: Sick of not being able to exit Finder? A quick terminal command will add a "quit" option to the menu in Finder. This means you can run Finder like any other Mac application. If you're running some heavy applications, simply close Finder and enjoy the extra, albeit small, processing power. Open a terminal and enter the following command:



defaults write com.apple.Finder QuitMenuItem 1


You will need to restart for the changes to take effect. Here's the caveat: Finder also manages the icons on your desktop. If you exit Finder, you won't be able to see any of the icons on your desktop. Just click the icon in the dock to bring Finder back.

Tuesday, August 19, 2008

C语言全局变量和局部变量(zz)

转载来源

引子---
        变量可以在程序中三个地方说明: 函数内部、函数的参数定义中或所有的函数外部。根据所定义位置的不同, 变量可分为局部变量、形式参数和全程变量。从空间角度来看,变量可以分为全局变量和局部变量,而从时间角度来分的 可以有静态存储变量和动态存储变量之分。

一。全局变量和局部变量

1。局部变量

他是 指在函数内部定义的变量 作用域为定义局部变量的函数 也就是说他只能在定义他的函数中使用

最值得注意的是 只有在程序执行到定义他的模块时才能生成,一旦执行退出该模块则起变量消失

eg.

func ()

{
   int x;   局部变量x的作用域 很明确
   ......
}


2。全局变量

在程序执行的过程中一直有效

eg.

int x=1;

func ()

{
   x=x+1;

}

func1 ()

{
  x=x-1;

}

main ()

{

}
由此不难看出整型x的作用范围


对于全局变量 如果在定义的时候不做初始化 则系统将自动为起赋值 数值型为0

字符型为空'\0'

全局变量的弊端 增加内存开销 降低函数的通用性

定义全局变量时 理想的位置是在文件的开头 当这些函数以及同一个程序中的其他源程序文件中的某些函数需要使用该全局变量时 在函数内部对该变量使用extern 加以说明 说明他是外部的 

(这里还要做详细的讲解)

eg.

main ()

{
extern int a,b;
printf ("mIn is %d\n",min(a,b));
}

int a=1,b=2;
int min (x,y)
int x,y;
{
int z;
z=x"<"y?x:y;


我还要说明的是 对外部变量的说明和对全局变量的定义不是一回事

对外部变量的说明 只是声明该变量是在外部定义过的一个全局变量 在这里引用 而对全局变量的定义则是要对起分配存储单元的

一个全局变量只能定义一次 可是却可以多次引用

*** 在同一源文件中,全局变量和局部变量同名时,在局部变量的作用域内,全局变量不起作用的。


二。静态存储变量和动态存储变量

对于程序运行期间根据需要进行临时动态分配存储空间的变量 为动态存储变量

对于那些程序运行期间永久占用固定内存的变量 称为静态存储变量


还要说明的是 程序的指令代码是存放在程序代码区的 静态存储变量是存放在静态数据区的 包括全局变量等 而程序中的动态存储变量存放在动态数据区 如函数的形参以及函数调用时的返回地址等

 


三。C语言中的变量存储分类指定
    
    auto 
    auto称为自动变量 如果函数不做其他说明的话 均为自动变量


    static 
    static称为静态变量。根据变量的类型可以分为静态局部变量和静态全程变量。 
    1. 静态局部变量 
    

     它与局部变量的区别在于: 在函数退出时, 这个变量始终存在, 但不能被其它函数使用, 当再次进入该函数时, 将保存上次的结果。其它与局部变量一样。 
    

    2. 静态全程变量 
    

     Turbo C2.0允许将大型程序分成若干独立模块文件分别编译, 然后将所有模块的目标文件连接在一起, 从而提高编译速度, 同时也便于软件的管理和维护。静态全程变量就是指只在定义它的源文件中可见而在其它源文件中不可见的变量。它与全程变量的区别是: 全程变量可以再说明为外部变量(extern), 被其它源文件使用, 而静态全程变量却不能再被说明为外部的, 即只能被所在的源文件使用。 
   
   
    extern 
    extern称为外部变量。为了使变量除了在定义它的源文件中可以使用外, 还要被其它文件使用。因此,   必须将全程变量通知每一个程序模块文件,   此时可用extern来说明。 


eg. 


        文件1为file1.c                  文件2为file2.c 
    int i, j;/*定义全程变量*/        extern int i, j;/*说明将i, j从 
                                                     文件1中复制过来*/ 
    char c;                          extern char c; /*将c复制过来*/ 
    void func1(int k);               func2()        /*用户定义函数*/ 
                                     { 
    main()                              static float k;/*定义静态变量*/ 
    {                                   i=j*5/100; 
          func1(20);/*调用函数*/        k=i/1.5; 
          func2();                           . 
          .                                  . 
          .                                  . 
          .                            } 
     } 
     func1(int k) /*用户定义函数*/ 
     { 
          j=k*100; 
     } 

    对于以上两个文件file1.c和file2.c, 用Turbo C2.0的集成开发环境进行编译 
连接时, 首先应建立一个.prj的文件。例如file.prj, 该文件内容如下: 
     file1.c 
     file2.c 
    然后将file.prj的文件名写入主菜单Project中的Project Name项中。 再用F9 
编译连接, 就可产生一个文件名为fioe.exe的可执行文件。 
     
  

    register 
    register称为寄存器变量。它只能用于整型和字符型变量。定义符register说明的变量被Turbo C2.0存储在CPU的寄存器中,  而不是象普通的变量那样存储在内存中, 这样可以提高运算速度。但是Turbo C2.0只允许同时定义两个寄存器变量,一旦超过两个, 编译程序会自动地将超过限制数目的寄存器变量当作非寄存器变量来处理。因此, 寄存器变量常用在同一变量名频繁出现的地方。 
    另外, 寄存器变量只适用于局部变量和函数的形式参数, 它属于auto型变量, 
因此, 不能用作全程变量。定义一个整型寄存器变量可写成: 
      register int a; 
    对于以上所介绍的变量类型和变量存储类型将会在以后的学习中, 通过例行程序中的定义、使用来逐渐加深理解。

Saturday, August 9, 2008

Monday, August 4, 2008

Saturday, August 2, 2008

MacSword--Bible study software for Mac OS X

MacSword

A free software  for bible studying,  to search and quote useful words from the bible.
I installed for the first time, aim to learn the bible.

Monday, June 16, 2008

How to enable wireless under Fedora 8

Using Linux system, although you are not a computer developer, you always need DIY to make your operating system more personalized and more comfortable. However, without internet DIY is not so easy. Where there is a problem, there is a solution, and internet makes it shared .
For the goodness of internet, I need wireless connection.
The problem is wireless may not be enable automatically by NetworkManager under Fedora 8. Depending on which wireless chip card you are using, you need to install wireless driver.
Firstly, get information of your wireless card.
-------------------------------------------------------------------
command line$ lspci | grep Wireless
02:00.0 Network controller: Atheros Communications, Inc. AR5418 802.11a/b/g/n Wireless PCI Express Adapter (rev 01)
-------------------------------------------------------------------
my macbook uses Atheros AR5418 .
Madwifi is a good choice for Atheros chip, but AR5418 in Atheros AR5008 family is not supported in the currently official released version. However, the one built from the trunk works for AR5418.
Here is an article interpreting step by step instructions: "How to checkout and install madwifi experimental driver for AR5008". It works for me!

Todo: how to connected to a selected encrypted Access point ?

Setting static IP on Fedora 8 (zz)

Posted on by matt_cempreng

Setting IP is very important due to able to work in the networking area, such as: file sharing, file printing, remote login, remote administration (or hacking?), etc.

Setting IP in LINUX environment either permanent or temporary is simple. It can be done by few ways, usually by editing directly to the config-file, by using the cmd-tool, or by using the graphical (GUI) tool. Just remember that all changes of the configuration needs root privilege.

Editing the Configuration File

There are files related to the networking system especially related to the IP address of the own host or other hosts. The configuration can be changed by editing the file (that needs root privilege), and then restarting the network service.

1. Editing the file: /etc/sysconfig/network-scripts/ifcfg-eth0

The file: /etc/sysconfig/network-scripts/ifcfg-eth0 contains the information about the configuration of ethernet card (NIC). If the file doesn’t exist, don’t worry because you still can write a new file with the text editor. Just make sure the format is correct. The ‘#’ character will be intepreted as a comment.

The name of the first netwok card is eth0, the second one is eth1, the third eth2, eth3, ….. and so on.

This is the example output of editing the file using ‘nano’ text editor.

ifcfg-eth0

I’ll describe it if you can’t see the picture correctly. Once again, the ‘#’ in the file character will be interpreted as comment, so I’ll use this advantage to explain the file as comments without damaging the config-file itself. Or, if you want just simply copy this text and use it directly after you paste it and save to the /etc/sysconfig/network-scripts/ifcfg-eth0 file to your machine.

Don’t forget to do the administration of the system, you must login as root.


[login@domain path]#nano /etc/sysconfig/network-scripts/ifcfg-eth0

# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0
BOOTPROTO=static
# Refer to basic IP assignment rules
IPADDR=192.168.254.4
NETMASK=255.255.255.0
NETWORK=192.168.254.0
BROADCAST=192.168.254.255
GATEWAY=192.168.254.254
# I really don't enven think about changing this line
# I changed this once and everything messed up
HWADDR=00:17:31:65:98:3B
# Your DNS name
DNS1=202.134.0.155
DNS2=202.134.2.5
# This will bring ethernet card up every booting
ONBOOT=yes
# My NIC type on PCI slot
TYPE=Ethernet

[login@domain path]#_

2. Editing the file: /etc/resolv.conf

The file /etc/resolv.conf contains the information about DNS. This is the resolver’s configuration file. The resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information. Refer to ‘man resolv.conf‘.


[login@domain path]#cat /etc/resolv.conf
search MyDomainName
nameserver 202.134.0.155
nameserver 202.134.2.5
[login@domain path]#_

3. Editing the file: /etc/sysconfig/network

The file /etc/sysconfig/network contains information about gateway, hostname and network connection. This is the example of the file in my Linux Box.


[login@domain path]#cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cempreng.net
[login@domain path]#_

The line: NETWORKING=yes tells wether the computer will connect to the network. If you wish not to join your machine to the network just make change to NETWORKING=no.

The line: HOSTNAME=cempreng.net will gives you the host name of your machine. We can easily make change of our host name by editing this line. Alternatively we can use the command hostname to set the system’s host name. More information refer to ‘man hostname‘.

NOTE:
Don’t forget to restart the network service after the configuration changed. On Fedora system just simply by typing command like this:

[login@domain path]#service network restart
or
[login@domain path]#/etc/rc.d/init.d/network restart

Using Command Line Tool

1. Command Line: ifconfig

Command : ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. If no arguments are given, it displays the status of currently active interfaces. Refer to ‘man ifconfig‘.

Format:

ifconfig [interface]
ifconfig interface [aftype] options | address

ifconfig

This is an example from my machine:


[login@domain path]#ifconfig

eth0 Link encap:Ethernet HWaddr 00:17:31:65:98:3B
inet addr:192.168.254.4 Bcast:192.168.254.255 Mask:255.255.255.0
inet6 addr: fe80::217:31ff:fe65:983b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:186357 errors:0 dropped:0 overruns:0 frame:0
TX packets:127850 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:213616062 (203.7 MiB) TX bytes:14120057 (13.4 MiB)
Interrupt:17 Base address:0x2000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:7787 errors:0 dropped:0 overruns:0 frame:0
TX packets:7787 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2576283 (2.4 MiB) TX bytes:2576283 (2.4 MiB)

[login@domain path]#

As we can see the eth0 is the name of the first ethernet card (NIC). I only have one ethernet card so the name will be eth0, assigned as the first (and the only) one. And so is the lo, it is the loopback connection, usually 127.0.0.1.

A loopback is a communications channel with only one endpoint. Any message transmitted through such a channel is immediately received by the same channel.
From:
http://en.wikipedia.org/wiki/Loopback

To change IP address as desired just follow the syntax of ifconfig. This is an example changing IP address to 192.168.254.3 (C-Class). By default the netmask will be automatically given.


[login@domain path]#ifconfig eth0 inet address 192.168.254.3

2. Command Line: ip

Actually I never use this command line, and I don’t want to write about this one to decrease the risk soo…. please learn it by yourself and please tell me after you mastering this command line.

Using GUI Tool

Alternatively, we can change IP address from GUI tool placed in:
System -> Administration -> Network
or using command
system-config-network by typing on console terminal (such as xterm, gnome-terminal, etc) like this:

[login@domain path]#system-config-network

system-config-network

To make changes, simply highlight the preferred devices and then click on the edit tab. Then the new window will be displayed like this:

system-config-network-edit

On the General tab of that new window, we can edit the configuration as desired. We can set the IP address manually (static IP adress) or automatically by DHCP. And don’t forget to click OK otherwise the changes won’t be saved. The window will be closed and back to Network Configuration window. Save your most recent configuration by clicking File -> Save or either by pressing the shortcut Ctrl+S. It’s so easy, eh…???

Wednesday, June 11, 2008

Mac is back!

My little macbook is back with Leopard and Fedora 8 dual booting .

I tried to install the newly released Fedora 9, but I got a big problem with GNOME desktop missing. I am not a skilled Linuxer, and Fedora 9 is not so stable a version considering for me, so I shifted to Fedora 8. Hope it will gave me a nice experience.

Friday, May 30, 2008

White Macbook dies in blank!

My little while Macbook, with Leopard and Fedora newly intalled, hanged in blank when starting the system in a raing morning. After my last restart, it did not go to my nice rEFT bootloader but in a white screen (actually silver gray, apple style, you know) totally in blank, and later in the middle of the screen came up a gray directory with a question mark on it, flashing!
I was afraid that maybe the package ex2fs i just installed before restarting to access linux partition from mac or my newly made linux partition messed the bootloader up. So I tryed Tiger install disk to reintall a new system to make things visible. But install error, the hfs+ partition had errors and repaire failed. I even did the format and repartitioned the whole disk and still hfts disk remained gray in Disk Utility and undetectable by installer. That's it ! What else I can do? Googling on the internet, one ticket of a forum scared me. It said it is probably a hard disk problem and the Apple is already aware of the problem and there are already some cases about it. It said the most problems macers meet are about the hard disk and the driver. I've alreasy got my superdiver repaired and now it turned to the hard disk? Damn! I am really a lucky dog! Is the Apple really right for me ? Or it is an apple from the witch?
This morning I handed over my macbook to Centro Assitenza "agian". Hope they will fix it for free(under 1 year guarantee).
God Bless!

My ntfs partition revives!!

The ntfs partiton of my removable disk revives ! That is really a good news !
I always got my stuff in troubles. Removable disk and my macbook.
let's talk about the removable disk first. Once it was totally undetectable when pluged to the computer. It was a problem with hardware connection and finnaly fixed by my friend, who opened it and reset up. Now, a few days ago, one of my partions could not be umounted to my macbook. One thing I should mention is that I have 2 partitons in the removable disk:MacJo 30G Hfs+ for mac competibility and Bingo about 90G Ntfs. The last time I mouted and used Bingo was under Leopard and was deleting some huge useless directories. I had problems with Trash, because it hangs when emptying. I could not empty the Trash before unmount the disk. I don't think it is a big problem to umount before empty the trash. But being hanged when trashing is a problem. Then, this Bingo can not be mounted under Fedora, which resulted an error about $MFT, sorry that I can't what exactly (I forget where i recorded the error message). What's more, under Windows Xp system, the disk showed up could not be open. File or directory damaged. It should be a problem with Master File Table.
I got a simple and magical way to fix it . Under windows os, open Run(运行),and enter[chkdisk/j] if your disk is mounted as disk j (it is not important,because anyway you might be got error when checking disk), regardless of those errors and restart you machine with the removable disk pluged . There will be a startup disk check(This must be the key point of the solution, i guess it is using the automatical disk check and repaire when starting up the system). Than, as long as the system is started, we are done! Look, Bingo comes back and you can open it. Maybe just one more directroy name found.0000 is added to you disk. Smile ~ :)
Remember: startup disk check sometime really help!
hints of solution: plug the removable disk to the computer running windows, open Run, input command: chkdisk/j (j is your disk indicator) and enter, regardless of output, remain the removable disk pluged restart the computer, automatically do the disk check ,then start the system and done!
症状:移动硬盘,插上,提示硬盘已连接上并在我的电脑上显示盘符,但是打不开,提示,找不到指定文件或文件夹损坏。
方法:windows系统下,插上移动硬盘,打开运行,输入chkdisk/j (J是移动硬盘挂载的盘符号),不管运行结果怎样,重启电脑,注意这个时候不要拔掉移动硬盘,开始自动运行开机磁盘检测,检测完打开系统,这个时候系统挂载的移动硬盘就已经正常了。

Wednesday, May 21, 2008

人体黑白



以下3图选自:朱洪宇《黑白人体》:




这最后一幅忘记来自哪里了,下自网络收藏很久了。

Tuesday, May 20, 2008

连线杂志10大黑白照片(转载)

连线杂志,wired.com 的黑白照片大赛已经结束,共评选出10幅获奖作品,一个叫 Whiffleboy 的读者的作品 "A Bit Spotty" 最终获得一等奖。时值国难,黑白也许更贴近我们的内心。说明文字属随口敷衍,并无意义。

1. A Bit Spotty - 班驳 (Whiffleboy)

将太阳深埋地下,让它碎成珠玉,一半给世界,一半给中国。


2. Straw Dogs - 刍狗  (Jason Flett)

天地无所谓仁,无所谓不仁, 悲悯只是浩瀚宇宙中的不可言说的孤独。

 

3. Man In the Fog - 雾中人 (David Gordon)

世界无非这样,我们走过来,他们走过去。 

 

4. Running Through - 跑过 (Harrison)

地火在燃烧,5月,我们跳过死亡的幽谷。 

 

5. Wicked Path - 不怀好意的山路 (Shawn Kresal)

路是大地的神经,越是细小的,越敏感,当大地感到疼痛...

 

6.  Girl, Unafraid - 孩子,快跑 (Neil Bernhart)

你不懂这个世界,它非常大,你的一生只够丈量它的半个微笑。 

 

7. Cape Fear - 海之角 (Vilhjalmur Ingi Vilhjalmsson)

没错,上帝只引领,不拯救。 

 

8. Pitty - 贝蒂 (Charline Messa) 

 

 

9. Silhouette - 剪影 (Andrew Scharlott)

你在看我吗,小虎,你这个傻子。 

 

10. Hidden? - 小样 (bushn)

上帝给了它美丽,精致而不堪一击的盔甲。 

 

本文国际来源:http://www.wired.com/culture/art/multimedia/2008/05/gallery_top_10_black_white?slide=1&slideView=4
中文翻译与配文来自:COMSHARP CMS 官方网站。谨以此文纪念5.12地震中遇难的同胞。

Sunday, May 18, 2008

修改Linux操作系统终端提示符(转载)

终端提示符的特征由系统环境变量PS1定义。通过命令``echo $PS1''查看当前设置。

PS1的值由一系列静态文本或\和转义字符序列组成,如:

PS1="\u@\H \w$ "

比较有用的转义序列有:

\e ASCII转义字符

\h 主机名

\H 完整的主机名

\l 终端设备名

\t 24小时制时间

\T 12小时制时间

\u 用户名

\w 当前工作目录(绝对路径)

\W 当前工作目录(basename)

\! 当前命令在历史缓冲区的位置

\$ 如果当前用户是super user,则插入字符#;否则插入字符$

\[ 出现在不移动光标的字符序列之前

\] 出现在非打印字符之后

修改使用命令~ $  export PS1="\u@\H: \w\$" 

总是面对黑低白字的屏幕不免让人生厌,我们可以通过设置PS1变量使提示符成为彩色。在PS1中设置字符序列颜色的格式为:

\[\e[F;Bm\]

其中``F''为字体颜色,编号30~37;``B''为背景色,编号40~47。

可通过``\e[0m''关闭颜色输出;特别的,当B为1时,将显示加亮加粗的文字。

举例Example:

if [ $TERM = 'linux' ]; then
export PS1="[\[\e[36;1m\]\u@\h \[\e[31;1m\]\w\[\e[32;1m\]]> " 
zhcon --utf8 
clear 
elif [ $TERM = "xterm" ]; then 
export PS1="[\[\e[31;1m\]\w\e[0m]>"
 fi -------------------

linux查看硬件信息及驱动设备相关整理(转载)

在LINUX环境开发驱动程序,首先要探测到新硬件,接下来就是开发驱动程序。 
常用命令整理如下: 

用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart) 

查看CPU信息:cat /proc/cpuinfo 

查看板卡信息:cat /proc/pci 

查看PCI信息:lspci (相比cat /proc/pci更直观) 

查看内存信息:cat /proc/meminfo 

查看USB设备:cat /proc/bus/usb/devices 

查看键盘和鼠标:cat /proc/bus/input/devices 

查看系统硬盘信息和使用情况:fdisk & disk - l & df 

查看各设备的中断请求(IRQ):cat /proc/interrupts 

查看系统体系结构:uname -a 

dmidecode查看硬件信息,包括bios、cpu、内存等信息 
dmesg | more 查看硬件信息 

对于“/proc”中文件可使用文件查看命令浏览其内容,文件中包含系统特定信息:
Cpuinfo          主机CPU信息
Dma             主机DMA通道信息
Filesystems       文件系统信息
Interrupts         主机中断信息
Ioprots           主机I/O端口号信息
Meninfo          主机内存信息
Version           Linux内存版本信息

Tuesday, April 8, 2008

咨询公司(来自百度知道)

国际著名咨询公司:
类型1:麦肯西,波士顿,科尔尼,罗兰贝格等,此类公司主要从事战略咨询不作咨询方案的实施和落地。但是近些年随着客户需求的变化,也在逐步做一些咨询方案的实施
类型2:IBM IGS, Accenture(埃森哲,原安达信咨询部门), Bearingpoint(毕博,原毕马威咨询部门),德勤(唯一没有从会计师事务所分离出来的咨询部门),凯捷(原凯捷安永,现在已经和安永华明没有关系)等,这些公司提供咨询意见,并负责实施,通过IT系统的集成把咨询的成果固化于企业的业务中。
类型3:此类咨询公司为企业某个部门提供专业的咨询服务,在人力资源领域著名的咨询公司有美世, 翰威特,华信惠悦,Hay等,市场策略咨询领域著名额咨询公司有Gartner,IDC,Frost Sullivan,Forrester等.

国内公司:
类型1: 新华信, 远卓(已被凯捷收购),远迅(远卓未加入凯捷人员创立),北大纵横
类型2: 汉普(几经异手,元气大伤,风光不在了)
类型3: 人力资源:太和(Fesco背景)
市场:赛迪(信产部背景,品牌已丑), 计世咨询(计算机世界报背景), 易观国际(原Gartner中国合作伙伴,现另立门户)。

另外还有一些公司被成为市场调研公司,算是咨询的傍枝:全球著名的有
AcNielsen, TNS, IPSOS, Synovate等,国内的零点等。

楼上提到的iRearch主要专注于互联网的研究,现在有一定影响力,算是一个市场研究公司,业务模式非常特别。

Monday, March 31, 2008

Boot camp & vm Fision

参考麦客孤独的教程:boot camp和vm fusion 完美合作详细说明,用VM Fusion 启动boot camp 安装的windows。但是在我自己操作中,遇到问题,打开VM后点Boot camp partition不能行windows,出现对话框提示:

Cannot open the disk '/Users/binchen/Library/Application Support/VMware Fusion/Virtual Machines/Boot Camp/%2Fdev%2Fdisk0/Boot Camp partition.vmwarevm/Boot Camp partition.vmdk' or one of the snapshot disks it depends on.

Reason: The partition table on the physical disk has changed since the disk was created. Remove the physical disk from the virtual machine, then add it again.

VM fusion Version 1.1.1 (72241) eng,

Leopard 10.5.2

boot camp 2.0 (分区后安装win用NTFs格式化了)

启动时按option可以选择windows启动,但是在mac的系统设置,启动盘里没有示windows启动


不会弄,于是乎寻找网上,用vmware-rawcreator 手动创建vm导boot camp 分区系统的。(ref:original thread)自己新建一个vm但是启动的是boot camp安装的windows系统,把原来默认的boot camp partition 虚拟机删掉就可以了。


主要操作如下:

  1. In VMWare Fusion, create a new vmware instance called WindowsXp. Under “Settings” for that vm, you can change or add a new IDE hard drive. This will make life easier, since you won’t have to worry about having the right SCSI driver if you are running a minimalistic Linux distro. From the command line, WindowsXp is really a directory called WindowsXP.vmwarevm (yes, vm appears twice in that extension).
  2. Close WindowsXP in VMWare Fusion, so you can edit it directly.
  3. In a terminal:
    1.  cd "/Library/Application Support/VMware Fusion/"
    2. List the partitions on your hard drive. ./vmware-rawdiskCreator print /dev/disk0
    3. Create a file that points VMWare at your partition. (My bootcamp partition is number 3, so that is why you see a 3 in the following command.) ./vmware-rawdiskCreator create /dev/disk0 3  /Users/USERNAME/WindowsXP.vmwarevm/bootcamp_partition ide
  4. Add or edit these lines in the text file /Users/USERNAME/WindowsXP.vmwarevm/WindowsXP.vmx ide0:0.present = "TRUE"     ide0:0.fileName = "bootcamp_partition.vmdk"
  5.  Run WindowsXP in VMWare Fusion. You will be asked for your administrative password, because VMWare Fusion must be granted access to read and write to your bootcamp partition
倒是可以运行windows了,只是原先的问题不知道在哪里,看log文件说disk0不能打开,不懂啊,抓狂!
Link to that log file: vmware.txt


Sunday, March 30, 2008

ccd2iso

ccd2iso------CloneCD image to ISO image file converter!


mac os x 下burn .iso镜像文件倒是方便,不今天碰到CloneCD的镜像,包含.ccd/.img/,sub三个文件,郁闷了,一般需要CloneCD是在windows下的,还有个Toast,看了感觉也比较麻烦,看到这个开源软件ccd2iso简直是眼前一亮啊,赶紧下载,然后按照install说明文件指示:1. ./configrue 2.make 3.make install. 4.make clean. (在root下make install)安装完毕,然后命令:ccd2iso image.img myimage.iso 就ok了,不需要另外两个文件。