Month: November 2018

javascript: 数字格式化, 数字处理, formatting numbers, manipulating ,Numeral.js

  项目地址:https://github.com/adamwdraper/Numeral-js Use it In the Browser <script src="numeral.min.js"></script> 或者使用CDN文件 <script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script> In Node.js npm install numeral var numeral = require('numeral'); 创建 创建数字的实例。数字采用它转换为… Read More

压力测试和评测工具 Siege

压力测试和评测工具 Siege 目录 Web性能压力测试工具之Siege详解: http://www.ha97.com/4663.html 系统吞吐量(TPS)、用户并发量、性能测试概念和公式:http://www.ha97.com/5095.html Siege官网:http://www.joedog.org/ 下载地址 siege: http://www.joedog.org/pub/siege/ Sproxy: http://www.joedog.org/pub/sproxy/ 压力测试工具siege的用法:http://buzheng.org/blog/usage-of-siege.html Siege是… Read More

mongodb 联表查询方法, PHP操作远程mongodb数据库

  本篇是 PHP操作远程mongodb数据库, MongoDB PHP Library, php connects with remote MongoDB 的延伸:   这里只对同库联表查询做介绍,跨库联表查询可能在之后也会介绍(因为公司架构变动,之后可能会联表查询) 我用到的联表查询有两种,一种是mongoose的populate,一种是$lookup populate populate是使用外键关联子表 例如现在有一张订单表结构(动态外键): var orderSchema = new mongoose.Schema({ uid: { type: String, required: true }, // 用户id amount… Read More

安装不同版本的PHP, 更换PHP默认版本, PHP多版本安装, How to Install Different PHP (5.6, 7.0 and 7.1) Versions in Ubuntu

  PHP(PHP的递归缩写:Hypertext Preprocessor)是一种开源的,流行的通用脚本语言,广泛使用并且最适合开发网站和基于Web的应用程序。它是一种可以嵌入HTML的服务器端脚本语言。 目前,有三种受支持版本的PHP,即PHP 5.6,7.0和7.1。含义PHP 5.3,5.4和5.5都达到了生命的尽头; 安全更新不再支持它们。 在本文中,我们将解释如何使用OndřejSurýPPA在Ubuntu及其衍生产品中安装所有受支持的PHP版本,以及Apache和Nginx Web服务器的大多数请求的PHP扩展。我们还将解释如何设置要在Ubuntu系统上使用的PHP的默认版本。 请注意… Read More

jQuery插件:带遮罩无限循环loading加载动画插件, jQuery LoadingOverlay

官网:https://gasparesganga.com/labs/jquery-loading-overlay/ 项目:https://github.com/gasparesganga/jquery-loading-overlay Get it 获取 GitHub View project on GitHub or download the latest release. npm npm install gasparesganga-jquery-loading-overlay Bower bower install gasparesganga-jquery-loading-overlay CDN https://cdn.jsdeli… Read More

PHP: 控制循环执行次数, do…while与while , goto 跳转位置, if not repeat running

do-while (PHP 4, PHP 5, PHP 7) do-while 循环和 while 循环非常相似,区别在于表达式的值是在每次循环结束时检查而不是开始时。和一般的 while 循环主要的区别是 do-while的循环语句保证会执行一次(表达式的真值在每次循环结束后检查),然而在一般的 while 循环中就不一定了(表达式真值在循环开始时检查,如果一开始就为 FALSE 则整个循环立即终止)。 do-while 循环只有一种语法: <?php $i = 0; do { echo $i; } while ($i > 0); ?> 以上循环将正好运行一次,因为经过第一次循环后,当检查表达式的真值时,其值为 FAL… Read More

Ubunut安装Spotify, Spotify for Linux

  两个办法: 通过 Spotify in Ubuntu Software 点击安装 通过命令行: Snap snap install spotify If you run another Linux distribution than Ubuntu, first see https://snapcraft.io/ for how to install snap, then run the command above. Debian # 1. Add the Spotify repository signing keys to be able to verify downloaded packages sudo apt-key adv --keyserver hkp://keyse… Read More

jquery.serializeJSON: 包含未勾选的checkboxes, Problem with checkbox checked,

  jquery.serializeJSON 是什么? 怎么用? 请参看:JQuery: 提交表单数据,转换表单数据为json,values of Form to Json (jquery.serializeJSON)   当我们使用: <input type="checkbox" name="show" value="true" checked> 的时候, 当这个input没有被选中的话,那么默认将不会传值,也就是说,没有被选中(unchecked)的话,这个input的数据将不会被提交。 如果有需要想要提交的话,那么有以下三种方法:  默认的方法:写一个hidden输入框,并且name标签取一样… Read More

ssh 登录报错 packet_write_wait: Connection to x.x.x.x port 22: Broken pipe

问题现象 用 ssh 命令连接服务器之后,如果一段时间不操作,再次进入 Terminal 时会有一段时间没有响应,然后就出现错误提示: packet_write_wait: Connection to x.x.x.x port 22: Broken pipe 只能重新用 ssh 命令进行连接。   解决方法 方法一:如果您有多台服务器,不想在每台服务器上设置,只需在客户端的 ~/.ssh/ 文件夹中添加 config 文件,并添加下面的配置: ServerAliveInterval 60   方法二:如果您有多台个人管理服务器,不想在每个客户端进行设置,只需在服务器的 /etc/ssh/sshd_config 中添加如下的配置: C… Read More

报错:CodeIgniter Disallowed Key Characters, disallowed key characters

改用一下的正则表达式 !preg_match("/^[a-z0-9\x{4e00}-\x{9fa5}\:\;\.\,\?\!\@\#\$%\^\*\"\~\'+=\\\ &_\/\.\[\]-\}\{]+$/iu", $str) 修改 Input.php 或者创建自己的 MY_Input.php , 如下: <?php class MY_Input extends CI_Input { /** * Clean Keys * * This is a helper function. To prevent malicious users * from trying to exploit keys we make sure that keys are