随笔分类 - Linux
摘要:在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。分析:这是不同系统编码格式引起的:在windows系统中编辑的.sh文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息。解决:1)在windows下转换:利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。2)也可在Linux中转换:首先要确保文件有可执行权限#root>
阅读全文
摘要:對於使用new動態配置的資源,在不使用時必須記得delete,以釋放記憶體空間,然而動態記憶體配置很容易發生忘了delete,或是對同一個記憶體位址delete兩次(例如一個物件被指定給兩個指標),或是對一個已經被delete的位址再作讀寫動作。C++標準函式庫中提供auto_prt,可以協助您動態管理new而建立的物件,要使用auto_prt,您要含入memory表頭檔,例如:#includeauto_ptr可以指向一個以new建立的物件,當auto_ptr的生命週期結束後,所指向的物件之資源也會被釋放,在建立auto_ptr時必須指定目標物件之型態,例如:auto_ptriPtr (new
阅读全文
摘要:SSH 的详细使用方法如下:ssh [-l login_name] [hostname | user@hostname] [command] ssh[-afgknqtvxCPX246] [-c blowfish | 3des] [-e escape_char] [-iidentity_file] [-l login_name] [-o option] [-p port] [-Lport:host:hostport] [-R port:host:hostport] [hostname |user@hostname] [command]sshd为执行 ssh 的 daemon,在读者使用 ss..
阅读全文
摘要:This article comes from there :http://www.cplusplus.com/reference/stl/vector/VectorVectorsare a kind of sequence container. As such, their elements areordered following a strict linear sequence.Vector containers are implemented as dynamic arrays; Just asregular arrays, vector containers have their e
阅读全文
摘要:Compiling your source code files can be tedious, specially when you want to include several source files and have to type the compiling command everytime you want to do it.Well, I have news for you... Your days of command line compilingare (mostly) over, because YOU will learn how to writeMakefiles.
阅读全文
摘要:deb 是debian linux 的安装格式,跟red hat 的rpm相似安装: dpkg -i file.deb不过要安装dpkg的package,也可用alien这类软件将package转为rpm等格式,或直接下个rpm 或tar包。关于deb包转换成rpm的方法:sudo apt-get install alien #alien默认没有安装,所以首先要安装它。sudo alien xxxx.rpm #将rpm转换位deb,完成后会生成一个同名的xxxx.deb。sudo dpkg -i xxxx.deb #安装。
阅读全文
摘要:may I know the meaning or even how to read this: srandom( time( NULL ))?NULLA null pointer. Zero. Points tonothing.time(NULL)The time function returns the currenttimestamp as an integer. Itaccepts an input argument. If theargument is not null, the current timeis stored in it.srandom(time(NULL))The .
阅读全文
摘要:Linux下stricmp在此作用域中尚未声明解决办法 在使用大小写不敏感函数比较字符串时,很顺手的来了个stricmp,g++编译的时候:错误:‘stricmp’在此作用域中尚未声明。 后来查了一下,stricmp是windows特有的。而linux是strcasecmp,包含在头文件string.h下。问题解决了
阅读全文
摘要:应该怎么读Linux?根据Linus Torvalds的说法,Linux的发音和“Minix”是押韵的。参照,“Li”中“i”的发音类似于“Minix”中“i”的发音,而“nux”中“u”的发音类似于英文单词“profess”中“o”的发音。此外有一份LinusTorvalds本人说话的音频,音频内容为“Hello, this is Linus Torvalds, and I pronounceLinux as Linux”。 大致和“利呢克斯”的音类似(注意不是利纳克斯、利牛克斯、利努克斯或者利尼克斯)。请大家按照['linэks]这个音标读。汉语拼音:[li ne k s]网上有人
阅读全文
摘要:一、时间的类型(1)格林威治标准时间Coordinated Universal Time(UTC)是世界标准时间,即常说的格林威治标准时间(Greenwich MeanTime,GMT). 注:格林威治时间和本地时间不同.(2)日历时间日历时间(Calendar Time)是用"一个标准时间点(如1970年1月1日0点)到此时经过的秒数"来表示的时间.二、时间函数的API 时间函数的API均属于系统调用函数.(1)获取日历时间#include time_t time(time_t*tloc)函数功能:获取日历时间,即从1970年1月1日0点到现在所经历的秒数. 参数:通常设
阅读全文
摘要:alarm(设置信号传送闹钟)相关函数 signal,sleep表头文件#include定义函数 unsigned int alarm(unsigned intseconds);函数说明alarm()用来设置信号SIGALRM在经过参数seconds指定的秒数后传送给目前的进程。如果参数seconds为0,则之前设置的闹钟会被取消,并将剩下的时间返回。返回值返回之前闹钟的剩余秒数,如果之前未设闹钟则返回0。范例#include#includevoid handler() {printf("hello\n");}main(){int i;signal(SIGALRM,hand
阅读全文
摘要:Subversion - A Quick Tutorial Subversionis a version control system that is widely used by many Open Source projects such as Apache and GCC. Subversion started as a project to implement features missing in CVS. Some of these features are:Subversion tracks structure of folders. CVS doesn't have t
阅读全文
摘要:The commands diff and patch form a powerful combination. They are widely used to get differences between original files and updated files in such a way that other people who only have the original files can turn them into the updated files with just a single patch file that contains only the differe
阅读全文
摘要:First, how to create patch file?Patch file is a readable file that created by diff with -c (contextoutput format). It doesn’t matter and if you wanna know more, mandiff. To patch the entire folder of source codes(as usually peopledo)I do as bellow:Assume Original source code at folder Tb01, and late
阅读全文
摘要:FTP ServerFile Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers. FTP works on a client/server model. The server component is called anFTP daemon. It continuously listens for FTP requests from remote clients. When a request is received, it manages the l.
阅读全文
摘要:vsFTPd 服务器初学者指南作者:北南南北,正在修订之中来自:LinuxSir.Org摘要:vsFTPD是一款小巧易用FTP服务器程序;本文面向初学者的一点疑问,能让初学者在最短的时间内学会最简单的vsftpd服务器的架设;本文应该算是初学者练手篇;正在更新之中;本文基于vsftpd-2.0.3;目录1、vsFTPd,目前常用FTP服务器套件;2、ftp用户管理解说;2.1、匿名ftp用户和用户组的理解;2.2、匿名ftp用户和ftp用户组是否可以删除;3、vsFTPd的安装;4、vsFTPd的服务器的启动和关闭;4.1、vsFTPd服务器启动和关闭的通用方法;4.2、在Fedora/Red
阅读全文
摘要:内容简介: 1vi与vim 2vi的使用3vim的功能4vim使用中注意的事项1vi与vimvi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器。由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您可以在其他任何介绍vi的地方进一步了解它。Vi也是Linux中最基本的文本编辑器,学会它后,您将在Linux的世界里畅行无阻。为何要学 vi所有的UnixLike系统都会内建vi文本编辑器,其他的文本编辑器则不一定会存在;一些软件的编辑接口会主动调用vi (例如 crontab,visudo, edquota 等命令);vim 具有程序编辑
阅读全文
摘要:改变Ubuntu桌面所在文件夹不知道我的T61发生什么事情,桌面上的文件夹全部出现在桌面,上网查到这段话,修改了桌面文件夹: 刚安装上Ubuntu11.04的时候,也不懂得怎么修改firefox下载文件保存的位置,默认是在桌面。但下载下来要在终端上使用文件就必须进入桌面。但桌面所在文件夹是“桌面”,在终端打中文比较麻烦,就异想天开的把此文件夹重命名为“Desktop”,结果注销之后桌面文件夹就被默认为用户文件夹了,用户目录下的所有文件及文件夹都跑到桌面了,很郁闷。后来google了一下,发现桌面可以任意设置,修改/home/你的用户文件夹/.config/user-dirs.dirs里面的XD
阅读全文
摘要:发现一直有人提这个区别,我自己也没想过有什么异常的地方,于是找到了linux下的源码看看void * __cdecl memcpy ( void * dst,const void * src,size_t count) {void* ret = dst;while(count--) {*(char*)dst = *(char *)src;dst= (char *)dst + 1;src= (char *)src + 1;}return(ret);}void * __cdecl memmove ( void * dst,const void * src,size_tcount){void* re
阅读全文
摘要:NVIDIAhttp://wiki.ubuntu.org.cn/NVIDIA#.E4.B8.8B.E8.BD.BD.E9.A9.B1.E5.8A.A8出自Ubuntu中文(K)ubuntu 下安装NVIDIA官方显卡驱动(不同于开源驱动,官方驱动对显卡的支持显然更好,而且通常更新频繁)。这里的例子:Kubuntu 10.04 32位环境 ,Nvidia7300显卡,NVIDIA 185.18驱动。目录[隐藏] 1 驱动的四种来源 2 受限制驱动列表(源) 3 编译驱动 3.1 下载驱动 3.2 编译依赖 3.3 屏蔽开源驱动nouveau 3.4 注销系统,关闭图形环境 3.5 安装过程 3.
阅读全文

浙公网安备 33010602011771号