分析SQL执行带来的开销是优化SQL的重要手段。在MySQL数据库中,可以通过配置profiling参数来启用SQL剖析。该参数可以在全局和session级别来设置。对于全局级别则作用于整个MySQL实例,而session级别紧影响当前session。该参数开启后,后续执行的SQL语句都将记录其资源开销,诸如IO,上下文切换,CPU,Memory等等。根据这些开销进一步分析当前SQL瓶颈从而进行优化与调整。

1.有关profile的解释
--当前版本
mysql> show variables like 'version';
+---------------+------------+
| Variable_name | Value |
+---------------+------------+
| version | 5.5.29-log |
+---------------+------------+ --查看profiling系统变量
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| profiling | OFF | --开启SQL语句剖析功能。0或OFF表示关闭(默认模式)。1或ON表示开启
| profiling_history_size | 15 | --设置保留profiling的数目,缺省为15,范围为0至100,为0时将禁用profiling。这个参数在MySQL 5.6.8过期,在后期版本中会被移除。
+------------------------+-------+ 如果将profiling_history_size参数设置为0,同样具有关闭MySQL的profiling效果。 --获取profile的帮助
mysql> help profile;
Name: 'SHOW PROFILE'
Description:
Syntax:
SHOW PROFILE [type [, type] ... ]
[FOR QUERY n] --如果不指定,只是显示最近执行的语句;如果指定会显示语句n,n对应query_id的值
[LIMIT row_count [OFFSET offset]] type:
ALL --显示所有的开销信息
| BLOCK IO --显示块IO相关开销
| CONTEXT SWITCHES --上下文切换相关开销
| CPU --显示CPU相关开销信息
| IPC --显示发送和接收相关开销信息
| MEMORY --显示内存相关开销信息
| PAGE FAULTS --显示页面错误相关开销信息
| SOURCE --显示和Source_function,Source_file,Source_line相关的开销信息
| SWAPS --显示交换次数相关开销的信息 Profiling由会话级别参数profiling控制。缺省是显示状态和持续时间。
上面描述从5.6.7开始该命令将会被移除,用Performance Schema instead代替 2、开启porfiling --启用session级别的profiling
mysql> set profiling=1;
Query OK, 0 rows affected, 1 warning (0.00 sec) --验证修改后的结果
mysql> show variables like '%profil%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| profiling | ON |
| profiling_history_size | 15 |
+------------------------+-------+ --执行SQL查询
mysql> show databases;
mysql> show tables;
mysql> select count(*) from emp --查看当前session所有已产生的profile
mysql> show profiles;
+----------+------------+-------------------------------------------------------+
| Query_ID | Duration | Query |
--------------------------------------------------------------------------------+
| 1 | 0.00037700 | show variables like '%profil%' |
| 2 | 0.00029500 | show databases |
| 3 | 0.00030800 | show tables |
| 4 | 0.00135700 | select count(*) from emp
+----------+------------+-------------------------------------------------------+ 3、获取SQL语句的开销信息 --可以直接使用show profile来查看上一条SQL语句的开销信息
--注,show profile之类的语句不会被profiling,即自身不会产生Profiling
mysql> show profile;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ --显示所有性能信息
mysql> show profile all for query 9;
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+
| Status | Duration | CPU_user | CPU_system | Context_voluntary | Context_involuntary | Block_ops_in | Block_ops_out | Messages_sent | Messages_received | Page_faults_major | Page_faults_minor | Swaps | Source_function | Source_file | Source_line |
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+
| starting | 0.000997 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | NULL | NULL | NULL |
| Opening tables | 0.000015 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_base.cc | 4622 |
| System lock | 0.000003 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | lock.cc | 260 |
| Table lock | 0.000515 | 0.001000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | lock.cc | 271 |
| optimizing | 0.000093 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 835 |
| statistics | 0.151343 | 0.124981 | 0.023996 | 1 | 155 | 0 | 0 | 0 | 0 | 0 | 39 | 0 | unknown function | sql_select.cc | 1026 |
| preparing | 0.000082 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1048 |
| executing | 0.000027 | 0.000000 | 0.000000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1789 |
| Sending data | 0.081436 | 0.072989 | 0.006999 | 0 | 82 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2347 |
| init | 0.000024 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2537 |
| optimizing | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 835 |
| statistics | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1026 |
| preparing | 0.000007 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1048 |
| executing | 0.000005 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 1789 |
| Sending data | 0.000046 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2347 |
| end | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 2583 |
| query end | 0.000003 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 5123 |
| freeing items | 0.000076 | 0.001000 | 0.000000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 6147 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 10929 |
| closing tables | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_select.cc | 10954 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 1735 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | unknown function | sql_parse.cc | 1703 |
+--------------------+----------+----------+------------+-------------------+---------------------+--------------+---------------+---------------+-------------------+-------------------+-------------------+-------+------------------+---------------+-------------+ --获取指定查询的开销
mysql> show profile for query 9;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ mysql> show profile for query 9 limit 3;
+----------------+----------+
| Status | Duration |
+----------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
+----------------+----------+ mysql> show profile for query 9 limit 3 offset 5;
+------------+----------+
| Status | Duration |
+------------+----------+
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
+------------+----------+ --查看特定部分的开销,如下为CPU部分的开销
mysql> show profile cpu for query 9;
+--------------------+----------+----------+------------+
| Status | Duration | CPU_user | CPU_system |
+--------------------+----------+----------+------------+
| starting | 0.000997 | 0.000000 | 0.000000 |
| Opening tables | 0.000015 | 0.000000 | 0.000000 |
| System lock | 0.000003 | 0.000000 | 0.000000 |
| Table lock | 0.000515 | 0.001000 | 0.000000 |
| optimizing | 0.000093 | 0.000000 | 0.000000 |
| statistics | 0.151343 | 0.124981 | 0.023996 |
| preparing | 0.000082 | 0.000000 | 0.000000 |
| executing | 0.000027 | 0.000000 | 0.000000 |
| Sending data | 0.081436 | 0.072989 | 0.006999 |
| init | 0.000024 | 0.000000 | 0.000000 |
| optimizing | 0.000006 | 0.000000 | 0.000000 |
| statistics | 0.000006 | 0.000000 | 0.000000 |
| preparing | 0.000007 | 0.000000 | 0.000000 |
| executing | 0.000005 | 0.000000 | 0.000000 |
| Sending data | 0.000046 | 0.000000 | 0.000000 |
| end | 0.000004 | 0.000000 | 0.000000 |
| query end | 0.000003 | 0.000000 | 0.000000 |
| freeing items | 0.000076 | 0.001000 | 0.000000 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 |
| closing tables | 0.000004 | 0.000000 | 0.000000 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 |
+--------------------+----------+----------+------------+ --如下为MEMORY部分的开销
mysql> show profile memory for query 9 ;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000997 |
| Opening tables | 0.000015 |
| System lock | 0.000003 |
| Table lock | 0.000515 |
| optimizing | 0.000093 |
| statistics | 0.151343 |
| preparing | 0.000082 |
| executing | 0.000027 |
| Sending data | 0.081436 |
| init | 0.000024 |
| optimizing | 0.000006 |
| statistics | 0.000006 |
| preparing | 0.000007 |
| executing | 0.000005 |
| Sending data | 0.000046 |
| end | 0.000004 |
| query end | 0.000003 |
| freeing items | 0.000076 |
| removing tmp table | 0.000006 |
| closing tables | 0.000004 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------+----------+ --同时查看不同资源开销
mysql> show profile block io,cpu for query 9;
+--------------------+----------+----------+------------+--------------+---------------+
| Status | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |
+--------------------+----------+----------+------------+--------------+---------------+
| starting | 0.000997 | 0.000000 | 0.000000 | 0 | 0 |
| Opening tables | 0.000015 | 0.000000 | 0.000000 | 0 | 0 |
| System lock | 0.000003 | 0.000000 | 0.000000 | 0 | 0 |
| Table lock | 0.000515 | 0.001000 | 0.000000 | 0 | 0 |
| optimizing | 0.000093 | 0.000000 | 0.000000 | 0 | 0 |
| statistics | 0.151343 | 0.124981 | 0.023996 | 0 | 0 |
| preparing | 0.000082 | 0.000000 | 0.000000 | 0 | 0 |
| executing | 0.000027 | 0.000000 | 0.000000 | 0 | 0 |
| Sending data | 0.081436 | 0.072989 | 0.006999 | 0 | 0 |
| init | 0.000024 | 0.000000 | 0.000000 | 0 | 0 |
| optimizing | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| statistics | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| preparing | 0.000007 | 0.000000 | 0.000000 | 0 | 0 |
| executing | 0.000005 | 0.000000 | 0.000000 | 0 | 0 |
| Sending data | 0.000046 | 0.000000 | 0.000000 | 0 | 0 |
| end | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
| query end | 0.000003 | 0.000000 | 0.000000 | 0 | 0 |
| freeing items | 0.000076 | 0.001000 | 0.000000 | 0 | 0 |
| removing tmp table | 0.000006 | 0.000000 | 0.000000 | 0 | 0 |
| closing tables | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
| logging slow query | 0.000002 | 0.000000 | 0.000000 | 0 | 0 |
| cleaning up | 0.000004 | 0.000000 | 0.000000 | 0 | 0 |
+--------------------+----------+----------+------------+--------------+---------------+ --显示swap的次数。
mysql> show profile swaps for query 9;
+--------------------+----------+-------+
| Status | Duration | Swaps |
+--------------------+----------+-------+
| starting | 0.000997 | 0 |
| Opening tables | 0.000015 | 0 |
| System lock | 0.000003 | 0 |
| Table lock | 0.000515 | 0 |
| optimizing | 0.000093 | 0 |
| statistics | 0.151343 | 0 |
| preparing | 0.000082 | 0 |
| executing | 0.000027 | 0 |
| Sending data | 0.081436 | 0 |
| init | 0.000024 | 0 |
| optimizing | 0.000006 | 0 |
| statistics | 0.000006 | 0 |
| preparing | 0.000007 | 0 |
| executing | 0.000005 | 0 |
| Sending data | 0.000046 | 0 |
| end | 0.000004 | 0 |
| query end | 0.000003 | 0 |
| freeing items | 0.000076 | 0 |
| removing tmp table | 0.000006 | 0 |
| closing tables | 0.000004 | 0 |
| logging slow query | 0.000002 | 0 |
| cleaning up | 0.000004 | 0 |
+--------------------+----------+-------+ --下面的SQL语句用于查询query_id为9的SQL开销,且按最大耗用时间倒序排列
mysql> set @query_id=9; mysql> SELECT STATE,
-> SUM(DURATION) AS Total_R,
-> ROUND(100 * SUM(DURATION) /
-> (SELECT SUM(DURATION)
-> FROM INFORMATION_SCHEMA.PROFILING
-> WHERE QUERY_ID = @query_id),
-> 2) AS Pct_R,
-> COUNT(*) AS Calls,
-> SUM(DURATION) / COUNT(*) AS "R/Call"
-> FROM INFORMATION_SCHEMA.PROFILING
-> WHERE QUERY_ID = @query_id
-> GROUP BY STATE
-> ORDER BY Total_R DESC;
+--------------------+----------+-------+-------+--------------+
| STATE | Total_R | Pct_R | Calls | R/Call |
+--------------------+----------+-------+-------+--------------+
| statistics | 0.151349 | 64.49 | 2 | 0.0756745000 |--最大耗用时间部分为statistics
| Sending data | 0.081482 | 34.72 | 2 | 0.0407410000 |
| starting | 0.000997 | 0.42 | 1 | 0.0009970000 |
| Table lock | 0.000515 | 0.22 | 1 | 0.0005150000 |
| optimizing | 0.000099 | 0.04 | 2 | 0.0000495000 |
| preparing | 0.000089 | 0.04 | 2 | 0.0000445000 |
| freeing items | 0.000076 | 0.03 | 1 | 0.0000760000 |
| executing | 0.000032 | 0.01 | 2 | 0.0000160000 |
| init | 0.000024 | 0.01 | 1 | 0.0000240000 |
| Opening tables | 0.000015 | 0.01 | 1 | 0.0000150000 |
| removing tmp table | 0.000006 | 0.00 | 1 | 0.0000060000 |
| cleaning up | 0.000004 | 0.00 | 1 | 0.0000040000 |
| end | 0.000004 | 0.00 | 1 | 0.0000040000 |
| closing tables | 0.000004 | 0.00 | 1 | 0.0000040000 |
| query end | 0.000003 | 0.00 | 1 | 0.0000030000 |
| System lock | 0.000003 | 0.00 | 1 | 0.0000030000 |
| logging slow query | 0.000002 | 0.00 | 1 | 0.0000020000 |
+--------------------+----------+-------+-------+--------------+ --开启profiling后,我们可以通过show profile等方式查看,其实质是这些开销信息被记录到information_schema.profiling表
--如下面的查询,部分信息省略
mysql> select * from profiling limit 3,3\G;
*************************** 1. row ***************************
QUERY_ID: 2
SEQ: 4
STATE: Table lock
DURATION: 0.000007
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: lock.cc
SOURCE_LINE: 271
*************************** 2. row ***************************
QUERY_ID: 2
SEQ: 5
STATE: init
DURATION: 0.000010
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: sql_select.cc
SOURCE_LINE: 2537
*************************** 3. row ***************************
QUERY_ID: 2
SEQ: 6
STATE: optimizing
DURATION: 0.000003
CPU_USER: 0.000000
CPU_SYSTEM: 0.000000
CONTEXT_VOLUNTARY: 0
CONTEXT_INVOLUNTARY: 0
BLOCK_OPS_IN: 0
BLOCK_OPS_OUT: 0
MESSAGES_SENT: 0
MESSAGES_RECEIVED: 0
PAGE_FAULTS_MAJOR: 0
PAGE_FAULTS_MINOR: 0
SWAPS: 0
SOURCE_FUNCTION: unknown function
SOURCE_FILE: sql_select.cc
SOURCE_LINE: 835
3 rows in set (0.00 sec) ERROR:
No query specified mysql> --停止profile,可以设置profiling参数,或者在session退出之后,profiling会被自动关闭
mysql> set profiling=off;
Query OK, 0 rows affected, 1 warning (0.00 sec)

MySQL-profiling的使用的更多相关文章

  1. MySQL Profiling 的使用

    MySQL Profiling 的使用 在本章第一节中我们还提到过通过 Query Profiler 来定位一条 Query 的性能瓶颈,这里我们再详细介绍一下 Profiling 的用途及使用方法. ...

  2. 使用mysql profiling功能剖析单条查询

    5.1版本开始引入show profile剖析单条语句功能,支持show profiles和show profile语句,参数have_profiling;控制是否开启: 查看是否支持这个功能(查询为 ...

  3. 如何使用mysql profiling功能分析单条查询语句

    Mysql从5.1版本开始引入show profile来剖析单条语句功能 一. 查看是否支持这个功能 yes表示支持 mysql> show variables like 'have_profi ...

  4. 【Mysql优化】MySQL Profiling 的使用

    要想优化一条 Query,我们就需要清楚的知道这条 Query 的性能瓶颈到底在哪里,是消耗的 CPU计算太多,还是需要的的 IO 操作太多?要想能够清楚的了解这些信息,在 MySQL 5.0 和 M ...

  5. MySQL – optimizer_search_depth

    Working on customer case today I ran into interesting problem – query joining about 20 tables (thank ...

  6. MySQL 优化实施方案

    1.1 前言 在进行MySQL的优化之前必须要了解的就是MySQL的查询过程,很多的查询优化工作实际上就是遵循一些原则让MySQL的优化器能够按照预想的合理方式运行而已.更多关于MySQL查询相关参照 ...

  7. Linux云计算运维-MySQL

    0.建初心 优秀DBA的素质 1.人品,不做某些事情2.严谨,运行命令前深思熟虑,三思而后行,即使是依据select3.细心,严格按照步骤一步一步执行,减少出错4.心态,遇到灾难,首先要稳住,不慌张, ...

  8. 大佬是怎么思考设计MySQL优化方案的?

    在进行MySQL的优化之前,必须要了解的就是MySQL的查询过程,很多查询优化工作实际上就是遵循一些原则,让MySQL的优化器能够按照预想的合理方式运行而已. 一.优化的哲学 注:优化有风险,涉足需谨 ...

  9. MySQL 高性能优化实战总结

    1 前言 2 优化的哲学 3 优化思路 3.1 优化什么 3.2 优化的范围有哪些 3.3 优化维度 4 优化工具有啥? 4.1 数据库层面 4.2 数据库层面问题解决思路 4.3 系统层面 4.4 ...

  10. 大牛是怎么思考设计MySQL优化方案

    在进行MySQL的优化之前,必须要了解的就是MySQL的查询过程,很多查询优化工作实际上就是遵循一些原则,让MySQL的优化器能够按照预想的合理方式运行而已. 1.优化的哲学 注:优化有风险,涉足需谨 ...

随机推荐

  1. GDC2016 【巫师3 狂猎】的游戏事件工作流

    巫师3 狂猎(The Witcher 3: Wild Hunt )的游戏事件工作流   http://game.watch.impress.co.jp/docs/news/20160320_74916 ...

  2. 自动更新开奖数据的excel文件,供大家下载

    自动更新开奖数据的excel文件,供大家下载 2010-03-14 20:22 228492人阅读打印来源:乐彩网 作者:eren 很多人拥有自制excel电子表格,常要更新最基本的开奖信息.如有多期 ...

  3. JNDI学习总结(三)——Tomcat下使用Druid配置JNDI数据源

    com.alibaba.druid.pool.DruidDataSourceFactory实现了javax.naming.spi.ObjectFactory,可以作为JNDI数据源来配置. 一.下载D ...

  4. PHP文件操作 之打开远程文件

    //配置php.ini 开启allow_url_fopen选项 //访问的文件有可读或者可写的权限 //$f = fopen('http://www.example.com/a.txt','rb'); ...

  5. pdftoswf + flexpaper 图片转pdf浏览体验的实现

    需要的工具: pdftoswf:http://www.swftools.org/download.html flexpaper包,最好找个破解版的swf文件替换一下里面的swf文件.http://fi ...

  6. Git and Xcode

    1.web site "New Repository" 2.为本地 git 管理的项目添加 Repository $ cd ~/ProjectName$ git remote ad ...

  7. hadoop、hbase、hive、zookeeper版本对应关系

    本文引用自:http://www.aboutyun.com/blog-61-62.html 最新版本: hadoop和hbase版本对应关系: Hbase    Hadoop 0.92.0 1.0.0 ...

  8. python 输出乱码

    在Python中有两种默认的字符串:str和unicode.在Python中一定要注意区分“Unicode字符串”和“unicode对象”的区别.后面所有的“unicode字符串”指的都是python ...

  9. 【Android开发学习笔记】【高级】【随笔】插件化——资源加载

    前言 上一节我们针对插件最基本的原理进行了一个简单的demo实现,但是由于插件的Context对象被宿主所接管,因此无法加载插件程序的资源.那么如何解决这个问题捏? 有人提出这样的方案:将apk中的资 ...

  10. 【Java 基础篇】【第二课】基本数组类型

    就像第一章所说一样,这次学习为了快,因此说明性的文字就不想写太多了,直接帖代码吧,代码当中尽量加一些注释: package a.b; public class test { static void B ...