最基础的python socket demo
基础部分server1234567891011121314151617181920212223import socketdef socket_server(): HOST = '0.0.0.0' PORT = 5001 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 定义socket类型,网络通信,TCP s.bind((HOST, PORT)) s.listen(1) # 开始TCP监听,监听1个请求 print("listening ... ") while 1: conn, addr = s.accept() # 接受TCP连接,并返回新的套接字与IP地址 print('Connected by', addr) # 输出客户端的IP地址 conn.send(bytes("Connected success", encoding='utf- ...
conda环境迁移
打包某个python环境在打包之前如果没有conda-pack包的话,需要安装pip install conda-pack
进行python环境打包:1conda pack -n py36 -o py366.tar.gz
Py36是需要打包的已存在的python环境,py366.tar.gz是我们打包后压缩包的名称
使用包解压缩py366.tar.gz:
12mkdir py366tar -zxvf py366.tar.gz -C py366
激活环境:
1conda activate py366
分享虚拟环境conda方式导出当前虚拟环境
1conda env export > environment.yml
创建保存的虚拟环境
1conda env create -f environment.yml
pip方式12pip freeze > requirements.txtpip install -r requirements.txt
java实现get or post请求
微信支付核心代码PayUtil.java123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180package com.yaofang.utils;import com.wechat.pay. ...
c语言 高精度运算
核心思想为用字符串标识数字的每一位,并模拟c语言的底层运算
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<Windows.h>char a[100000] = { 0 }, b[100000] = { 0 }, c[100000] = { 0 };int main(){ char help[10] = { 0 }; int i, j, k, len; int n; printf("input:\n"); scanf("%d", &n); len = 1; b[0] = 1; fo ...
c语言 "生命游戏"
生命游戏123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101#include<stdio.h>#include<stdlib.h>#include<windows.h>#include<time.h>#define H 30#define W 40int map[H][W]={0};void make_map(void){ int tool; srand((unsigned)time(NULL)); for(int i=1;i<H-1;i++) { for(int j=1;j<W-1;j++) { ...
spring 切入点表达式
切入点表达式切入点表达式作用:知道对哪个类里面的哪个方法进行增强语法结构: execution(<权限修饰符> <返回类型> <类全路径> <方法名称>(<参数列表>) )
举例 1:对 com.atguigu.dao.BookDao 类里面的 add 进行增强1execution(* com.atguigu.dao.BookDao.add(..))
举例 2:对 com.atguigu.dao.BookDao 类里面的所有的方法进行增强1execution(* com.atguigu.dao.BookDao.* (..))
举例 3:对 com.atguigu.dao 包里面所有类,类里面所有方法进行增强1execution(* com.atguigu.dao.*.* (..))
spring AOP 注解开发
AOP 操作(AspectJ 注解)1. 创建类,在类里面定义方法1234public class User { public void add() { System.out.println("add......."); } }
2. 创建增强类(编写增强逻辑)123456//(1)在增强类里面,创建方法,让不同方法代表不同通知类型//增强的类public class UserProxy { public void before() {//前置通知 System.out.println("before......");}
3. 进行通知的配置
在 spring 配置文件中,开启注解扫描12345678910111213<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/bean ...
maven resources过滤
来自@狂神说
pom.xml1234567891011121314151617181920<build> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/java</directory&g ...
java与安卓socket通讯
原生java socket通讯server端start.java123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 ...
flask-websocket
项目结构
web-socketiosocketio.js github下载地址
1https://github.com/socketio/socket.io/blob/main/client-dist/socket.io.js
index.html1234567891011121314151617181920212223242526272829<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script src="/static/js/socketio_v4.5.1.js"></script></head><body></body><script> var websocket_url = 'http://' + documen ...