addresslist

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<algorithm>
using namespace std;
//好友信息
typedef struct frie{
    int num;
    char name[20];
    char sex[4];
    int year,month,day;
    char phone[3][12];
    char address[20];
    int groupid;
}fre;

fre *fri=new fre[10010];

//分组信息
typedef struct group{
    int id;
    char name[20];
}gr;

int now,size;
int se[10010];
gr *group=new gr[25];
//读friend.txt中的内容
void readfriend()
{

    FILE *fp=fopen("friend.txt","r");
    if(fp==NULL){
        printf("\t\t\t***********fail to open friend.txt***********\n");
    }
    int i;
    int n;
    now=0;
    for(i=0;!feof(fp);i++){
        if(fscanf(fp,"%d",&n)==EOF){
            break;
        }
        fri[n].num=n;
        if(now<n)
        now=n;
    //    fscanf(fp,"%s%s %d %d %d %s %s %s %d\n",fri[n].name,,&fri[n].year,,,,fri[n].phone[1],fri[n].phone[2],fri[n].address,&fri[n].groupid);
        fscanf(fp,"%s",fri[n].name);
        fscanf(fp,"%s",fri[n].sex);
        fscanf(fp,"%d",&fri[n].year);
        fscanf(fp,"%d",&fri[n].month);
        fscanf(fp,"%d",&fri[n].day);
        fscanf(fp,"%s",fri[n].phone[0]);
        fscanf(fp,"%s",fri[n].phone[1]);
        fscanf(fp,"%s",fri[n].phone[2]);
        fscanf(fp,"%s",fri[n].address);
        fscanf(fp,"%d",&fri[n].groupid);
    }
    size=i;
    now=now+1;
    fclose(fp);
    printf("\t\t\t************read friend.txt success!**************\n");
}

void readgroup()
{
    FILE *fp=fopen("group.txt","r");
    if(fp==NULL){
        printf("\t\t\t***********fail to open group.txt***********\n");
    }
    int i;
    while(!feof(fp)){

        if(fscanf(fp,"%d",&i)==EOF){
            break;
        }
        group[i].id=i;
        fscanf(fp,"%s",group[i].name);
    }
    fclose(fp);
    printf("\t\t\t************read group.txt success!**************\n");
}

void print(fre f)//输出格式
{
/*    printf("%4d%20s    %4c%5d%6d%5d%12s%12s%12s%20s%4d\n",fri[i].num,fri[i].name,fri[i].sex,fri[i].year,
                        fri[i].month,fri[i].day,fri[i].phone[0],fri[i].phone[1],fri[i].phone[2],fri[i].address,
                        fri[i].groupid);
*/
    printf("%4d",f.num);
    printf("%24s",f.name);
    if(f.sex[0]!=‘o‘){
        printf("%4s",f.sex);
    }
    else{
        printf("%4s"," ");
    }
    if(f.year==0&&f.month==0&&f.day==0){
        printf("%5s%6s%5s"," "," "," ");
    }
    else{
        printf("%5d%6d%5d",f.year,f.month,f.day);
    }
    for(int i=0;i<3;i++){
        if(f.phone[i][0]!=‘0‘)
        printf("%12s",f.phone[i]);
        else{
            printf("%12s"," ");
        }
    }
    printf("%20s%4d%20s\n",f.address,f.groupid,group[f.groupid].name);

}

void print2(gr g){
    printf("%4d%20s\n",g.id,g.name);
}
void begin()
{
    //cout<<"input i for insert,s for select,d for delete,u for update,p for display:"<<endl;
    printf("\t\t\t************i for insert function!************\n");
    printf("\t\t\t************s for select function!************\n");
    printf("\t\t\t************d for delete function!************\n");
    printf("\t\t\t************u for update function!************\n");
    printf("\t\t\t************p for display function!************\n");
    printf("\t\t\t************e for exit the system!************\n");
} 

void insert(fre &f)
{
    printf("\t\t**********insert begin!***********\n");
    f.num=now;
    printf("please input name:\n");
    cin>>f.name;
    printf("please input sex 男,女 and o for no:\n"); //g gor girl,b for boy,o for no
    cin>>f.sex;
    printf("please input birthday as yyyy-mm-dd and 0 0 0 for no:\n");
    scanf("%d-%d-%d",&f.year,&f.month,&f.day);
    int n;
    for(int i=0;i<3;i++){
        f.phone[i][0]=‘0‘;
    }
    cout<<"how many phone you want to save:"<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
        printf("please input phone:\n");
        scanf("%s",f.phone[i]);
    }
    printf("please input address :\n");
    scanf("%s",f.address);
    printf("please input group id if no this please create:\n");
    cin>>f.groupid;
    if(group[f.groupid].name[0]==‘\0‘){
        cout<<"please create group name:"<<endl;
        group[f.groupid].id=f.groupid;
        scanf("%s",group[f.groupid].name);
        cout<<group[f.groupid].name<<" created!"<<endl;
}
    now++;
    size++;
}

//展示所有内容
void display()
{
    printf("\t\t\t************display all**************\n");
    if(size>0){
        printf("%4s%20s%4s%5s%6s%5s%12s%12s%12s%20s%4s%20s\n","num","\tname","sex","year","month","day","phone1",
                    "phone2","phone3","address","id","groupname");
        for(int i=0;i<now;i++){
            if(fri[i].num!=-1)
                print(fri[i]);
        }
    }
    printf("%10s%20s\n","groupid","groupname");
    for(int i=0;i<25;i++){
        if(group[i].name[0]!=‘\0‘){
            print2(group[i]);
        }
    }
}

void select()
{
    printf("\t\t\t***********update begin!*************\n");
    int n;
    cout<<"please input how you want to select:"<<endl;
    cout<<"1 for num,2 for name,3 for sex,4 for birthday"<<endl;
    cout<<"5 for phone,6 for address,7 for group id,8 for group name"<<endl;
    cout<<"0 for end selece!"<<endl;
    for(int i=0;i<now;i++){
        se[i]=i;
    }
    int i,s,j;
    s=now;
    while(cin>>n){
        switch(n){
            case 0:
                if(s!=0){
                    printf("%4s%20s%4s%5s%6s%5s%12s%12s%12s%20s%4s%20s\n","num","\tname","sex","year","month","day","phone1",
                    "phone2","phone3","address","id","groupname");
                    for(int i=0;i<s;i++){
                        print(fri[se[i]]);
                    }
                }
                return;
            case 1:
                int nu;
                cout<<"please input num:"<<endl;
                cin>>nu;
                if(nu<now&&fri[nu].num!=-1){
                    printf("%4s%20s%4s%5s%6s%5s%12s%12s%12s%20s%4s%20s\n","num","\tname","sex","year","month","day","phone1",
                    "phone2","phone3","address","id","groupname");
                    print(fri[nu]);
                }
                else{
                    cout<<"there is no that match you!"<<endl;
                }
                return;
            case 2:
                j=0;
                cout<<"please input name:"<<endl;
                char na[20];
                cin>>na;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].name,na)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 3:
                j=0;
                cout<<"please input sex:"<<endl;
                char c[4];
                cin>>c;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].sex,c)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 4:
                j=0;
                cout<<"please input birthday:"<<endl;
                int y,m,d;
                scanf("%d-%d-%d",&y,&m,&d);
                for(int i=0;i<s;i++){
                    if(fri[se[i]].year==y&&fri[se[i]].month==m&&fri[se[i]].day==d){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 5:
                j=0;
                cout<<"please input phone:"<<endl;
                char p[12];
                cin>>p;
                for(int i=0;i<s;i++){
                    for(int k=0;k<3;k++){
                        if(strcmp(p,fri[se[i]].phone[k])==0)
                        {
                            se[j++]=se[i];
                            break;
                        }
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 6:
                j=0;
                cout<<"please input address:"<<endl;
                char a[20];
                cin>>a;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].address,a)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 7:
                j=0;
                cout<<"please input group id:"<<endl;
                int b;
                cin>>b;
                for(int i=0;i<s;i++){
                    if(fri[se[i]].groupid==b){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 8:
                j=0;
                cout<<"please input group name:"<<endl;
                char nm[20];
                cin>>nm;
                int mo;
                mo=-1;
                for(int i=0;i<25;i++){
                    if(strcmp(group[i].name,nm)==0)
                    {
                        mo=i;
                        break;
                    }
                }
                if(mo==-1){
                    cout<<"no this group name!"<<endl;
                    return;
                }
                else{
                    for(int i=0;i<s;i++){
                        if(mo==fri[se[i]].groupid)
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            default:
                cout<<"input error please retry"<<endl;
        }
    }
}

//怎么改变friend
void modify(fre &f)
{
    int n;
    cout<<"please select which you want to update:"<<endl;
    cout<<"2 for name,3 for sex,4 for birthday"<<endl;
    cout<<"5 for phone,6 for address,7 for group id,8 for group name"<<endl;
    cin>>n;
    switch(n){
            case 2:
                cout<<"please input update name:"<<endl;
                char na[20];
                cin>>na;
                strcpy(f.name,na);
                break;
            case 3:
                cout<<"please input update sex:"<<endl;
                char c[4];
                cin>>c;
                strcpy(f.sex,c);
                break;
            case 4:
                cout<<"please input update birthday:"<<endl;
                int y,m,d;
                scanf("%d-%d-%d",&y,&m,&d);
                f.year=y;
                f.day=d;
                f.month=m;
                break;
            case 5:
                cout<<"please input update phone:"<<endl;
                char p[12];
                cin>>p;
                strcpy(f.phone[0],p);
                break;
            case 6:
                cout<<"please input update address:"<<endl;
                char a[20];
                cin>>a;
                strcpy(f.address,a);
                break;
            case 7:
                cout<<"please input update group id:"<<endl;
                int b;
                cin>>b;
                f.groupid=b;
                break;
            case 8:
                cout<<"please input update group name:"<<endl;
                char nm[20];
                cin>>nm;
                strcpy(group[f.groupid].name,nm);
                break;
            default:
                cout<<"input error please retry"<<endl;
                break;
    }

}

void update()
{
    printf("\t\t\t***************update begin!*************\n");
    int n;
    cout<<"please first select which you want to update :"<<endl;
    cout<<"1 for num,2 for name,3 for sex,4 for birthday"<<endl;
    cout<<"5 for phone,6 for address,7 for group id,8 for group name"<<endl;
    cout<<"0 for end selece and delete begin!"<<endl;
    for(int i=0;i<now;i++){
        se[i]=i;
    }
    int i,s,j;
    s=now;
    while(cin>>n){
        switch(n){
            case 0:
                if(s!=0){
                    for(int i=0;i<s;i++){
                        modify(fri[se[i]]);
                    }
                }
                return;
            case 1:
                int nu;
                cout<<"please input num:"<<endl;
                cin>>nu;
                if(nu<now&&fri[nu].num!=-1){
                        modify(fri[nu]);
                }
                else{
                    cout<<"there is no that match you!"<<endl;
                }
                return;
            case 2:
                j=0;
                cout<<"please input name:"<<endl;
                char na[20];
                cin>>na;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].name,na)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 3:
                j=0;
                cout<<"please input sex:"<<endl;
                char c[4];
                cin>>c;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].sex,c)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 4:
                j=0;
                cout<<"please input birthday:"<<endl;
                int y,m,d;
                scanf("%d-%d-%d",&y,&m,&d);
                for(int i=0;i<s;i++){
                    if(fri[se[i]].year==y&&fri[se[i]].month==m&&fri[se[i]].day==d){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 5:
                j=0;
                cout<<"please input phone:"<<endl;
                char p[12];
                cin>>p;
                for(int i=0;i<s;i++){
                    for(int k=0;k<3;k++){
                        if(strcmp(fri[se[i]].phone[k],p)==0)
                            se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 6:
                j=0;
                cout<<"please input address:"<<endl;
                char a[20];
                cin>>a;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].address,a)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 7:
                j=0;
                cout<<"please input group id:"<<endl;
                int b;
                cin>>b;
                for(int i=0;i<s;i++){
                    if(fri[se[i]].groupid==b){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 8:
                j=0;
                cout<<"please input group name:"<<endl;
                char nm[20];
                cin>>nm;
                int mo;
                mo=-1;
                for(int i=0;i<25;i++){
                    if(strcmp(group[i].name,nm)==0)
                    {
                        mo=i;
                        break;
                    }
                }
                if(mo==-1){
                    cout<<"no this group name!"<<endl;
                    return;
                }
                else{
                    for(int i=0;i<s;i++){
                        if(mo==fri[se[i]].groupid)
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            default:
                cout<<"input error please retry"<<endl;
                break;
        }
    }
}

void dele()
{
    printf("\t\t\t***********delete begin!************\n");
    int n;
    cout<<"please input how you want to delete by:"<<endl;
    cout<<"1 for num,2 for name,3 for sex,4 for birthday"<<endl;
    cout<<"5 for phone,6 for address,7 for group id,8 for group name"<<endl;
    cout<<"0 for end selece and delete begin!"<<endl;
    for(int i=0;i<now;i++){
        se[i]=i;
    }
    int i,s,j;
    s=now;
    while(cin>>n){
        switch(n){
            case 0:
                if(s!=0){
                    size-=s;
                    printf("%4s%20s%4s%5s%6s%5s%12s%12s%12s%20s%4s%20s\n","num","\tname","sex","year","month","day","phone1",
                    "phone2","phone3","address","id","groupname");
                    for(int i=0;i<s;i++){
                        fri[se[i]].num=-1;
                        strcpy(fri[se[i]].name,"\0");
                        fri[se[i]].sex[0]=‘o‘;
                        fri[se[i]].year=0;
                        fri[se[i]].month=0;
                        fri[se[i]].day=0;
                        for(int j=0;j<3;j++){
                            fri[se[i]].phone[j][0]=‘0‘;
                        }
                        strcmp(fri[se[i]].address,"\0");
                        fri[se[i]].groupid=-1;
                    }
                }
                return;
            case 1:
                int nu;
                cout<<"please input num:"<<endl;
                cin>>nu;
                if(nu<now&&fri[nu].num!=-1){
                        fri[nu].num=-1;
                        strcpy(fri[nu].name,"\0");
                        fri[nu].sex[0]=‘o‘;
                        fri[nu].year=0;
                        fri[nu].month=0;
                        fri[nu].day=0;
                        for(int i=0;i<3;i++){
                            fri[se[i]].phone[i][0]=‘0‘;
                        }
                        strcmp(fri[nu].address,"\0");
                        fri[nu].groupid=-1;
                        size--;
                }
                else{
                    cout<<"there is no that match you!"<<endl;
                }
                return;
            case 2:
                j=0;
                cout<<"please input name:"<<endl;
                char na[20];
                cin>>na;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].name,na)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 3:
                j=0;
                cout<<"please input sex:"<<endl;
                char c[4];
                cin>>c;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].sex,c)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 4:
                j=0;
                cout<<"please input birthday:"<<endl;
                int y,m,d;
                scanf("%d-%d-%d",&y,&m,&d);
                for(int i=0;i<s;i++){
                    if(fri[se[i]].year==y&&fri[se[i]].month==m&&fri[se[i]].day==d){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 5:
                j=0;
                cout<<"please input phone:"<<endl;
                char p[12];
                cin>>p;
                for(int i=0;i<s;i++){
                    for(int k=0;k<3;k++){
                        if(strcmp(fri[se[i]].phone[k],p)==0)
                            se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 6:
                j=0;
                cout<<"please input address:"<<endl;
                char a[20];
                cin>>a;
                for(int i=0;i<s;i++){
                    if(strcmp(fri[se[i]].address,a)==0){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 7:
                j=0;
                cout<<"please input group id:"<<endl;
                int b;
                cin>>b;
                for(int i=0;i<s;i++){
                    if(fri[se[i]].groupid==b){
                        se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            case 8:
                j=0;
                cout<<"please input group name:"<<endl;
                char nm[20];
                cin>>nm;
                int mo;
                mo=-1;
                for(int i=0;i<25;i++){
                    if(strcmp(group[i].name,nm)==0)
                    {
                        mo=i;
                        break;
                    }
                }
                if(mo==-1){
                    cout<<"no this group name!"<<endl;
                    return;
                }
                else{
                    for(int i=0;i<s;i++){
                        if(mo==fri[se[i]].groupid)
                            se[j++]=se[i];
                    }
                }
                s=j;
                if(j==0){
                    cout<<"there is no that match you!"<<endl;
                }
                break;
            default:
                cout<<"input error please retry"<<endl;
                break;
        }
    }
}
void save()
{
    FILE *fp=fopen("friend.txt","w");
    if(fp==NULL){
        printf("打开friend.txt不成功!\n");
    }
    for(int i=0;i<now;i++)
    {
        if(fri[i].num!=-1)
        {
            fprintf(fp,"%d %s %s %d %d %d %s %s %s %s %d\n",fri[i].num,fri[i].name,fri[i].sex,fri[i].year,fri[i].month,fri[i].day,fri[i].phone[0],
            fri[i].phone[1],fri[i].phone[2],fri[i].address,fri[i].groupid);
        }
    }
    fclose(fp);
    FILE *f=fopen("group.txt","w");
    if(fp==NULL){
        printf("打开group.txt不成功!\n");
    }
    for(int i=0;i<25;i++){
        if(group[i].name[0]!=‘\0‘){
            fprintf(f,"%d %s\n",group[i].id,group[i].name);
        }
    }
    fclose(f);
    printf("\t\t\t*********谢谢使用*********\n");
}

int main()
{
    printf("\t\t\t**************system begin!************\n");
    char o;
    int sta=1;
    for(int i=0;i<25;i++)
    {
        group[i].name[0]=‘\0‘;
    }
    readfriend();
    readgroup();
//    freopen("in.txt","r",stdin);
    begin();
    while(cin>>o){
        switch(o){
            case ‘p‘:
                display();
                break;
            case ‘i‘:

                insert(fri[now]);//如果没有该groupid则创建此id的name
                break;
            case ‘s‘:
                select();
                break;
            case ‘d‘:
                dele();
                break;
            case ‘u‘:
                update();
                break;
            case ‘e‘:
                save();
                return 0;
            default:
                cout<<"input error please try again:"<<endl;
                break;
        }
        begin();
        }
    return 0;
}

时间: 2024-08-26 10:08:59

addresslist的相关文章

弹窗地址1

@RequestMapping(value = "/profile", method = RequestMethod.GET)    public String addressesPage(ModelMap model,                                HttpSession session) {        try {            UserInfo userInfo = getUserInfoBySpring();            Li

浅谈mysql

关于数据库其实我们可以简单的理解为存储货物的一个厂库,里面分别是按照一定的分类存放的物品,然后人们有时会从厂库中拿走或存储一些物品,有时也会更改或增加一些分类 这些物品都分门别类的存放在厂库中,方便人们的查询和存储. MySQL是一个关系型数据库管理系统,开发者为瑞典MySQL AB公司.目前MySQL被广泛地应用在互联网行业.由于其体积小.速度快.总体拥有成本低,尤其是开放源码这一特点,许多互联网公司选择了MySQL作为后端数据库.2008年MySQL被Sun公司收购,2010年甲骨文成功收购

POI 数据验证

从3.8开始,POI使用.xls和.xlsx格式处理数据校验略有不同之处.1)针对一个或多个预定义值检查用户输入到单元格的值以下代码将限制用户能输入到单元格A1的值是三个整数值(10.20.30)之一:    Workbook workbook = new XSSFWorkbook();  // 或者new HSSFWorkbook    Sheet sheet = workbook.createSheet("Data Validation");    // 数据验证帮助类    Da

用C#实现WEB代理服务器

用C#实现Web代理服务器 代理服务程序是一种广泛使用的网络应用程序.代理程序的种类非常多,根据协议不同可以分成HTTP代理服务程序.FTP代理服务程序等,而运行代理服务程序的服务器也就相应称为HTTP代理服务器和FTP代理服务器.本文将介绍的Web代理服务程序代理的是HTTP协议. 一.网络代理程序的优点 代理服务所起的是一个桥的作用,它是网络信息的中转站.在网络中应用代理服务一般是基于以下几个原因: (1)充分利用IP地址资源.在局域网中,一般对外的IP地址都是非常有限的,为了保证局域网内部

hibernate从零开始到各种映射

ORM(对象/关系数据库映射) 对象关系映射(Object Relational Mapping,简称ORM)是一种为了解决面向对象与关系数据库存在的互不匹配的现象的技术.它完成了面向对象的编程语言到关系型数据库的映射㈣.ORM框架可以看成应用程序和数据库之间的桥梁,通过它,我们可以以面向对象的方式建模.操作,易用.易理解,同时也可以利用关系型数据库系统对数据库访问操作的一些优势.以面向对象的方式操作持久化对象,而ORM框架负责转换成对应的SQL(结构化查询语言)操作. Hibernate概述

T-SQL

SQL Server T-SQL  (Stuctured Query Language) T – SQL 运算符: +, -, * ,/,% T – SQL 赋值运算符:=   例如:Name = '王华' T – SQL 比较运算符:= 等于 例如:age = 23       >  大于  例如:price > 100 < 小于 <> 不等于    >= 大于等于 <= 小于等于 != 不等于(非SQL-92标准) T – SQL 逻辑运算符:AND 与(并且

Resin+Nginx动静分离和负载均衡

案例:目前很多人喜欢Nginx+tomcat动静分离,或者反代后端tomcat集群,不过很多人也喜欢用Resin. 本人花了些功夫总结了Resin和tomcat区别: 特性\容器 resin tomcat 公司 CAUCHO Apache 是否收费 不完全免费(pro版本收费) 完全免费 Eclipse下调试开发 适中 复杂 性能 轻量级,pro版本支持负载均衡,以及缓存功能 轻量级(NIO模式性能高些),支持负载均衡 多实例 略麻烦 比较简单 集群部署 支持 支持 是否支持php 新版本支持(

在python中使用域名查询

执行基本查询 最基本的查询就是正向查询,它根据一个主机名来查找ip地址. getaddrinfo(...)     getaddrinfo(host, port [, family, socktype, proto, flags])         -> list of (family, socktype, proto, canonname, sockaddr)          Resolve host and port into addrinfo struct. #根据给定的参数host/p

C# Socket编程 同步以及异步通信

套接字简介:套接字最早是Unix的,window是借鉴过来的.TCP/IP协议族提供三种套接字:流式.数据报式.原始套接字.其中原始套接字允许对底层协议直接访问,一般用于检验新协议或者新设备问题,很少使用. 套接字编程原理:延续文件作用思想,打开-读写-关闭的模式. C/S编程模式如下: Ø  服务器端: 打开通信通道,告诉本地机器,愿意在该通道上接受客户请求——监听,等待客户请求——接受请求,创建专用链接进行读写——处理完毕,关闭专用链接——关闭通信通道(当然其中监听到关闭专用链接可以重复循环