httpserver 下载服务器demo 以及libevent版本的 httpserver

实现效果如下:

图片可以直接显示 

cpp h 这些可以直接显示 其他的 则是提示是否要下载

单线程 还有bug

代码如下  先放上来 

#include "httpserver.h"
#include "stdio.h"
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/sendfile.h>
#include <dirent.h>#define BURSIZE 1024
int hex2dec(char c)
{if ('0' <= c && c <= '9') {return c - '0';} else if ('a' <= c && c <= 'f') {return c - 'a' + 10;} else if ('A' <= c && c <= 'F') {return c - 'A' + 10;} else {return -1;}
}char dec2hex(short int c)
{if (0 <= c && c <= 9) {return c + '0';} else if (10 <= c && c <= 15) {return c + 'A' - 10;} else {return -1;}
}/** 编码一个url*/
void urlencode(char url[])
{int i = 0;int len = strlen(url);int res_len = 0;char res[BURSIZE];for (i = 0; i < len; ++i) {char c = url[i];if (('0' <= c && c <= '9') ||('a' <= c && c <= 'z') ||('A' <= c && c <= 'Z') || c == '/' || c == '.') {res[res_len++] = c;} else {int j = (short int)c;if (j < 0)j += 256;int i1, i0;i1 = j / 16;i0 = j - i1 * 16;res[res_len++] = '%';res[res_len++] = dec2hex(i1);res[res_len++] = dec2hex(i0);}}res[res_len] = '\0';strcpy(url, res);
}/** 解码url*/
void urldecode(char url[])
{int i = 0;int len = strlen(url);int res_len = 0;char res[BURSIZE];for (i = 0; i < len; ++i) {char c = url[i];if (c != '%') {res[res_len++] = c;} else {char c1 = url[++i];char c0 = url[++i];int num = 0;num = hex2dec(c1) * 16 + hex2dec(c0);res[res_len++] = num;}}res[res_len] = '\0';strcpy(url, res);
}int CreateSocketFD()
{int fd = 0;fd = socket(AF_INET,SOCK_STREAM,0);if(fd == -1){perror("Scoket fd = -1");return 0;}int reuseport = 1;int ret = setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&reuseport,sizeof(reuseport));if(ret == -1){perror("setsocketopt failed");return -1;}struct sockaddr_in addr;addr.sin_family = AF_INET;addr.sin_port = htons(8888);addr.sin_addr.s_addr = INADDR_ANY;ret = bind(fd,(struct sockaddr*)&addr,sizeof(addr));if(ret == -1){perror("bind error");return -1;}ret = listen(fd,10);if(ret == -1){perror("listen error ");return -1;}return fd;
}int AcceptClients(int epoll_fd,int fd)
{struct sockaddr addr;int cfd = accept(fd,NULL,NULL);if(cfd == -1){perror("accept failed");}int flag = fcntl(cfd,F_GETFL);flag |= O_NONBLOCK;fcntl(cfd,F_SETFL,flag);struct epoll_event ev;ev.data.fd = cfd;ev.events = EPOLLIN|EPOLLET;int ret = epoll_ctl(epoll_fd,EPOLL_CTL_ADD,cfd,&ev);if(ret == -1){perror("epoll ctl failed");return 0;}return 0;
}const char *GetFileType(const char *filename)
{const char *dot = strrchr(filename,'.');if(dot == NULL){return "text/plain; charset=utf-8";}if(strcmp(dot,".jpg") == 0 ||strcmp(dot,".jpeg") == 0){return "image/jpg";}if(strcmp(dot,".html") == 0 ||strcmp(dot,".htm") == 0){return "text/html; charset=utf-8";}    if(strcmp(dot,".png") == 0){return "image/png";}    if(strcmp(dot,".bmp") == 0){return "image/bmp";}        if(strcmp(dot,".gif") == 0){return "image/gif";}            if(strcmp(dot,".css") == 0){return "text/css";}           if(strcmp(dot,".mp3") == 0){return "audio/mpeg";}               return "text/plain; charset=utf-8";
}int SendHead(int cfd,int status ,const char *desc,const char *type,int size)
{char buf[4096] = {0};sprintf(buf,"http/1.1 %d %s\r\n",status,desc);sprintf(buf+strlen(buf),"content-type: %s\r\n",type);sprintf(buf+strlen(buf),"content-length: %d\r\n\r\n",size);    printf("SendHead buf[%s]\n",buf);send(cfd,buf,strlen(buf),0);return 0;
}int SendDir(const char *dirname,int cfd)
{char buf[4096] = {0};sprintf(buf,"<html><head><title>%s</title></head><body><table>",dirname);printf("SendDir dirname=[%s]\n",dirname);struct dirent **namelist;int count = scandir(dirname,&namelist,NULL,alphasort);printf("SendDir count=[%d]\n",count);for(int i = 0;i< count;i++){char *name = namelist[i]->d_name;struct stat st;char sub_path[1024]={0};sprintf(sub_path,"%s/%s",dirname,name);stat(sub_path,&st);if(S_ISDIR(st.st_mode)){sprintf(buf+strlen(buf),"<tr><td><a href=\"%s/\">%s</a></td><td>%ld</td></tr>",name,name,st.st_size);}else{sprintf(buf+strlen(buf),"<tr><td><a href=\"%s\">%s</a></td><td>%ld</td></tr>",name,name,st.st_size);}printf("cfd:%d Sendbuf[%s]\n",cfd,buf);send(cfd,buf,strlen(buf),0);memset(buf,0,sizeof(buf));free(namelist[i]);}sprintf(buf,"</table></body></html>");printf("cfd:%d Sendbuf[%s]\n",cfd,buf);send(cfd,buf,strlen(buf),0);free(namelist);return 0;
}int SendFile(const char* filename,int cfd)
{int fd = open(filename,O_RDONLY);if(fd >0){#if 0while(1){char buf[1024];int len = read(fd,buf,sizeof buf);if(len >0){send(cfd,buf,len,0);usleep(10);}else if(len == 0){printf("Read file end\n");break;}else{perror("read error");}}#elseoff_t offset = 0;int file_size = lseek(fd,0,SEEK_END);lseek(fd,0,SEEK_SET);while(offset <file_size){int send_len = sendfile(cfd,fd,&offset,file_size-offset);if(send_len == -1){if(errno == EAGAIN){//perror("sendfile no data send");}else{perror("sendfile ret -1");}}else{printf("Send len:%d\n",send_len);}}#endif}else{perror("open file failed");}close(fd);return 0;
}int ParseReqLine(const char *line,int cfd)
{char method[12];char path[1024];printf("ParseReqLine=[%s]\n",line);int ret = sscanf(line,"%[^ ] %[^ ]",method,path);printf("sscanf ret = %d\n",ret);printf("method=[%s],path=[%s]\n",method,path);urldecode(path);printf("afterdecode path=[%s]\n",path);if(ret ==2 ){}else{printf("Reqest line parse failed\n");return -1;}if(strcasecmp(method,"get") == 0){}else if(strcasecmp(method,"post")==0){}else{return -1;}char *file = NULL;if(strcmp(path,"/") == 0){   file = "./";}else{file = path+1;}struct stat st;ret = stat(file,&st);if(ret == -1){printf("file doest not exist\n");SendHead(cfd,404,"Not found",GetFileType(".html"),-1);SendFile("404.html",cfd);return -1;}if(S_ISDIR(st.st_mode)){printf("Directory\n");SendHead(cfd,200,"OK",GetFileType(".html"),-1);SendDir(file,cfd);}else{printf("File\n");SendHead(cfd,200,"OK",GetFileType(file),st.st_size);SendFile(file,cfd);}return 0;
}int Request(int epoll_fd,int cfd)
{char buffer[4096] = {0};char temp_buf[1024] = {0};int read_len = 0;int total = 0;while((read_len = recv(cfd,temp_buf,sizeof(temp_buf),0))>0){if(total+read_len <sizeof(buffer)){memcpy(buffer+total,temp_buf,read_len);total+=read_len;}}if(read_len == -1 && errno == EAGAIN){//读取数据结束char *p = strstr(buffer,"\r\n");if(p){int len = p - buffer;buffer[len] = 0;ParseReqLine(buffer,cfd);}}else if(read_len == 0){//Client close socketepoll_ctl(epoll_fd,EPOLL_CTL_DEL,cfd,NULL);close(cfd);}else{perror("recv error");}return 0;
}int EPOLL_Run(int server_fd)
{int epoll_fd = epoll_create(10);if(epoll_fd == -1){perror("epoll_create failed");return 0;}struct epoll_event ev;ev.data.fd = server_fd;ev.events = EPOLLIN;int ret = epoll_ctl(epoll_fd,EPOLL_CTL_ADD,server_fd,&ev);if(ret == -1){perror("epoll_ctl failed");return 0;}struct epoll_event events[512];while(true){int nReady = epoll_wait(epoll_fd,events,512,-1);for(int i = 0;i<nReady;i++){int fd = events[i].data.fd;if(fd == server_fd){AcceptClients(epoll_fd,fd);}else{if(events[i].events &EPOLLOUT){//g_writeable = true;printf("客户端可以写数据了");}if(events[i].events &EPOLLIN){Request(epoll_fd,fd);}}}}return epoll_fd;
}
int main()
{printf("Hello world\n");char work_dir[] = "/home/develop/httpserver";//chdir(work_dir);int server_fd = CreateSocketFD();if(server_fd <=0){return 0;}EPOLL_Run(server_fd);close(server_fd);return 0;
}

以上  如果遇到大文件 比如mp3 文件的话  就没办法 预览  试听 下载大文件也有问题  

跟踪发现是SendFile 那里有问题   会返回-1

根据网上的例子 改了一个 基于libevent版本的  不会存在这个问题 

#include "sushi.h"
#include "stdio.h"#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/epoll.h>
#include <signal.h>#include <fcntl.h>
#include <unordered_map>
#include <memory>
#include <vector>#include <arpa/inet.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/sendfile.h>#include <dirent.h>#include <evhttp.h>
#include <event.h>
#include <string.h>
#include "event2/http.h"
#include "event2/event.h"
#include "event2/buffer.h"
#include "event2/bufferevent.h"
#include "event2/bufferevent_compat.h"
#include "event2/http_struct.h"
#include "event2/http_compat.h"
#include "event2/util.h"
#include "event2/listener.h"
#include "event2/thread.h"#define MAX_EVENTS	100	
#define RECVBUFSIZ	20bool g_run_flag = true;void sig_handler(int signo)
{g_run_flag = false;printf("\033[0;31mprogram exit by user cmd !!!!\033[0;39m\n");
}#define BURSIZE 1024
int hex2dec(char c)
{if ('0' <= c && c <= '9') {return c - '0';} else if ('a' <= c && c <= 'f') {return c - 'a' + 10;} else if ('A' <= c && c <= 'F') {return c - 'A' + 10;} else {return -1;}
}char dec2hex(short int c)
{if (0 <= c && c <= 9) {return c + '0';} else if (10 <= c && c <= 15) {return c + 'A' - 10;} else {return -1;}
}/** 编码一个url*/
void urlencode(char url[])
{int i = 0;int len = strlen(url);int res_len = 0;char res[BURSIZE];for (i = 0; i < len; ++i) {char c = url[i];if (('0' <= c && c <= '9') ||('a' <= c && c <= 'z') ||('A' <= c && c <= 'Z') || c == '/' || c == '.') {res[res_len++] = c;} else {int j = (short int)c;if (j < 0)j += 256;int i1, i0;i1 = j / 16;i0 = j - i1 * 16;res[res_len++] = '%';res[res_len++] = dec2hex(i1);res[res_len++] = dec2hex(i0);}}res[res_len] = '\0';strcpy(url, res);
}/** 解码url*/
void urldecode(char url[])
{int i = 0;int len = strlen(url);int res_len = 0;char res[BURSIZE];for (i = 0; i < len; ++i) {char c = url[i];if (c != '%') {res[res_len++] = c;} else {char c1 = url[++i];char c0 = url[++i];int num = 0;num = hex2dec(c1) * 16 + hex2dec(c0);res[res_len++] = num;}}res[res_len] = '\0';strcpy(url, res);
}const char *GetFileType(const char *filename)
{const char *dot = strrchr(filename,'.');if(dot == NULL){return "text/plain; charset=utf-8";}if(strcmp(dot,".jpg") == 0 ||strcmp(dot,".jpeg") == 0){return "image/jpg";}if(strcmp(dot,".html") == 0 ||strcmp(dot,".htm") == 0){return "text/html; charset=utf-8";}    if(strcmp(dot,".png") == 0){return "image/png";}    if(strcmp(dot,".bmp") == 0){return "image/bmp";}        if(strcmp(dot,".gif") == 0){return "image/gif";}            if(strcmp(dot,".css") == 0){return "text/css";}           if(strcmp(dot,".mp3") == 0){return "audio/mpeg";}               return "text/plain; charset=utf-8";
}int SendHead(struct bufferevent *event,int status ,const char *desc,const char *type,int size)
{char buf[4096] = {0};sprintf(buf,"http/1.1 %d %s\r\n",status,desc);sprintf(buf+strlen(buf),"content-type: %s\r\n",type);sprintf(buf+strlen(buf),"content-length: %d\r\n\r\n",size);    printf("SendHead buf[%s]\n",buf);//send(cfd,buf,strlen(buf),0);bufferevent_write(event,buf,strlen(buf));return 0;
}int SendDir(struct bufferevent *event,const char *dirname)
{char buf[4096] = {0};sprintf(buf,"<html><head><title>%s</title></head><body><table>",dirname);printf("SendDir dirname=[%s]\n",dirname);struct dirent **namelist;int count = scandir(dirname,&namelist,NULL,alphasort);printf("SendDir count=[%d]\n",count);for(int i = 0;i< count;i++){char *name = namelist[i]->d_name;struct stat st;char sub_path[1024]={0};sprintf(sub_path,"%s/%s",dirname,name);stat(sub_path,&st);if(S_ISDIR(st.st_mode)){sprintf(buf+strlen(buf),"<tr><td><a href=\"%s/\">%s</a></td><td>%ld</td></tr>",name,name,st.st_size);}else{sprintf(buf+strlen(buf),"<tr><td><a href=\"%s\">%s</a></td><td>%ld</td></tr>",name,name,st.st_size);}//printf("cfd:%d Sendbuf[%s]\n",cfd,buf);//send(cfd,buf,strlen(buf),0);bufferevent_write(event,buf,strlen(buf));    memset(buf,0,sizeof(buf));free(namelist[i]);}sprintf(buf,"</table></body></html>");//printf("cfd:%d Sendbuf[%s]\n",cfd,buf);//send(cfd,buf,strlen(buf),0);bufferevent_write(event,buf,strlen(buf));    	free(namelist);return 0;
}int SendFile(struct bufferevent *event,const char* filename)
{int fd = open(filename,O_RDONLY);if(fd >0){#if 1while(1){char buf[1024];int len = read(fd,buf,sizeof buf);if(len >0){//send(cfd,buf,len,0);bufferevent_write(event,buf,len);    usleep(10);}else if(len == 0){printf("Read file end\n");break;}else{perror("read error");}}#elseoff_t offset = 0;int file_size = lseek(fd,0,SEEK_END);lseek(fd,0,SEEK_SET);while(offset <file_size){int send_len = sendfile(cfd,fd,&offset,file_size-offset);if(send_len == -1){if(errno == EAGAIN){//perror("sendfile no data send");}else{perror("sendfile ret -1");}}else{printf("Send len:%d\n",send_len);}}#endif}else{perror("open file failed");}close(fd);return 0;
}int http_request(struct bufferevent *event,char *path)
{char *file = NULL;if(strcmp(path,"/") == 0){   file = "./";}else{file = path+1;}struct stat st;int ret = stat(file,&st);if(ret == -1){printf("file doest not exist\n");SendHead(event,404,"Not found",GetFileType(".html"),-1);SendFile(event,"404.html");return -1;}if(S_ISDIR(st.st_mode)){printf("Directory\n");SendHead(event,200,"OK",GetFileType(".html"),-1);SendDir(event,file);}else{printf("File\n");SendHead(event,200,"OK",GetFileType(file),st.st_size);SendFile(event,file);}return 0;
}void read_cb(struct bufferevent *event,void *arg)
{char buf[256] = {0};char method[10]= {0},path[256]={0},protocol[10]={0};int ret = bufferevent_read(event,buf,sizeof(buf));if(ret >0){sscanf(buf,"%[^ ] %[^ ] %[^ \r\n]",method,path,protocol);if(strcasecmp(method,"get") == 0){char bufline[256] = {0};write(STDOUT_FILENO,buf,ret);while((ret = bufferevent_read(event,bufline,sizeof(bufline)))>0){write(STDOUT_FILENO,bufline,ret);}http_request(event,path);}}
}void bevent_cb(struct bufferevent *event,short what,void *arg)
{if(what & BEV_EVENT_EOF){printf("client closeed\n");bufferevent_free(event);}else if(what & BEV_EVENT_ERROR){printf("client error\n");bufferevent_free(event);}else if(what & BEV_EVENT_CONNECTED){printf("new client connected\n");}
}void listener_cb(struct evconnlistener *listener,evutil_socket_t fd,struct sockaddr *addr,int socklen,void *arg)
{struct event_base *base = (struct event_base*)arg;struct bufferevent *event=  bufferevent_socket_new(base,fd,BEV_OPT_CLOSE_ON_FREE);bufferevent_setcb(event,read_cb,NULL,bevent_cb,base);bufferevent_enable(event,EV_READ|EV_WRITE);
}int main (int argc ,char*argv[])
{signal(SIGINT, sig_handler);signal(SIGTERM, sig_handler);signal(SIGKILL, sig_handler);//Program can not recieve SIGKILL(9) signal so.... this cmd does not make any sense// Ignore broken pipessignal(SIGPIPE, SIG_IGN);char work_dir[256]={0};strcpy(work_dir,getenv("PWD"));printf("dir:%s\n",work_dir);chdir(work_dir);struct event_base *base = event_base_new();struct sockaddr_in server;server.sin_family = AF_INET;server.sin_port = htons(9999);server.sin_addr.s_addr = htonl(INADDR_ANY);struct evconnlistener *listener = evconnlistener_new_bind(base,listener_cb,base,LEV_OPT_CLOSE_ON_FREE|LEV_OPT_REUSEABLE_PORT,-1,(struct sockaddr *)&server,sizeof(server));event_base_dispatch(base);event_base_free(base);evconnlistener_free(listener);printf("Exit normally\n");return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/147993.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为什么Spring不建议使用基于字段的依赖注入

在我们通过IDEA编写Spring的代码的时候&#xff0c;假如我们编写了如下代码&#xff1a; IDEA会给我们一个warning警告&#xff1a; 翻阅官方文档&#xff1b;我们会发现&#xff1a; 大意就是强制依赖使用构造器注入&#xff0c;可选依赖使用setter注入那么这是为什么呢&am…

一键智能视频语音转文本——基于PaddlePaddle语音识别与Python轻松提取视频语音并生成文案

前言 如今进行入自媒体行业的人越来越多&#xff0c;短视频也逐渐成为了主流&#xff0c;但好多时候是想如何把视频里面的语音转成文字&#xff0c;比如&#xff0c;录制会议视频后&#xff0c;做会议纪要&#xff1b;比如&#xff0c;网课教程视频&#xff0c;想要做笔记&…

【算法|动态规划No.10】leetcode LCR 089. 打家劫舍 LCR 090. 打家劫舍 II

个人主页&#xff1a;兜里有颗棉花糖 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 兜里有颗棉花糖 原创 收录于专栏【手撕算法系列专栏】【LeetCode】 &#x1f354;本专栏旨在提高自己算法能力的同时&#xff0c;记录一下自己的学习过程&#xff0c;希望…

fcpx插件:82种复古电影胶卷框架和效果mFilm Matte

无论您是在制作音乐剪辑、私人假期视频还是大型广告活动&#xff0c;这个专业的插件都将帮助您为您的镜头赋予真正的电影角色。 复古效果在任何视频中都能立即识别出来&#xff0c;增添了感伤的复古氛围&#xff0c;并使镜头更具说服力。使用 mFilm Matte 轻松实现这些特征&…

C++算法 —— 动态规划(10)二维费用背包

文章目录 1、动规思路简介2、一和零3、盈利计划 背包问题需要读者先明白动态规划是什么&#xff0c;理解动规的思路&#xff0c;并不能给刚接触动规的人学习。所以最好是看了之前的动规博客&#xff0c;以及两个背包博客&#xff0c;或者你本人就已经懂得动规了。 1、动规思路简…

九、2023.10.3.Linux(end).9

文章目录 33、简述mmap的原理和使用场景&#xff1f;34、互斥量能不能在进程中使用&#xff1f;35、协程是轻量级线程&#xff0c;轻量级表现在哪里&#xff1f;36、说说常见信号有哪些&#xff0c;表示什么含义&#xff1f;37、说说线程间通信的方式有哪些&#xff1f;38、说说…

Access注入---Cookie注入

Access注入----Cookie注入Access数据库&#xff08;微软&#xff09; 逐渐淘汰 &#xff08;没有库的概念&#xff0c;是表的集合&#xff09;Access没有系统自带库Cookie注入&#xff08;头注入HEAD注入的&#xff09;php中产生Cookie注入的可能性小&#xff0c;但ASP产生Cook…

RabbitMQ的基本介绍

什么是MQ 本质是一个队列&#xff0c;只不过队列中存放的信息是message罢了&#xff0c;还是一种跨进程的通信机制&#xff0c;用于上下游传递信息。在互联网架构中&#xff0c;MQ是一种非常常见的上下游“逻辑解耦物理解耦”的消息通信服务。使用了MQ之后&#xff0c;信息发送…

postgresql16-新特性

postgresql16-新特性 any_value数组抽样数组排序 any_value any_value 返回任意一个值 select e.department_id ,count(*), any_value(e.last_name) from cps.public.employees e group by e.department_id ;数组抽样 -- 从数组中随机抽取一个元素 array_sample(数组&#…

以太网基础学习(四)——IP协议

一 、IP协议概述 IP&#xff08;Internet Protocol&#xff0c;互联网协议&#xff09;是互联网通信的基础协议&#xff0c;它负责将数据包从源地址传输到目的地址。IP协议定义了如何封装数据包&#xff0c;如何寻址数据包以及如何路由数据包&#xff0c;它是随着互联网的出现而…

弧度、圆弧上的点、圆的半径(r)、弧长(s)之间的关系

要计算弧度和圆弧上的点&#xff0c;需要知道以下几个要素&#xff1a; 圆的半径&#xff08;r&#xff09;&#xff1a;即圆的中心到圆周上任意一点的距离。 弧长&#xff08;s&#xff09;&#xff1a;从圆周上的一个点到另一个点所经过的弧长。 弧度&#xff08;θ&#x…

【CAD二次开发】给CAD添加TRUSTEDPATHS避免dll插件信任弹窗

找到配置文件目录,遍历下面的每个配置文件; 找到 Variables 下的TRUSTEDPATHS项目;在后面添加新的目录即可,多个目录使用分号分隔; public static void AddPath(string trusedPath){// 指定注册表键的路径

指针笔试题(带解析版)

题目2&#xff1a; struct MyStruct {int num;char* pcname;short sdate;char cha[2];short sba[4]; }*p; //结构体大小为32字节 //p0x100000 int main() {p 0x100000;printf("%p\n", p 0x1);//p&#xff1a;结构体指针&#xff0c;1下一个结构体指针&#xff0c;…

axb_2019_brop64

axb_2019_brop64 Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x400000)64位&#xff0c;只开了NX __int64 repeater() {size_t v1; // raxchar s[208]; // [rsp0h] [rbp-D0h] BYREFprintf("…

SLAM从入门到精通(用python实现机器人运动控制)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 在ROS下面&#xff0c;开发的方法很多&#xff0c;可以是c&#xff0c;可以是python。大部分接口操作类的应用&#xff0c;其实都可以用python来开…

深度学习 图像分割 PSPNet 论文复现(训练 测试 可视化)

Table of Contents 一、PSPNet 介绍1、原理阐述2、论文解释3、网络模型 二、部署实现1、PASCAL VOC 20122、模型训练3、度量指标4、结果分析5、图像测试 一、PSPNet 介绍 PSPNet(Pyramid Scene Parsing Network)来自于CVPR2017的一篇文章&#xff0c;中文翻译为金字塔场景解析…

springboot+Uniapp+redis智能导诊系统源码,支持以公众号、小程序、App 等形式接入

AI医疗的智能导诊系统源码 智慧导诊系统全套源码 什么是智能导诊系统&#xff1f; 智能导诊系统是一种基于人工智能和大数据技术开发的医疗辅助软件&#xff0c;它能够通过对患者的症状、病史等信息进行计算分析&#xff0c;快速推荐科室和医生。通过简单的描述自身症状&#…

go语法入门2

字符串 使用双引号或反引号引起来的任意个字符。它是字面常量。 func main() {var a "abc\n测试" // \n换行fmt.Println(a) } abc 测试func main() {var a "abc\n\t测试" \\换行后在tabfmt.Println(a) } abc测试func main() {var a abc测试 …

火山引擎 ByteHouse 与白鲸开源完成兼容性认证,加速数据价值释放

更多技术交流、求职机会&#xff0c;欢迎关注字节跳动数据平台微信公众号&#xff0c;回复【1】进入官方交流群 数据作为新型生产要素&#xff0c;已快速融入生产、分配、流通、消费和社会服务管理等各环节&#xff0c;深刻改变着生产方式、生活方式和治理方式。越来越多企业也…

番外12:连续类功率放大器理论-连续类实现带宽拓展的底层原理

连续类功放通解&#xff1a;连续类功率放大器理论-连续类实现带宽拓展的底层原理-基础 本次内容理论性较强&#xff0c;适合对功率放大器理论研究比较感兴趣以及想发论文的小朋友&#xff0c;着重探讨现有的一些带宽拓展模式&#xff08;也就是连续类&#xff09;的基本实现原…