macOS 使用 Homebrew 安装 Python 3 作者: Chuwen 时间: 2020-11-24 分类: macOS 评论 # 首先搜索可用 Python 版本 ```shell brew search python ``` > 啪的一下很快啊,搜到了: ```shell chuwen@Chuwen-MBP ~ % brew search python ==> Formulae app-engine-python micropython python@3.9 boost-python python-markdown reorder-python-imports boost-python3 python-yq wxpython gst-python python@3.7 ipython python@3.8 ==> Casks awips-python kk7ds-python-runtime mysql-connector-python If you meant "python" specifically: It was migrated from homebrew/cask to homebrew/core. ``` # 我这里需要安装 3.7 版本的,所以: ```shell brew install python@3.7 ``` # 安装完成,验证安装(查看版本号?) ```shell chuwen@Chuwen-MBP ~ % python3 --version Python 3.8.2 ```
Laravel 安装指定版本 作者: Chuwen 时间: 2020-11-23 分类: PHP 评论 ```shell composer create-project --prefer-dist laravel/laravel blog "6.*" ```
让 Typecho 文章支持 Emoji 表情输出 作者: Chuwen 时间: 2020-11-23 分类: 唠嗑闲聊 评论 > 转载自:https://blog.laoooo.cn:88/emoji.html > 原因,最近换上了 macOS ?,自带的输入打出一些关键字会提示一些 Emoji 表情,写博客的时候用上感觉能使页面好看?、亲切些 --- Emoji ===== Emoji表情随着IOS的普及和微信的支持越来越常见,比如这些比较常见的表情:⭐️ ✨ ⚡️。所谓Emoji就是一种在Unicode位于`\u1F601`-`\u1F64F`区段的字符。这个显然超过了目前常用的UTF-8字符集的编码范围u0000-uFFFF。在 MySQL 中,UTF-8只支持最多 3 个字节,而 emoji 是 4 个字节。 原理 == Typecho默认不支持emoji表情,其实不是程序的锅,而是由于编码的问题,只需要将默认的数据库编码utf8修改为utf8mb4即可,当然别忘了,utf8mb4编码只有在PHP5.5以后才支持。 目标 == 简单两步即可让typecho支持emoji 方法 == 1.修改数据库编码 进入`PhpMyadmin`,选择您的数据库,操作 → 整理 → 选择`utf8mb4_unicode_ci` 2.修改数据库表编码 直接运行以下`sql`语句 ```sql alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci; ``` 3.修改数据库配置文件 网站`根目录`数据库配置文件`config.inc.php`,下面是示例: ```php $db->addServer(array ( 'host' => localhost, 'user' => 'youruser', 'password' => 'yourpassword', 'charset' => 'utf8mb4', //修改这一行 utf8 -> utf8mb4 'port' => 3306, 'database' => 'yourdatabase' ), Typecho_Db::READ | Typecho_Db::WRITE); ```
【阿里云镜像】macOS 安装 composer 作者: Chuwen 时间: 2020-11-23 分类: macOS 评论 # 下载 > 由于在官网下载 `composer` 比较慢,所以我们可以使用 **阿里云 Composer 全量镜像** 下载 > 但我还是贴出 *官方下载&安装:`curl -sS getcomposer.org/installer | php`* ```shell # 下载 composer.phar curl https://mirrors.aliyun.com/composer/composer.phar -O composer.phar # 检查版本号 php composer.phar -v ``` # 如果需要全局使用 > 可以移动 `composer.phar` 到 `/usr/local/bin/` 路径下 ```shell sudo mv composer.phar /usr/local/bin/composer ``` ## 可能因为权限问题,直接执行 `composer` 会报权限不够 ```log chuwen@WenzhoudeMBP cms.iton.pw % composer -v zsh: permission denied: composer ``` ## 设置下权限即可 ```log sudo chomd -R 755 /usr/local/bin/composer ``` # 测试(输出版本号) > 记得往下,改 `阿里云 Composer 镜像源`,安装项目起飞?️ ```shel chuwen@WenzhoudeMBP cms.iton.pw % composer -v ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 2.0.7 2020-11-13 17:31:06 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. --no-cache Prevent use of the cache -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: about Shows the short information about Composer. archive Creates an archive of this composer package. browse Opens the package's repository URL or homepage in your browser. cc Clears composer's internal package cache. check-platform-reqs Check that platform requirements are satisfied. clear-cache Clears composer's internal package cache. clearcache Clears composer's internal package cache. config Sets config options. create-project Creates new project from a package into given directory. depends Shows which packages cause the given package to be installed. diagnose Diagnoses the system to identify common errors. dump-autoload Dumps the autoloader. dumpautoload Dumps the autoloader. exec Executes a vendored binary/script. fund Discover how to help fund the maintenance of your dependencies. global Allows running commands in the global composer dir ($COMPOSER_HOME). help Displays help for a command home Opens the package's repository URL or homepage in your browser. i Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. info Shows information about packages. init Creates a basic composer.json file in current directory. install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. licenses Shows information about licenses of dependencies. list Lists commands outdated Shows a list of installed packages that have updates available, including their latest version. prohibits Shows which packages prevent the given package from being installed. remove Removes a package from the require or require-dev. require Adds required packages to your composer.json and installs them. run Runs the scripts defined in composer.json. run-script Runs the scripts defined in composer.json. search Searches for packages. self-update Updates composer.phar to the latest version. selfupdate Updates composer.phar to the latest version. show Shows information about packages. status Shows a list of locally modified packages. suggests Shows package suggestions. u Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. update Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. upgrade Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. validate Validates a composer.json and composer.lock. why Shows which packages cause the given package to be installed. why-not Shows which packages prevent the given package from being installed. ``` # 切换成 阿里云 Composer 镜像源 ## 1. 全局配置(推荐) ```shell composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ # 取消当前项目配置 composer config --unset repos.packagist ``` ## 2. 仅在当前项目配置 ```shell composer config repo.packagist composer https://mirrors.aliyun.com/composer/ # 取消全局配置 composer config -g --unset repos.packagist ```
MySQL 常用语句笔记 作者: Chuwen 时间: 2020-11-21 分类: MySQL 评论 # 创建唯一索引,并按照降序排序 ```sql CREATE UNIQUE INDEX QueID ON t_question(ID DESC) # CREATE UNIQUE INDEX 自定义索引字段名 ON 表名(索引字段 DESC) # 升序 # CREATE UNIQUE INDEX 自定义索引字段名 ON 表名(索引字段 ASC) ``` # 修改字段名 ```sql ALTER TABLE `t_question` CHANGE `Score` `Point` int default '0'; # ALTER TABLE 需要修改的表名 CHANGE 旧字段 新字段 int default '0'; # ALTER TABLE 需要修改的表名 CHANGE 旧字段 新字段 新字段数据类型 default '默认值'; ``` # 事务控制,开启事务 ```sql start transaction;#开始事务 Update t_question set Del=1 where ID=1;#更新字段值 rollback;#事务回滚 Select * from t_question;#查看修改结果 ``` # 创建存储过程 ```sql Delimiter $$ # 声明语句开始 Create PROCEDURE xinzeng() #声明存储过程 BEGIN #开始代码 Insert into t_question(Type,ItemContent,Analysis,Del) values(0,'新增试题','存储过程',0); Insert into t_option(QuestionID,Num,OptionContent,IsTrue) values('1','0','新增选项','1'); END #结束代码 delimiter; # 声明语句结束 # 调用存储过程 CALL xinzeng() # 删除存储过程 # DROP PROCEDURE xinzeng; ``` # 升降序关键字 **降序** `DESC`,**升序** `ASC`