欢迎来到 艾瑞可erik 的魔法世界 🧙‍♂️

给我一个需求,还你一个项目——别管它是什么。这就是全栈。

📚 291 篇文章 🏷️ 504 个标签 📂 90 个分类

🔥 最新文章

数据可视化:基本图表

作者: 阮一峰 “数据可视化”可以帮助用户理解数据,一直是热门方向。 图表是”数据可视化”的常用手段,其中又以基本图表——柱状图、折线图、饼图等等——最为常用。 用户非常熟悉这些图表,但如果被问道,它们的特点是什么,最适用怎样的场合(数据集)?恐怕答得上来的人就不多了。 本文是电子书《Data Visualization with JavaScript》第一章的笔记,总结了六种基本图表的特点和适用场合,非常好地回答了上面的问题。

零、序言

进入正题之前,先纠正一种误解。 有人觉得,基本图表太简单、太原始,不高端,不大气,因此追求更复杂的图表。但是,越简单的图表,越容易理解,而快速易懂地理解数据,不正是”数据可视化”的最重要目的和最高追求吗? 所以,请不要小看这些基本图表。因为用户最熟悉它们,所以只要是适用的场合,就应该考虑优先使用。

Data visualization: basic charts

Author: 阮一峰 “Data visualization” helps users understand data, and has always been a hot direction. Charts are a common means of “data visualization”, among which the basic charts——bar chart, line chart, pie chart and so on——are the most commonly used. Users are very familiar with these charts, but if asked what their characteristics are and which occasions (data sets) they suit best, probably not many people could answer. This article is a note on the first chapter of the e-book 《Data Visualization with JavaScript》, summarizing the characteristics and applicable occasions of six basic charts, and answering the above question very well.

Zero. Preface

Before getting to the point, let me first correct a misconception. Some people feel that basic charts are too simple, too primitive, not high-end or impressive, and therefore pursue more complex charts. But the simpler the chart, the easier it is to understand, and quickly and easily understanding data is precisely the most important purpose and highest pursuit of “data visualization”, isn’t it? So please don’t look down on these basic charts. Because users are most familiar with them, wherever they are applicable you should consider using them first.

关于PHP浮点数你应该知道的(All ‘bogus’ about the float in PHP)

PHP是一种弱类型语言, 这样的特性, 必然要求有无缝透明的隐式类型转换, PHP内部使用zval来保存任意类型的数值, zval的结构如下(5.2为例):

1
2
3
4
5
6
7
struct \_zval\_struct {
    /\* Variable information */
    zvalue_value value; /\* value */
    zend_uint refcount;
    zend_uchar type; /\* active type */
    zend_uchar is_ref;
};

What you should know about PHP floats (All ‘bogus’ about the float in PHP)

PHP is a weakly typed language, and this characteristic inevitably requires seamless and transparent implicit type conversion. Internally, PHP uses zval to store values of any type. The structure of zval is as follows (5.2 as an example):

1
2
3
4
5
6
7
struct \_zval\_struct {
    /\* Variable information */
    zvalue_value value; /\* value */
    zend_uint refcount;
    zend_uchar type; /\* active type */
    zend_uchar is_ref;
};

linux下使用tar命令

解压 语法:tar [主选项+辅选项] 文件或者目录 使用该命令时,主选项是必须要有的,它告诉tar要做什么事情,辅选项是辅助使用的,可以选用。

主选项:

c 创建新的档案文件。如果用户想备份一个目录或是一些文件,就要选择这个选项。相当于打包。

x 从档案文件中释放文件。相当于拆包。

t 列出档案文件的内容,查看已经备份了哪些文件。

特别注意,在参数的下达中, c/x/t 仅能存在一个!不可同时存在!因为不可能同时压缩与解压缩。

Using the tar Command on Linux

Extraction Syntax: tar [main options + auxiliary options] file or directory. When using this command, the main option is mandatory — it tells tar what to do. The auxiliary options are supporting ones and are optional.

Main options:

c Create a new archive file. If the user wants to back up a directory or some files, this is the option to choose. Equivalent to packing.

x Release files from the archive file. Equivalent to unpacking.

t List the contents of the archive file, to see which files have already been backed up.

Note in particular that among the parameters issued, only one of c/x/t can exist! They cannot exist at the same time! Because it’s impossible to compress and decompress at the same time.

实用的PHP正则表达式

正则表达式是程序开发中一个重要的元素,它提供用来描述或匹配文本的字符串,如特定的字符、词或算式等。但在某些情况下,用正则表达式去验证一个字符串比较复杂和费时。本文为你介绍10种常见的实用PHP正则表达式的写法,希望对你的工作有所帮助。 1. 验证E-mail地址 这是一个用于验证电子邮件的正则表达式。但它并不是高效、完美的解决方案。在此不推荐使用。

Php代码

1
2
3
4
5
6
$email = "test@ansoncheung.tk";
if (preg_match('/^\[^0-9\]\[a-zA-Z0-9_\]+(\[.\]\[a-zA-Z0-9_\]+)*\[@\]\[a-zA-Z0-9_\]+(\[.\]\[a-zA-Z0-9_\]+)*\[.\]\[a-zA-Z\]{2,4}$/',$email)) {
    echo "Your email is ok.";
} else {
    echo "Wrong email address format";
}

Practical PHP Regular Expressions

Regular expressions are an important element in program development; they provide strings used to describe or match text, such as specific characters, words, or expressions. But in some cases, using a regular expression to validate a string is fairly complicated and time-consuming. This article introduces 10 common and practical ways to write PHP regular expressions, and I hope they are helpful in your work. 1. Validate an E-mail address This is a regular expression used to validate email. But it is not an efficient, perfect solution. Its use is not recommended here.

Php code

1
2
3
4
5
6
$email = "test@ansoncheung.tk";
if (preg_match('/^\[^0-9\]\[a-zA-Z0-9_\]+(\[.\]\[a-zA-Z0-9_\]+)*\[@\]\[a-zA-Z0-9_\]+(\[.\]\[a-zA-Z0-9_\]+)*\[.\]\[a-zA-Z\]{2,4}$/',$email)) {
    echo "Your email is ok.";
} else {
    echo "Wrong email address format";
}

分析师为Fire Phone发展支招 三步骤或起死回生

12月8日消息,亚马逊集团董事会主席兼CEO杰夫·贝佐斯(Jeff Bezos)表示,亚马逊将会发布更多款的智能手机。外界希望他能从亚马逊Fire Phone的惨痛失败中接受教训并汲取经验。这款手机的失败导致亚马逊从众多手机制造商中脱颖而出的想法变得愈加难以实现。 关于亚马逊的Fire Phone,有两点值得注意。

Analysts Offer Advice on the Fire Phone's Future: Three Steps That Could Bring It Back to Life

News from December 8: Amazon chairman and CEO Jeff Bezos says Amazon will release more smartphones. The outside world hopes he has taken the lessons of the Fire Phone’s painful failure to heart. That failure has made Amazon’s ambition of standing out from the crowd of phone makers harder and harder to realize. There are two things worth noting about the Amazon Fire Phone.

(转)数据库表分割技术浅析

一.水平分割 什么是水平分割?打个比较形象的比喻,在食堂吃 饭的时候,只有一个窗口,排队打饭的队伍太长了,都排成S型了,这时容易让排队的人产生焦虑情绪,容易产生混乱,这时一个管理者站出来,增加多个打饭窗 口,把那条长长的队伍拦腰截断成几队。更形象一点的理解,你拿一把“手术刀”,把一个大表猛的切了几刀,结果这个大表,变成了几个小表. 水平分割根据某些条件将数据放到两个或多个独立 的表中。即按记录进分分割,不同的记录可以分开保存,每个子表的列数相同。水平切割将表分为多个表。每个表包含的列数相同,但是数据行更少。

(Repost) A Brief Analysis of Database Table Partitioning Techniques

1. Horizontal Partitioning What is horizontal partitioning? A rather vivid analogy: when you eat in a canteen there is only one window, and the queue for food gets so long that it coils into an S shape, which easily makes the people in line anxious and prone to chaos. Then a manager steps up, adds several more serving windows, and cuts that long queue in half into several lines. To put it even more vividly: you take a “scalpel” and slash a big table a few times, and the big table turns into several small tables. Horizontal partitioning places data into two or more independent tables according to certain conditions. That is, it partitions by records — different records can be stored separately, and each sub-table has the same number of columns. Horizontal splitting divides a table into multiple tables. Each table contains the same number of columns, but fewer data rows.

onethink中路径去掉home

最近一直在开发一个中型项目,就用onethink了,后来发现路径优化问题老是困扰,反复百度查询后,今早突然变好了。 反复分析一下原因,原来是没清楚缓存。 具体更改方法如下 首先找到公共config.php文件,在项目Application\Common\Conf下,在 代码如下

      'MODULE\_ALLOW\_LIST'  => array('Home','Admin'), 
      'URL\_ROUTER\_ON' => true, 
      'URL\_ROUTE\_RULES'=>array( 
      'index' => 'Index/index', //首页 
      'article/:id\\d$' => 'Article/detail', //文章页 
      ':category$'=> 'Article/lists' //列表页 ),

然后在找到URL_MODEL把后面的3改为2,同时复制这一行代码 粘贴到Application\Home\Conf下的confi.php 代码如下

        'URL\_MODEL'            => 2, //URL模式         

然后清空缓存,缓存位置在项目Runtime\Cache\Home文件下删除所有的文件 刷新浏览器后路径中home不见了。 笔者在这想说onethink框架还是不错的,基于thinkphp3.2开发的,非常便捷。

Removing 'home' from the Path in onethink

I’ve been developing a medium-sized project for a while now, and I used onethink for it. Later I found that the path optimization issue kept bugging me; after searching on Baidu over and over, it suddenly worked this morning. After analyzing the reason again and again, it turned out I simply hadn’t cleared the cache. The specific way to change it is as follows. First find the common config.php file, which is under Application\Common\Conf in the project, and in it the code is as follows

      'MODULE\_ALLOW\_LIST'  => array('Home','Admin'), 
      'URL\_ROUTER\_ON' => true, 
      'URL\_ROUTE\_RULES'=>array( 
      'index' => 'Index/index', //首页 
      'article/:id\\d$' => 'Article/detail', //文章页 
      ':category$'=> 'Article/lists' //列表页 ),

Then find URL_MODEL and change the 3 after it to 2, and at the same time copy this line of code and paste it into confi.php under Application\Home\Conf. The code is as follows

        'URL\_MODEL'            => 2, //URL mode         

Then clear the cache — the cache is under Runtime\Cache\Home in the project, so delete all the files in there. After refreshing the browser, home is gone from the path. Here I’d like to say that the onethink framework is still a good one; it’s built on thinkphp3.2 and is very convenient.

php类的声明

回想一下学习php这么久以来,刚开始那会一直搞不懂类、内部属性、外部属性现在从头来个详细的介绍。 代码如下 <?php header(“content-type:text/html;charset=utf-8”); class guests{//声明一个类guests private $name; //私有属性 private $gender; function setname($name){ $this->name=$name; } function getname(){ return $this->name; //返回姓名 } function setgender($gender){ $this->gender=$gender; } function getgender(){ return $this->gender; //返回性别 } }; $xiaoming=new guests; $xiaoming->setname(“王小明”); $xiaoming->setgender(“男”); $lili=new guests; $lili->setname(“莉莉”); $lili->setgender(“女”); echo $xiaoming->getname().”\t”.$xiaoming->getgender().”
“; echo $lili->getname().”\t”.$lili->getgender(); ?>

Declaring a PHP Class

Thinking back over how long I have been learning PHP, at the very beginning I never could figure out classes, internal properties, and external properties. So now let’s go through a detailed introduction from the start. The code is as follows <?php header(“content-type:text/html;charset=utf-8”); class guests{//declare a class guests private $name; //private property private $gender; function setname($name){ $this->name=$name; } function getname(){ return $this->name; //return the name } function setgender($gender){ $this->gender=$gender; } function getgender(){ return $this->gender; //return the gender } }; $xiaoming=new guests; $xiaoming->setname(“王小明”); $xiaoming->setgender(“男”); $lili=new guests; $lili->setname(“莉莉”); $lili->setgender(“女”); echo $xiaoming->getname().”\t”.$xiaoming->getgender().”
“; echo $lili->getname().”\t”.$lili->getgender(); ?>

seajs

偶然在一群里知道了seajs,百度详细介绍了: SeaJS的作者是前淘宝UED,现支付宝前端工程师玉伯。 SeaJS本身遵循KISS(Keep It Simple, Stupid)理念进行开发,其本身仅有个位数的API,因此学习起来毫无压力。在学习SeaJS的过程中,处处能感受到KISS原则的精髓——仅做一件事,做好一件事。 自己没试试效果,从示例代码中感觉还可以吧,希望能给小伙伴一些帮助 官网http://seajs.org/docs/ 最新版下载http://download.csdn.net/download/w15875510692/8213435

SeaJS

I happened to learn about seajs in a group chat, and Baidu introduced it in detail: the author of SeaJS is Yubo, formerly of Taobao UED and now a front-end engineer at Alipay. SeaJS itself is developed following the KISS (Keep It Simple, Stupid) philosophy, and it has only a single-digit number of APIs, so learning it is completely stress-free. In the process of learning SeaJS, you can feel the essence of the KISS principle everywhere — do only one thing, and do it well. I haven’t tried it out for myself yet, but from the sample code it seems decent enough. I hope it can help some of you. Official site http://seajs.org/docs/ Download the latest version http://download.csdn.net/download/w15875510692/8213435