Jul 01

Sitemix.jp提供1.5GB的免费空间和无限流量,并可以绑定自己的域名(仅限于顶级域名,二级域名现在好像已经不能绑定了),在国内访问的速度会很快的,但是缺点也很明显,就是广告太大。这个空间已经限制了国人的注册了,要想注册的自己找一个代理就行了。

下面介绍一些去广告的方法,虽然说方法有几种,但是我发现单独使用其中的一种都是很不能彻底的解决问题的,所以我建议你将下面介绍的方法全部用上,这样是比较保险的做法。申明:以下方法均来自网络。

1.修改WordPress的主页,在<body>前后加上以下代码:

<noframes><body></noframes>

在</body>前加上以下代码:

<div style="display: none;"></body>

2.在HTML的<head></head>标签之间添加以下js连接:

<script type="text/javascript" src="http://img.shily.net/res/na.js"></script>

建议将这个js到博客所在的空间,然后修改引用的地址,这样的好处就是速度比较快。

3.查看挂有广告的源代码,找出含有代码的某些字段,在CSS修改使之不能正常运行。

以前不知道怎么建WordPress,到处找免费而且速度快的空间,其实最后想明白了,重要的是内容,即使你用最原始的HTML代码写也无所谓的,至于放在哪里,用什么程序都是不重要的问题。

转自:http://www.shily.net/topic/sitemix-remove-ad/

Jul 01

背景:因为收到了Google的加速服务Page Speed Service的邀请邮件,打算使用Page Speed Service来提高网速,但是有一个很郁闷的问题,Page Speed Service不能对裸域进行设置,只能对形如a.abc.com二级域名进行加速,而我准备将www.abc.com作为正常访问的加速后的域名,所以我就必须重新设置一个二级域名,还需要保证这个二级域名的内容与裸域的内容一致,这时我就想到了WordPress多站镜像同步方案来了,可以设置一个二级域名与裸域共用一个数据库,这样只需要在裸域下进行内容的更新就可以了,同时www.abc.com进行加速后内容也与裸域保持一致,这样就达到了预期的目的了。

参照方案:http://www.wx35.cn/archives/735/

具体步骤如下:
1.首先安装你的裸域名WordPress,主域名无须特别设置,只需要共享MYSQL远程链接。Godaddy的数据库是可以设置MYSQL共享的,但是需要在一开始的时候设置,如果没有实现设置,那么安装完成以后就不能设置了。这里的MYSQL共享是指可以将镜像WordPress安装到另外一台主机上,但是内容一模一样。由于我没有实现设置,所以不能安装到另外一台主机上,但是我将镜像安装到了同一主机下就变相地达到了目的。

2.安装镜像站WordPress,版本与主域名一致,最好直接将主域名的安装文件直接复制过来,只需要修改一下镜像站的wp-config.php文件,完整代码如下:.

<?php
// ** MySQL settings ** //
define('DB_NAME', 'name');  
define('DB_USER', 'user'); 
define('DB_PASSWORD', 'pass'); 
define('DB_HOST', '主域名MYSQL地址'); 
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('WP_HOME', 'http://m.chunchu.org');
define('WP_SITEURL', 'http://m.chunchu.org');

$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!

define ('WPLANG', 'us_EN');

/* That's all, stop editing! Happy blogging. */

define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?>

由于我的镜像与主域名是同一主机,所以将wp-config.php文件修改完成后,连基本的安装过程都不需要就可以正常的访问了。

3.图片及文件共享。将图片及文件分离出来,你可以绑定一个独立域名来访问图片及文件,完整的MYSQL命令如下:

UPDATE wp_posts SET post_content = replace(post_content, 'http://chunchu.org', 'http://img.chunchu.org')

由于我写文章的时候,直接就将图片和文件放在Google Storage上了,所以不需要这一步了,而且速度快,容量大,便于多次使用。至于原文中提到的使用cos-html-cache将WordPress真正的静态化,我就不需要这个插件了,记得很久以前就是由于使用了这个插件,导致一片文章发表后很长时间首页仍然不能更新后,就再也不想用它了,我的WordPress很少使用插件的。

Jul 01

在网上看到的Git的常用的命令,比我收集的要齐全就转过来了,以备不时之需。
转自:http://rongjih.blog.163.com/blog/static/335744612010112562833316/

1. 远程仓库相关命令
检出仓库:$ git clone git://github.com/jquery/jquery.git
查看远程仓库:$ git remote -v
添加远程仓库:$ git remote add [name] [url]
删除远程仓库:$ git remote rm [name]
修改远程仓库:$ git remote set-url –push [name] [newUrl]
拉取远程仓库:$ git pull [remoteName] [localBranchName]
推送远程仓库:$ git push [remoteName] [localBranchName]

提交本地test分支作为远程的master分支:$ git push origin test:master
提交本地test分支作为远程的test分支:$ git push origin test:test

2. 分支(branch)操作相关命令
查看本地分支:$ git branch
查看远程分支:$ git branch -r (如果还是看不到就先 git fetch origin 先)
创建本地分支:$ git branch [name] —注意新分支创建后不会自动切换为当前分支
切换分支:$ git checkout [name]
创建新分支并立即切换到新分支:$ git checkout -b [name]
直接检出远程分支:$ git checkout -b [name] [remoteName] (如:git checkout -b myNewBranch origin/dragon)
删除分支:$ git branch -d [name] — -d选项只能删除已经参与了合并的分支,对于未有合并的分支是无法删除的。
强制删除分支:$ git branch -D [name]
合并分支:$ git merge [name] —将名称为[name]的分支与当前分支合并
创建远程分支(本地分支push到远程):$ git push origin [name]
删除远程分支:$ git push origin :heads/[name] 或 $ git push origin :[name]

* 创建空的分支:(执行命令之前记得先提交你当前分支的修改,否则会被强制删干净)
$ git symbolic-ref HEAD refs/heads/[name]
$ rm .git/index
$ git clean -fdx

3. 版本(tag)操作相关命令
查看版本:$ git tag
创建版本:$ git tag [name]
删除版本:$ git tag -d [name]
查看远程版本:$ git tag -r
创建远程版本(本地版本push到远程):$ git push origin [name]
删除远程版本:$ git push origin :refs/tags/[name]
合并远程仓库的tag到本地:$ git pull origin –tags
上传本地tag到远程仓库:$ git push origin –tags
创建带注释的tag:$ git tag -a [name] -m ‘yourMessage’

4. 子模块(submodule)相关操作命令
添加子模块:$ git submodule add [url] [path]
如:$ git submodule add git://github.com/soberh/ui-libs.git src/main/webapp/ui-libs
初始化子模块:$ git submodule init —只在首次检出仓库时运行一次就行
更新子模块:$ git submodule update —每次更新或切换分支后都需要运行一下
删除子模块:(分4步走)
1) $ git rm –cached [path]
2) 编辑“.gitmodules”文件,将子模块的相关配置节点删除掉
3) 编辑“ .git/config”文件,将子模块的相关配置节点删除掉
4) 手动删除子模块残留的目录
5) 忽略一些文件、文件夹不提交
在仓库根目录下创建名称为“.gitignore”的文件,写入不需要的文件夹名或文件,每个元素占一行即可,如
target
bin
*.db

Jun 24

1. / – Root
Every single file and directory starts from the root directory.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not same as /.

2. /bin – User Binaries
Contains binary executables.
Common linux commands you need to use in single-user modes are located under this directory.
Commands used by all the users of the system are located here.
For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries
Just like /bin, /sbin also contains binary executables.
But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files
Contains configuration files required by all programs.
This also contains startup and shutdown shell scripts used to start/stop individual programs.
For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files
Contains device files.
These include terminal devices, usb, or any device attached to the system.
For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information
Contains information about system process.
This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
This is a virtual filesystem with text information about system resources. For example: /proc/uptime

7. /var – Variable Files
var stands for variable files.
Content of the files that are expected to grow can be found under this directory.
This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

8. /tmp – Temporary Files
Directory that contains temporary files created by system and users.
Files under this directory are deleted when system is rebooted.

9. /usr – User Programs
Contains binaries, libraries, documentation, and source-code for second level programs.
/usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
/usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories
Home directories for all users to store their personal files.
For example: /home/john, /home/nikita

11. /boot – Boot Loader Files
Contains boot loader related files.
Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

12. /lib – System Libraries
Contains library files that supports the binaries located under /bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications
opt stands for optional.
Contains add-on applications from individual vendors.
add-on applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory
Temporary mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices
Temporary mount directory for removable devices.
For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

16. /srv – Service Data
srv stands for service.
Contains server specific services related data.
For example, /srv/cvs contains CVS related data.

转自:http://www.thegeekstuff.com/2010/09/linux-file-system-structure/

Jun 23