Category: Just about Code

  • WordPress eXtended Rss (WXR)文件格式解析

    Sina2WordPress的第一步——解析WXR文件格式

    WXR是Wordpress eXtended Rss的缩写,是WordPress针对博客信息特意设定的格式,它最大的优点是兼容性好,包含信息丰富

    通过参照导出的文件,初步找到一个完备集(见下方代码),经测试在WP无任何内容情况下无信息缺漏错误现象

    下方代码已经尽可能的注释了所有可能的标签和属性,并且由于一些标签和属性与Sina2WordPress关系不大,故未深究

    [xml]
    < ?xml version="1.0" encoding="UTF-8" ?>



    Blog Title
    http://blog.example.com
    Blog Description
    Dec, 20 Jun 2012 23:59:59 +0000
    en

    1.1

    http://example.com

    http://blog.example.com

    1admin_testadmin@example.org< ![CDATA[AdMin test]]>< ![CDATA[AdMin]]>< ![CDATA[test]]>

    1category_test< ![CDATA[分类测试]]>

    2tag_test< ![CDATA[标签测试]]>

    http://wordpress.org/?v=3.1.3


    Title
    http://blog.example.com/title/ Thu, 15 Apr 2010 23:20:03 +0000
    admin

    http://blog.example.com/?page_id=1


    < ![CDATA[Content_test_1]]>

    < ![CDATA[]]>

    2

    2012-12-21 07:59:5

    2010-12-20 23:59:59

    open

    closed

    blog_title

    publish

    0

    0

    post



    0

    < ![CDATA[Tag Test]]>
    < ![CDATA[Category]]>


    _edit_last

    < ![CDATA[1]]>


    1

    < ![CDATA[anonymous]]>>

    anonymous@anonymous.com

    http://blog.anonymous.com

    8.8.8.8

    2012-12-21 07:59:59

    2012-12-20 23:59:59

    < ![CDATA[Content of Comment]]>

    1



    0

    0





    [/xml]

    参考:http://ipggi.wordpress.com/2011/03/16/the-wordpress-extended-rss-wxr-exportimport-xml-document-format-decoded-and-explained/

  • VPS杂记

    入手VPS好久了,用的是LNMP架构,在Evernote中压了一些笔记,一一贴出来示众~

    安装lnmp
    注:版本可能有更新,0.7为截至2011/06/03的最新版
    [shell]
    wget http://soft.vpser.net/lnmp/lnmp0.7.tar.gz
    tar zxvf lnmp0.7.tar.gz
    cd lnmp0.7/
    ./ubuntu.sh
    [/shell]

    创建虚拟主机
    [shell]
    /root/vhost.sh
    [/shell]

    root账户的使用
    平时使用普通账户登录,需要使用root权限的时候用su命令,然后再输入root命令,使用完root权限之后可以用ctrl+D退出权限,继续使用普通账户权限,这样可以防止权限的混乱

    安装OpenVPN
    [shell]
    wget http://vpsnoc.com/scripts/debian-openvpn.sh
    chmod +x debian-openvpn.sh
    ./debian-openvpn.sh
    [/shell]
    按照提示安装完成后下载keys.tgz,将其解压到OpenVPN安装目录下的config子目录,然后启动OpenVPN就可以使用了

    wordpress的rewrite问题
    默认的规则有点小问题,替换为以下的即可:
    [shell]
    if (!-e $request_filename)
    {
    rewrite (.*) /index.php;
    }
    [/shell]

    WordPress文件权限
    [shell]
    chown -R www.www /blog
    [/shell]

  • 解决在Ubuntu上搭建Android开发环境缺少WST包的问题

    前言:之前写过一篇《Ubuntu 10.04安装Android开发环境》,每天都有不少访问量,估计很多就是遇到了这个问题,一直压在Evernote里没有翻出来,现在已转入Arch阵营,没有再次验证解决方案的正确性,完全参照印象和笔记,有问题尽管留言

    平台:Ubuntu 10.10和Ubuntu 11.04,10.04(写那一篇日志的时候)无此问题

    原因:Ubuntu下的Eclipse是Ubuntu社区打包的,非完整版,少了WST包的支持

    现象:安装ADT的时候会提示类似如下错误(版本号可能会有不同):
    [text gutter=”false”]
    Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 10.0.1.v201103111512-110841 (com.android.ide.eclipse.adt.feature.group 0.0.1.v201103111512-110841) Missing requirement: Android Development Tools 10.0.1.v201103111512-10841 (com.android.ide.eclipse.adt.feature.group 10.0.1.v201103111512-110841) requires ‘org.eclipse.wst.sse.core 0.0.0’ but it could not be found
    [/text]
    解决方案
    方案1:直接从Eclipse官网下载完整的安装包
    方案2:遵照以下菜单顺序或提示执行
    [text gutter=”false”]
    1:Help –> Install New Software –> Add –> type ‘http://download.eclipse.org/releases/galileo’ in the Location –>OK
    2:Help –> Install New Software –> Add –> type ‘http://dl.google.com/eclipse/plugin/3.5’ in the Location –> OK
    3:Please make sure the option ‘Contact all updates sites during install to find required software’ is checked.
    4:Restart Eclipse,Reinstall ADT
    [/text]
    相关参照
    1)http://code.google.com/intl/es/eclipse/docs/faq.html#wstinstallerror
    2)http://code.google.com/intl/es/eclipse/docs/install-eclipse-3.5.html

    P.S.本文参与“第二届 Google 暑期大学生博客分享大赛 – 2011 Android 成长篇”,感谢大家支持