test

8、mysql乱码问题及字符集实战

僤鯓⒐⒋嵵緔 提交于 2020-02-16 11:34:15
8.1、mysql插入中文数据乱码案例: mysql建库的字符集为latin1,客户端的字符集为utf8; use lc; 1、查看库的编码: mysql> show create database lc\G; *************************** 1. row *************************** Database: lc Create Database: CREATE DATABASE `lc` /*!40100 DEFAULT CHARACTER SET latin1 */ 2、查看表的编码: 表的字符集默认是根据库来的; mysql> show create table test\G; *************************** 1. row *************************** Table: test Create Table: CREATE TABLE `test` ( `id` int(4) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL COMMENT '姓名', `age` varchar(2) DEFAULT NULL COMMENT '年龄', PRIMARY KEY (`id`), KEY `index_name` (`name`) )

《动手学深度学习》Day2:Softmax与分类模型

爱⌒轻易说出口 提交于 2020-02-16 10:08:15
文章目录 一、softmax的基本概念 二、交叉熵损失函数 三、模型训练和预测 四、获取Fashion-MNIST训练集和读取数据 五、softmax的Pytorch简实现 5.1初始化参数和获取数据 5.2 定义网络模型 5.3 初始化模型参数 5.4 定义损失函数 5.5 定义优化函数 5.6 训练 一、softmax的基本概念 1.分类问题 一个简单的图像分类问题,输入图像的高和宽均为2像素,色彩为灰度。 图像中的4像素分别记为 x 1 , x 2 , x 3 , x 4 x_1,x_2,x_3,x_4 x 1 ​ , x 2 ​ , x 3 ​ , x 4 ​ 。 假设真实标签为狗、猫或者鸡,这些标签对应的离散值为 y 1 , y 2 , y 3 y_1,y_2,y_3 y 1 ​ , y 2 ​ , y 3 ​ 。 我们通常使用离散的数值来表示类别,例如 y 1 = 1 , y 2 = 2 , y 3 = 3 y_1=1,y_2=2,y_3=3 y 1 ​ = 1 , y 2 ​ = 2 , y 3 ​ = 3 。 2.权重矢量 3.神经网络图 下图用神经网络图描绘了上面的计算。softmax回归同线性回归一样,也是一个单层神经网络。由于每个输出 o 1 , o 2 , o 3 o_1,o_2,o_3 o 1 ​ , o 2 ​ , o 3 ​ 的计算都要依赖于所有的输入

Codeforces Round #619 (Div. 2)_A. Three Strings(C++_模拟)

删除回忆录丶 提交于 2020-02-16 10:04:27
You are given three strings a a a , b b b and c c c of the same length n n n . The strings consist of lowercase English letters only. The i i i -th letter of a a a is a i a_i a i ​ , the i i i -th letter of b b b is b i b_i b i ​ , the i i i -th letter of c c c is c i c_i c i ​ . For every i i i ( 1 ≤ i ≤ n 1 \leq i \leq n 1 ≤ i ≤ n ) you must swap (i.e. exchange) c i c_i c i ​ with either a i a_i a i ​ or b i b_i b i ​ . So in total you’ll perform exactly n n n swap operations, each of them either c i ↔ a i c_i \leftrightarrow a_i c i ​ ↔ a i ​ or c i ↔ b i c_i \leftrightarrow b_i c i ​ ↔ b i

Shell编程之test

微笑、不失礼 提交于 2020-02-16 10:03:31
test 是 Shell 内置命令,用来检测某个条件是否成立。test 通常和 if 语句一起使用,并且大部分 if 语句都依赖 test。 test 命令有很多选项,可以进行数值、字符串和文件三个方面的检测。 Shell test 命令的用法为: test expression 当 test 判断 expression 成立时,退出状态为 0,否则为非 0 值 test 命令也可以简写为[],它的用法为: [ expression ] # 注意[]和expression之间的空格,这两个空格是必须的,否则会导致语法错误。[]的写法更加简洁,比 test 使用频率高 #!/bin/bash read age if test $age -le 2; then echo "婴儿" elif test $age -ge 3 && test $age -le 8; then echo "幼儿" elif [ $age -ge 9 ] && [ $age -le 17 ]; then echo "少年" elif [ $age -ge 18 ] && [ $age -le 25 ]; then echo "成年" elif test $age -ge 26 && test $age -le 40; then echo "青年" elif test $age -ge 41 && [ $age

Shell的条件测试

♀尐吖头ヾ 提交于 2020-02-16 09:56:45
一、Shell 1、简介 这个单词的意思是“外壳的意思”,shell又被称为命令解释器。 它可以识别用户输入的各种命令,并传递给系统。和我们在终端中输入的命令类似,但功能强大的多。 shell可以是用户交互的界面,也可以说是控制系统的脚本语言。 2、Shell的分类 集中常见的Shell Bourne Shell:标识为sh,在许多Unix系统中,是root用户的默认的Shell。 Bourne-Again Shell :标识为bash,大多数Linux发行版的默认的Shell。 Korn Shell:标识为ksh,向上兼容Bourne Shell,并且包含了 C shell 的很多特性。 C Shell:标识为csh,语法上类似C语言。。 这几种shell程序,多多少少有一些区别。但是最好用的还是Bourne-Again Shell。 3、编写Shell脚本 使用vim编辑器创建一个以.sh结尾的文件。 [root@test opt] # vim HelloWorld.sh [root@test opt] # cat HelloWorld.sh #!/bin/bash #声明解释器 #The first Shell script.Start with Hello World! #注释文本 echo "HelloWorld!" #执行指令 4、运行脚本的方式 (1

分布式缓存系统Memcached简介与实践

拟墨画扇 提交于 2020-02-16 09:02:36
缘起: 在数据驱动的web开发中,经常要重复从数据库中取出相同的数据,这种重复极大的增加了数据库负载。缓存是解决这个问题的好办法。但是ASP.NET中的虽然已经可以实现对页面局部进行缓存,但还是不够灵活。此时Memcached或许是你想要的。 Memcached是什么? Memcached是由Danga Interactive开发的,高性能的,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度。 Memcached能缓存什么? 通过在内存里维护一个统一的巨大的hash表,Memcached能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等。 Memcached快么? 非常快。Memcached使用了libevent(如果可以的话,在linux下使用epoll)来均衡任何数量的打开链接,使用非阻塞的网络I/O,对内部对象实现引用计数(因此,针对多样的客户端,对象可以处在多样的状态), 使用自己的页块分配器和哈希表, 因此虚拟内存不会产生碎片并且虚拟内存分配的时间复杂度可以保证为O(1).。 Danga Interactive为提升Danga Interactive的速度研发了Memcached。目前,LiveJournal.com每天已经在向一百万用户提供多达两千万次的页面访问。而这些,是由一个由web服务器和数据库服务器组成的集群完成的

分布式缓存系统Memcached简介与实践 基于 .NET

爱⌒轻易说出口 提交于 2020-02-16 09:01:52
缘起: 在数据驱动的web开发中,经常要重复从数据库中取出相同的数据,这种重复极大的增加了数据库负载。缓存是解决这个问题的好办法。但是ASP.NET中的虽然已经可以实现对页面局部进行缓存,但还是不够灵活。此时Memcached或许是你想要的。 Memcached是什么? Memcached是由Danga Interactive开发的,高性能的,分布式的内存对象缓存系统,用于在动态应用中减少数据库负载,提升访问速度。 Memcached能缓存什么? 通过在内存里维护一个统一的巨大的hash表,Memcached能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等。 Memcached快么? 非常快。Memcached使用了libevent(如果可以的话,在linux下使用epoll)来均衡任何数量的打开链接,使用非阻塞的网络I/O,对内部对象实现引用计数(因此,针对多样的客户端,对象可以处在多样的状态), 使用自己的页块分配器和哈希表, 因此虚拟内存不会产生碎片并且虚拟内存分配的时间复杂度可以保证为O(1).。 Danga Interactive为提升Danga Interactive的速度研发了Memcached。目前,LiveJournal.com每天已经在向一百万用户提供多达两千万次的页面访问。而这些,是由一个由web服务器和数据库服务器组成的集群完成的

php class中public,private,protected的区别,以及实例

陌路散爱 提交于 2020-02-16 04:19:49
一,public,private,protected的区别 public:权限是最大的,可以内部调用,实例调用等。 protected: 受保护类型,用于本类和继承类调用。 private: 私有类型,只有在本类中使用。 二,实例 <?php error_reporting(E_ALL); class test{ public $public; private $private; protected $protected; static $instance; public function __construct(){ $this->public = 'public <br>'; $this->private = 'private <br>'; $this->protected = 'protected <br>'; } static function tank(){ if (!isset(self::$instance[get_class()])) { $c = get_class(); self::$instance = new $c; } return self::$instance; } public function pub_function() { echo "you request public function<br>"; echo $this->public;

多线程cpu affinity问题

杀马特。学长 韩版系。学妹 提交于 2020-02-16 03:20:11
为了提高多线程程序的性能,有时候需要将线程绑定到固定的cpu core上。 在这个过程中一不小心就会产生编译的问题,但是明明头文件都定义了,却依然编译通不过。 不巧我就遇到了,google也基本搜不到这个问题的解决方案,没办法,只能自己解决了。 下面这个程序就会出现这种问题: [cpp] view plaincopy #include <stdio.h> #include <pthread.h> #define __USE_GNU #include <sched.h> void mybind_cpu( int cpu_id) { cpu_set_t mask; //! sched_setaffinity CPU_ZERO(&mask); CPU_SET(cpu_id, &mask); if (sched_setaffinity(0, sizeof (cpu_set_t), &mask) < 0) { printf( "Error: cpu id %d sched_setaffinity\n" , cpu_id); printf( "Warning: performance may be impacted \n" ); } return ; } void test_thread( void *cpu_id) { int cpuid = ( int )( long )cpu_id;

6、数据库常见管理应用

心已入冬 提交于 2020-02-16 01:20:23
mysql建库的字符集为latin1,客户端的字符集为utf8; 6.1、创建数据库: 1、命令语法: create database <数据库名称>; #注意数据库名不能以数字开头; 2、命令: mysql> create database lc; Query OK, 1 row affected (0.11 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | lc | | mysql | | performance_schema | | wordpress | +--------------------+ 5 rows in set (0.19 sec) 6.2、显示数据库: 1、显示所有数据库: mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | lc | | lc1 | | lc2 | | mysql | | performance_schema | | wordpress | +--------------------+ 7 rows in