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