- 博客(28)
- 收藏
- 关注
原创 c++ stream iword、pword和register_callback函数
pword,stream 的 register_callback函数iword使用
2022-12-04 17:35:28 268 1
原创 Java程序直接使用IDEA运行,程序正常运行,但是在C++中使用JNI调用,却会出错
C++调用java程序出错,而且并没有爆出什么问题, 直接使用IDEA调试,程序正常运行
2022-09-21 20:34:50 380
原创 CentOS 7 安装MuPDF(安装高版本gcc(11.2.1),安装opengl)
CentOS 7 安装MuPDF(安装高版本gcc(11.2.1),安装opengl)MuPDF源码地址MuPDF1.安装总结#gcc$sudo yum -y install centos-release-scl$sudo yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils#opengl$sudo yum list mesa*$sudo yum install -y mesa*$sudo
2022-02-14 18:47:06 2204
原创 getsockname,getpeername使用细节
getsockname/getpeername使用注意事项1.得到的结果全是0,可能原因是没有初始化len变量(unp94-96) //足够大以容纳所有受支持的协议特定的地址结构 struct sockaddr_storage storageaddr; //地址结构的长度,长度足够容纳需要的地址 int len=sizeof(storageaddr); bzero(&storageaddr,sizeof (storageaddr));
2022-02-05 15:31:54 1151
转载 apue_常用文件锁
intlock_reg(int fd, int cmd, int type, off_t offset, int whence, off_t len){ struct flock lock; lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ lock.l_start = offset; /* byte offset, relative to l_whence */ lock.l_whence = whence; /* SEEK_SET,
2021-09-09 11:18:24 132
转载 apue_守护进程重读配置文件(单线程)
#include "apue.h"#include <syslog.h>#include <errno.h>extern int lockfile(int);extern int already_running(void);voidreread(void){ /* ... */}voidsigterm(int signo){ syslog(LOG_INFO, "got SIGTERM; exiting"); exit(0);}voidsigh
2021-09-09 11:10:26 129
转载 apue_守护进程重读配置文件的一种方法(sigwait和多线程)
#include "apue.h"#include <pthread.h>#include <syslog.h>sigset_t mask;extern int already_running(void);voidreread(void){ /* ... */}void *thr_fn(void *arg){ int err, signo; for (;;) { err = sigwait(&mask, &signo);
2021-09-09 11:09:09 116
转载 apue_使用文件和记录锁来保证只运行一个守护进程的一个副本
#include <unistd.h>#include <stdlib.h>#include <fcntl.h>#include <syslog.h>#include <string.h>#include <errno.h>#include <stdio.h>#include <sys/stat.h>#define LOCKFILE "/var/run/daemon.pid"#define L
2021-09-09 11:04:52 126
转载 apue_初始化程序调用为守护进程
#include "apue.h"#include <syslog.h>#include <fcntl.h>#include <sys/resource.h>voiddaemonize(const char *cmd){ int i, fd0, fd1, fd2; pid_t pid; struct rlimit rl; struct sigaction sa; /* * Clear file creation mask.
2021-09-09 11:03:02 92
转载 2021-09-08单例守护进程实现
单例守护进程实现#include <unistd.h>#include <stdlib.h>#include <fcntl.h>#include <syslog.h>#include <string.h>#include <errno.h>#include <stdio.h>#include <sys/stat.h>//#include "apue.h"//#define LOCKFILE
2021-09-08 20:35:30 133
原创 Centos 7 下的 idea 无法输入中文的解决办法
在idea安装目录下找到/bin/idea.sh或系统中/etc/profile文件, 在文件开头加上如下内容:export XIM="ibus"export XIM_PROGRAM="ibus"export XMODIFIERS="@im=ibus"export GTK_IM_MODULE="ibus"export QT_IM_MODULE="ibus"但是只添加这些东西并没有起效果,说明系统的ibus不完整或者没有安装,从新安装一下重启就可以了sudo yum install -y ib
2021-08-21 14:16:12 764
原创 C目录操作
C语言读取文件夹内容 char dirPath[] ="/home/xxxx/TestFiles/chapeter4"; DIR* dir = opendir(dirPath); struct dirent * dirent = readdir(dir); while (dirent != NULL) { printf("%s\n",dirent->d_name); dirent = readdir(dir); }...
2021-08-05 00:04:25 175
转载 logback配置文件读取spring环境变量
logback配置文件读取spring环境变量最近做了一个springboot的本地程序,日志记录使用的是logback。而日志的记录地址是通过application.yml中配置来确定的,所以我们需要在logback中读取spring的上下文取得配置信息,还好logback已经为我们提供了相关操作springProperty。...
2021-07-27 21:58:35 2348
转载 码云 remote: error: GE007: Your push would publish a private email address.
码云 remote: error: GE007: Your push would publish a private email address.
2021-07-09 16:52:43 311
转载 MyBatis返回复杂Map结果集
MyBatis返回复杂结果集 key为指定属性,value为实体类结果集mybatis返回map,key为指定属性,value为实体类结果集
2021-07-06 17:00:17 464
原创 MyBatis调用java函数
MyBatis调用Java静态函数mappper.java@Mapper@Repositorypublic interface TestMapper { void insert(Map params); void insert2(@Param("file") String file,@Param("date") Date date);mapper.xml<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE ma
2021-07-05 22:08:13 2066
原创 ActiveMQ安装和配置(远程访问,开机自启动)
记录一下ActiveMQ使用,链接是参考的博文一、安装二、配置1.远程访问2.设置activemq开机自启动一、安装1.下载对应版本的ActiveMQ(http://archive.apache.org/dist/activemq/)2.解压文件(tar -zxvf apache-activemq-5.16.1-bin.tar.gz)3.将解压后的文件夹移动到需要的目录mv apache-activemq-5.16.1 /usr/local/4.进入bin下即可启动(./activemq s
2021-06-18 21:06:52 6269
原创 信号量-哲学家进餐问题
#include <stdio.h>#include <semaphore.h>#include <stdlib.h>#include <pthread.h>#include <unistd.h>sem_t chopsticks[5];//chopsticksvoid *PhilosopherEating(void *arg){ int index = *((int *)arg); printf("%d\n",
2021-06-16 19:32:22 185
原创 信号量-生产者消费者
#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <pthread.h>#include <semaphore.h>#include <fcntl.h>#define BuffSize 10typedef struct{ char buff[30];}Buff;Buff buf
2021-06-16 18:16:54 93
原创 信号量-和尚取水问题
#include <stdio.h>#include <pthread.h>#include <stdlib.h>#include <semaphore.h>#define Size 10sem_t bucket/*water tool 3*/,jar/*drink tool 1*/,full,empty,well;void * littleMonkF(void * arg){ while (1) { sem_wait(
2021-06-16 18:12:18 210
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人