百度空间 | 百度首页 
 
文章列表
 
您正在查看 "linux&unix" 分类下的文章

2009-11-01 22:20
//start
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
const int SIZE = 500;
static void sigCancle(int);
void usage();
void server(int );
int ser;
void init();
char buff[SIZE
类别:linux&unix | 评论(0) | 浏览()
 
2009-10-26 11:09
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main(){
int ch1,ch2;
if ((ch1=fork())==0){ //child 1
   putchar('b');
}else if ((ch2=fork())==0){ //child 2
   putchar('c');
}else{
   putchar('a');
}
waitfor(NULL);
printf("\n");
return 0;
}l
类别:linux&unix | 评论(0) | 浏览()
 
2009-10-22 09:30

//start

#! /bin/bash -

ls
echo hi this is yjy
yjy='yjy miaomiao'
echo "miao $yjy"
#注意" 和 '的区别

//end

参数:

//start

#! /bin/bash

ls ${1}
//end

跟踪

//start

#! /bin/bash

set -x
echo miao miao
ls
set +x
echo miao

//end

类别:linux&unix | 评论(0) | 浏览()
 
2009-10-12 16:50
//start
//Simple sample of getting IP address information
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <net/if.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
int main(){
int fd=socket(AF_INET,SOCK_DGRAM,0);
ifreq ifr;
ifr.ifr_add
类别:linux&unix | 评论(0) | 浏览()
 
2009-10-12 15:36
//start
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
const int SIZE = 1000;
int main(){
int sd[2];
int ret=socketpair(AF_UNIX,SOCK_STREAM,0,sd);
if (ret==-1){
printf("error: %s\n",strerror(errno));
return 1;
}
int pid = fork();
if (pid==0){ //child use socket 0
close(sd[1])
类别:linux&unix | 评论(0) | 浏览()
 
2009-10-12 13:45
http://www.amk.ca/python/howto/sockets/
http://www.troubleshooters.com/codecorn/sockets/
http://www.cs.utah.edu/~swalton/listings/
http://www.tenouk.com/cnlinuxsockettutorials.html  推荐

类别:linux&unix | 评论(0) | 浏览()
 
2009-06-08 09:20
sudo gedit /etc/init.d/alsa-utils

CTRL+F找到
mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
改為
#mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
类别:linux&unix | 评论(0) | 浏览()
 
2009-04-22 11:55
http://code.google.com/p/yjyrss/source/browse/#svn/trunk/job/curl

安装curl
命令行
sudo apt-get install curl

开发包
sudo apt-get install libcurl4-gnutls-dev

//start Makefile
CC=g++
CFLAG=-o main.o -lcurl
all:
    $(CC) $(CFLAG) *.cpp
    ./main.o
clear:
    rm -f *.o *.out *.txt

//end

注意编译要加 -lcurl

//start
#include <stdio.h>
#inclu
类别:linux&unix | 评论(0) | 浏览()
 
2009-04-22 10:58
我想编译一个   输出字符串的程序 , 它调用 动态链接库 ,

我们从上大下的分析 文件结构
输出的可执行文件: main.o
通过编译callmsg.cpp 得到:
//start callmsg.cpp
#include <stdio.h>
void showmsg(char * str);
int main(){
    showmsg("yjy call msg to say hello world");
}
//end
这个文件只有showmsg 的声明 , 没有实现
实现在一个动态链接库中:libmsg.so

这里假定已经生成了 libmsg.so 编译命令为:
g
类别:linux&unix | 评论(0) | 浏览()
 
2009-03-31 18:31
还没完一次贴不了那么多
//start
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around and tab
""""""
类别:linux&unix | 评论(0) | 浏览()
 
2009-03-31 18:30
这几天学vi ,太难用,找了一个vimrc 感觉还不错。
//start
" by Amix - http://amix.dk/
"
" Maintainer: redguardtoo <chb_sh@hotmail.com>, Amir Salihefendic <amix3k at gmail.com>
" Version: 2.1
" Last Change: 21/03/08 23:00:01
" fix some performance issue and syntax bugs
" Last Change: 12/08/06 13:39:28
" Fixed (win32 compatible) by: redguardtoo <chb_sh at gmail.com>
" This vimrc file is tested on
类别:linux&unix | 评论(0) | 浏览()
 
2009-03-23 19:10
笔记本 用电池时 ubuntu 会频繁的挂载硬盘 ,网上无意间搜到的。发现自己也有这个问题。
用电池供电
sudo apt-get install smartmontools
sudo smartctl -a /dev/sda | grep Load_Cycle_Count
30 秒后如果
再次执行
如果这个数字增长了。那就继续了
sudo hdparm -B 255 /dev/sda
显示:
/dev/sda:
setting Advanced Power Management level to disabled

在试一下,数字不会增长了。



类别:linux&unix | 评论(0) | 浏览()
 
2009-03-22 23:28
http://alone.yo2.cn/archives/625918
感谢,上面些的很详细,有截图
# apt-get install lighttpd

说明Lighttpd没有工作,我们要修改一个小地方。

# killall lighttpd
# lighttpd -f /etc/lighttpd/lighttpd.conf


3.安装PHP

# apt-ge
类别:linux&unix | 评论(2) | 浏览()
 
2009-03-22 23:17
http://www.linuxdiyf.com/viewarticle.php?id=108951
找到的。
sudo passwd root

输入两遍密码,就能用了。
类别:linux&unix | 评论(0) | 浏览()
 
2009-03-22 16:28
http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html


//start
#include <sys/types.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int gi = 1;
main(){
    string name;
    int vi =20;
    pid_t pid = fork();
    if (pid==0){
        //here child
类别:linux&unix | 评论(0) | 浏览()
 
     
 
 
文章分类
 
 
随笔(36)
 
 
Vs(10)
 
Java(96)
 
Vfp(10)
 
Css(9)
 
 
Python(27)
 
c#(36)
 
 
c/c++(33)
 
 
Php(23)
 
Bt(1)
 
Spoj(10)
 
Usaco(32)
 
Ai(19)
 
Ruby(6)
 
 
C51(25)
 
Lua(4)
 
 
Asm(42)
 
 
Oj(291)
 
Noip(10)
 
Google(26)
 
Jsp(4)
 
 
Qt(31)
 
Opengl(12)
 
 
 
Vrml(1)
 
 
Flex(16)
 
 
 
     
 
文章存档
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
     
 
最新文章评论
   

汗。。。还是tle的。。。
 
 
 

在你这里找到了 Code2HTML ,相当之感谢呢^
 

回复luohai8899:http://hi.baidu.com/xhgis/blog/item/bd51e7192d500970dab4bd37....
 
     


©2009 Baidu