25 Mar 2015
有时候用VIM编辑一个系统文件的时候会忘了使用su权限,咔咔咔一阵忙碌,满意后一保存发现自己没有写权限,当时整个人几乎就是崩溃的了。如果这时候你热血上脑,放弃编辑重新来过,那真是亏大了,也说明你对万能的VIM的实力认识还远远不够^_^
看看VIM是怎么拯救你的吧:
:w !sudo tee %
YEAR,就是这么简单。
简单说明一下这条命令:
19 Mar 2015
<table border="1" cellpadding="20" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#999999">
<tr align="center" bgcolor="#666666">
<td width="50">Id</td>
<td width="221">Name</td>
<td width="329">Age</td>
</tr>
<?php
$conn = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("testDB", $conn) or die(mysql_error());
$page_num = isset($_GET['page_num']) ? intval($_GET['page_num']) : 1;
$page_size = 5; // show 5 records per page
$query = "select count(*) as total from persons order by id";
$result = mysql_query($query);
$total_records = mysql_result($result, 0, "total");
$page_count = ceil($total_records / $page_size);
$offset = ($page_num - 1) * $page_size;
//实现分页的关键代码,注意必须要排序。
$query = "select * from persons order by id limit $offset, $page_size";
$result = mysql_query($query);
while($row = mysql_fetch_object($result)) {
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $row->id?></td>
<td><?php echo $row->name?></td>
<td><?php echo $row->age?></td>
</tr>
<?php
}
?>
</table>
<table border="0" cellpadding="5">
<tr>
<td width="100" align="center">
Current: <?php echo $page_num;?>
</td>
<td width="50" align="center">
<?php
if($page_num != 1) {
echo "<a href=splitpages.php?page_num=1>First</a>";
?>
</td>
<td width="50" align="center">
<?php
echo "<a href=splitpages.php?page_num=" . ($page_num - 1) . ">Prev</a>";
}
?>
</td>
<td width="50" align="center">
<?php
if($page_num < $page_count) {
echo "<a href=splitpages.php?page_num=" . ($page_num + 1) . ">Next</a>";
?>
</td>
<td width="50" align="center">
<?php
echo "<a href=splitpages.php?page_num=" . $page_count . ">Last</a>";
}
?>
</td>
<tr>
</table>
15 Mar 2015
mysql> describe wp_options;
+--------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------------+------+-----+---------+----------------+
| option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| option_name | varchar(64) | NO | UNI | | |
| option_value | longtext | NO | | NULL | |
| autoload | varchar(20) | NO | | yes | |
+--------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql> select * from wp_options where option_name=siteurl;
ERROR 1054 (42S22): Unknown column 'siteurl' in 'where clause'
mysql> select * from wp_options where option_name="siteurl";
+-----------+-------------+-------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-------------------+----------+
| 1 | siteurl | http://vgeez.com/ | yes |
+-----------+-------------+-------------------+----------+
1 row in set (0.00 sec)
mysql> select * from wp_options where option_name="home";
+-----------+-------------+------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+------------------+----------+
| 36 | home | http://vgeez.com | yes |
+-----------+-------------+------------------+----------+
1 row in set (0.00 sec)
11 Mar 2015
eg:
main : main.o dependent1.o dependent2.o
gcc -o main main.o dependent1.o dependent2.o
main.o : main.c dependent1.h dependent2.h
gcc -c main.c
使用 Makefile内置变量后:
main : main.o dependent1.o dependent2.o
gcc -o [email protected] $^
main.o : main.c dependent1.h dependent2.h
gcc -c $<
08 Mar 2015
修改Terminal中的Show Prevous Tab和Show Next Tab的快捷键。
System Preferences —-> Keyboard —->Shortcuts —->App Shortcuts

修改后:

关键是Menu Title一定要和APP中的名字一致。