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

scrot 截图脚本第三期,让兲朝淫不再被imgur鄙视

突然发现imgur.com无法使用匿名api上传图片了,提示是

we’re really sorry,but anonymous uploading in your country has been disabled,please register for an account and try anain.

看到这个消息真是泪流满面啊,不过这点小事怎么挡得住贫僧的智慧呢。

因为anonymous api使用的是curl上传图片的,几经辗转,想到用proxy来解决这个问题,结果果然解决了。

cURL真的很强大,proxy都支持很多的形式。

在我的脚本前面加一句

curl –socks5-hostname 127.0.0.1:7070

这样设置后,就可以通过代理来继续上传图片了。

不得不说一句,ownssh.com 的代理服务现在是做的越来越好了,速度也越来越快了,客服也很起作用。

关于ownssh卖的ssh的更多情况,请参考:http://www.leyle.com/archives/361156

http://www.leyle.com/myfile/shot.sh

另存为这个脚本就行了,oyes。

关于给截图脚本绑定快捷键可以参考:http://www.leyle.com/archives/351001

Posted in linux, 脚本 | Leave a comment

thinkpad x201 ubuntu 10.04 使用小红点 tracepoint 滚动网页

参考:http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint#GPointing_Device_Settings

在ubuntu 10.04中,会出现自己的配置在重启机器后被还原为默认的情况,所以,使用ubuntu 10.04的时候,需要写死配置,

方法:

Create the file /usr/lib/X11/xorg.conf.d/20-thinkpad.conf as root with the following content:

Section "InputClass"

Identifier "Trackpoint Wheel Emulation"

MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"

MatchDevicePath "/dev/input/event*"

Option "EmulateWheel" "true"

Option "EmulateWheelButton" "2"

Option "Emulate3Buttons" "false"

Option "XAxisMapping" "6 7"

Option "YAxisMapping" "4 5"

EndSection

用root用户创建一个 /usr/lib/X11/xorg.conf.d/20-thinkpad.conf 文件,然后填写进去上面的内容,重启机器,好了,可以使用了。和windows下的小红点滚动网页的行为是一样的。

为避免出现上述内容的符号被转义的情况,若要复制上述内容,请参考这里

http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint#xorg.conf.d

Posted in linux | Leave a comment

freerdp,linux下远程连接windows的好软件,比rdesktop好一百倍阿。

rdesktop 连接windows机器太慢了,鼠标移动都在卡,一直想找一个好用的不卡的软件,

偶然在ubuntu-cn 的irc里面听说了freerdp,编译安装后,果然好用,现在记录下来。

官方网站:http://www.freerdp.com/

官方HOW TO:http://www.freerdp.com/wiki/doku.php?id=documentation:userdocs:xfreerdp_howto

我使用到的命令是:

xfreerdp -u administrator -p 123 -f –plugin rdpdr –data disk:administrator:/media/folder — 172.14.2.101

功能说明:

1、连接机器ip地址是 172.14.2.101,

2、登录远程机的账户密码是:-u administrator -p 123

3、使用全屏浏览: -f

4、把本地的/media/folder目录共享给远程机,

其中disk:后面先接远程机的用户名,然后才是本地目录路径:

–plugin rdpdr –data disk:administrator:/media/folder

注意的事项:

1、从远程机的全屏切换回来的快捷键是:ctrl+alt+enter

2、在挂载了共享给远程机的目录后,远程机的ip地址前面有一个空格,然后才是双短横 — ,而其他地方的双短横都是紧接命令的。

3、为了不每次输入这么长的一段命令,可以写入.bashrc中,alias myconn=’command’

4、更多的使用方法,请参考官方文档。

5、文中的命令被博客模板进行了转义,字符会出现不一样,若要使用文中的命令,请手动输入。

Posted in linux, 软件 | Leave a comment