info

PHP websocket之聊天室实现

萝らか妹 提交于 2019-12-04 12:11:40
PHP部分 <?php error_reporting(E_ALL); set_time_limit(0);// 设置超时时间为无限,防止超时 date_default_timezone_set('Asia/shanghai'); class WebSocket { const LOG_PATH = '/tmp/'; const LISTEN_SOCKET_NUM = 9; /** * @var array $sockets * [ * (int)$socket => [ * info * ] * ] * todo 解释socket与file号对应 */ private $sockets = []; private $master; public function __construct($host, $port) { try { $this->master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // 设置IP和端口重用,在重启服务器后能重新使用此端口; socket_set_option($this->master, SOL_SOCKET, SO_REUSEADDR, 1); // 将IP和端口绑定在服务器socket上; socket_bind($this->master, $host, $port); //

测试

南楼画角 提交于 2019-12-04 11:41:44
If you are planning an outdoor event, you must be looking for a suitable tent. If yes, there are so many different options available these days. Renting or buying a tent will serve you well in harsh weather conditions and provide a comfy space for your guests. Also, tents are like a blank canvas where you are free to draw anything of your choice. It simply means that you can choose from a variety of tents and decorate them the way you want. Top 27 Dropshipping Tents for Sale Companies No. Company Name Offerings Location Get in Touch 1 Bargain Tents Tents Manufacturing & Sales South Africa,

springboot异步线程

北慕城南 提交于 2019-12-04 11:15:01
前言 最近项目中出现了一个问题,发现自己的定时器任务在线上没有执行,但是在线下测试时却能执行,最后谷歌到了这篇文章 SpringBoot踩坑日记-定时任务不定时了? ; 本篇文章主要以自己在项目中遇到的问题为背景,并不涉及源码; Scheduled 定时任务 Scheduled 注解的具体使用方法自行百度或谷歌,这里只是使用其中的一种方式; 验证Scheduled为单线程执行 测试代码 @Component public class TestScheduling { private static final Logger log= LoggerFactory.getLogger(TestScheduling.class); @Scheduled(initialDelay = 1000 * 60, fixedDelay = 1000 * 30) public void testOne() { //打印线程名字 log.info("ThreadName:====one====" + Thread.currentThread().getName()); } @Scheduled(initialDelay = 1000 * 60, fixedDelay = 1000 * 30) public void testTwo(){ //打印线程名字 log.info("ThreadName:===

Dom4j解析xml

China☆狼群 提交于 2019-12-04 11:03:52
转自: https://www.cnblogs.com/xq1314/p/7891778.html 1 dom4j介绍   dom4j是一个Java的XML API,类似于jdom,用来读写XML文件的。dom4j是一个非常非常优秀的Java XML API,具有性能优异、功能强大和极端易用使用的特点,同时它也是一个开放源代码的软件,可以在SourceForge上找到它。在IBM developerWorks上面可以找到一篇文章,对主流的Java XML API进行的性能、功能和易用性的评测,dom4j无论在那个方面都是非常出色的。如今你可以看到越来越多的Java软件都在使用dom4j来读写XML,特别值得一提的是连Sun的JAXM也在用dom4j。这是必须使用的jar包, Hibernate用它来读写配置文件。   dom4j主要接口都在org.dom4j这个包里定义:      Attribute Attribute定义了XML的属性   Branch Branch为能够包含子节点的节点如XML元素(Element)和文档(Docuemnts)定义了一个公共的行为,   CDATA CDATA 定义了XML CDATA 区域   CharacterData CharacterData是一个标识借口,标识基于字符的节点。如CDATA,Comment, Text.  

pom中更换阿里云仓库时不要忽略了pluginRepositories

我只是一个虾纸丫 提交于 2019-12-04 10:48:48
用maven也大几年了,也一直在用阿里云的中央仓库。 不喜欢在maven的settings.xml里改,更喜欢直接在pom.xml里改,因为受git管理,小伙伴们拉下来即可。 然而网上的大部分技术文章都只会指导你这么配置: <repositories> <repository> <id>aliyun</id> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> 如果你只是配置了repositories,那么你会发现在mvn在下载依赖的时候,一部分从阿里云下载,一部分还是从默认的仓库(https://repo.maven.apache.org )下载。 # mvn clean install [INFO] Scanning for projects... Downloading from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot

Docker采用Dockerfile方式构建Tomcat容器镜像

天涯浪子 提交于 2019-12-04 10:24:42
开启Tomcat远程部署设置 tomcat-users.xml < role rolename = "manager-gui" /> < role rolename = "manager-script" /> < user username = "tomcat" password = "password" roles = "manager-gui, manager-script" /> Dockerfile配置 FROM ubuntu: 14.04 MAINTAINER boonya <boonya @sina .com> # now add java and tomcat support in the container ADD jdk- 8 u121-linux-x64.tar.gz /usr/ local / ADD apache-tomcat- 8.5 . 16 .tar.gz /usr/ local / ADD tomcat-users.xml /usr/ local /apache-tomcat- 8.5 . 16 /conf/tomcat-users.xml # configuration of java and tomcat ENV ENV JAVA_HOME /usr/ local /jdk1. 8.0_121 ENV CLASSPATH $JAVA_HOME

移植 linux kernel 2.6.32 至 mini2440 板

橙三吉。 提交于 2019-12-04 09:54:19
1. 移植准备 1.1 获取Linux内核源代码(linux-2.6.32.tar.gz) $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.tar.gz 1.2 解压内核源代码 $ tar xvzf linux-2.6.32.tar.gz 得linux-2.6.32源代码目录 1.3 指定交叉编译变量 修改总目录下的 Makefile 原 export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= 改为: export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= arm CROSS_COMPILE ?= /usr/local/arm/4.3.2/bin/arm-linux- 其中,ARCH 是指定目标平台为 arm,CROSS_COMPILE 是指定交叉编译器 接下来,要测试一下 linux 的编译是否能正常通过。 执行: $ make s3c2410_defconfig 使用缺省内核配置文件,s3c2410_defconfig 是 SMDK2440 的 缺省配置文件 $ make 编译时间较长 编译通过,在此我们先不必烧写到开发板验证它的正确性。 2. 开始移植 2.1

通过xargs实现redis cluster批量keys操作

纵饮孤独 提交于 2019-12-04 09:41:47
通过xargs实现redis cluster批量keys操作 为什么会出现批量删除keys的脚本,那是因为redis不支持删除(DEL)带有通配符“ * ”的key,而查询支持带通配符“ * ”。 [root@localhost ~]# redis-cli -c -h 10.1.37.113 -p 7002 -a PASSWORD KEYS hello* 1) "hello8" 2) "hello5" [root@localhost ~]# redis-cli -c -h 10.1.37.113 -p 7002 -a PASSWORD DEL hello* (integer) 0 工具简介 xargs This manual page documents the GNU version of xargs. xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments

MySQL数据库管理

不问归期 提交于 2019-12-04 09:29:54
Mysql管理操作 数据库管理操作 查看数据库结构 创建及删除库和表 管理表的记录 基本操作命令 查看数据库列表信息 SHOW DATABASES [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.17 Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ |

thinkphp 文件上传

﹥>﹥吖頭↗ 提交于 2019-12-04 08:47:48
上传表单 在ThinkPHP中使用上传功能无需进行特别处理。例如,下面是一个带有附件上传的表单提交: <form action = "__URL__/upload" enctype = "multipart/form-data" method = "post" > <input type = "text" name = "name" /> <input type = "file" name = "photo" /> <input type = "submit" value = "提交" > </form> 注意,要使用上传功能 你的表单需要设置 enctype="multipart/form-data" 多文件上传支持 如果需要使用多个文件上传,只需要修改表单,把 <input type = 'file' name = 'photo' > 改为 <input type = 'file' name = 'photo1' > <input type = 'file' name = 'photo2' > <input type = 'file' name = 'photo3' > 或者 <input type = 'file' name = 'photo[]' > <input type = 'file' name = 'photo[]' > <input type = 'file'