crazy

Posted in 娱乐 | Leave a comment

linux 下配置ip的方法

linux下主要有两个网络配置命令,

ifconfig

route

设定固定ip

ifconfig wlan0 192.168.0.139 netmask 255.255.255.0

设定默认网关

route add default gw 192.168.0.10

设定dns服务器

vim /etc/resolv.conf

nameserver 8.8.8.8

如此可以设定一个包含了 本地ip,子网掩码,默认网关,dns服务器的 网络配置。

Posted in linux | Leave a comment

今天犯的几个错误

1、把宏写错,宏的写法是 #define MAX 100

无等号,结尾无分号,宏替换间有空格

2、for()中的各条件是用分号隔开 for(i = 0; i < MAX; i ++)

***************************************************************

写自己的库的方法

一般为同名的 .c .h文件,

.h中存储函数原型,

.c中是函数的具体实现

更具体的需参考 《the art and science of c》

Posted in c | Leave a comment

include<> and include”"

c program 中,包含header file 有两种方式,

include<foo.h>

include"foo.h"

差别在于,

include<foo.h> says look for it where all the header files are normally "installed" on the platform,

include"foo.h" is used for those you provide yourself typically

当需要指定一个预编译的头文件时,可以用 -l 参数。

当写好源文件后,比如说, foo.c foo.h 那么在编译的时候,当使用include"foo.h"表明,foo.c foo.h放在同一个目录下。

gcc – g -W foo.c -o foo

如果 foo.h没有和foo.c放在同一个目录下,需要 -I(大写的i)参数指定foo.h的位置,

gcc -g -W -I headerdir foo.c -o foo

Posted in linux, 软件 | Leave a comment

记录一下matlab 2011a的安装过程

挂载iso

sudo mkdir /media/iso

sudo mount -o loop matlab.iso /media/iso

cd /media/iso

./install

安装完毕后,修改字体,使中文显示不再是方框。

mkdir /$PATH/MATLAB/R2011a/sys/java/jre/glnx86/jre/lib/fonts/fallback

此处目录名字必须时 fallback,不然会蛋疼。

复制中文字体到这里

mkfontscale

chmod +w ../fonts.dir

mkfontdir

大功告成,现在中文显示正常了,

添加启动按钮,不用每次都要进入shell去运行

/$PATH/MATLAB/R2011a/bin/matlab -desktop

这样就可以点击图标来运行matlab了,

一个简洁的(装b的用法,在终端输入 matlab -nojvm -nosplash)

Posted in linux, math, 软件 | 2 Comments