在Github上建立一个SVN的镜像库

1.Create repository 创建库

2.clone the git repository 克隆代码至本地

$git clone git@github.com:user-name/repository-name

3.set svn as a remote repository 把svn仓库添加为远程仓库

$git svn init -T http://url/svn/trunk/

4.fetch 获取svn仓库的代码

$git svn fetch

5.show all branch 显示所有分支

$git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/trunk

remotes/trunk is the svn branch 其中,remotes/trunk为svn分支

6.merge 合并svn分支

$git merge trunk

7.push 推送至github

$git push

refference

在GitHub上建立一个SVN仓库的镜像

标签: git
日期: 2014-03-21 17:30:06, 10 years and 301 days ago

sscanf 函数使用中括号格式化字符串

在[]之中的字符串集合可以更好的格式化字符串 a set of characters in brackets ([ ]) can be substituted for the s (string) type character. The set of characters in brackets is referred to as a control string.

  • [^characters] 匹配直到所有非此集合中的字符,直到此集合的字符出现为止。If the first character in the set is a caret (^), the effect is reversed: The input field is read up to the first character that does appear in the rest of the character set.

  • [characters] 匹配直到出现未在此集合中出现的字符input field is read up to the first character that does not appear in the control string

int
main(int argc, char * * a rgv)
{
    char* s = "key= value ";
    char key[1024] = {0};
    char value[1024] = {0};
    char* digits = "pi3.1415926";
    sscanf(s, "%[^=]=%[^\0]", key, value);
    printf("%s\n%s\n", key, value);
    sscanf(digits, "%[abcdefghijklmnopqrstuvwxyz]%[1234567890.]", key, value);
    printf("%s\n%s\n", key, value);
    return 0;
}
标签: c
日期: 2014-03-14 17:30:06, 10 years and 308 days ago

show commit count 显示提交记录数

git rev-list HEAD --count

combine commit or modify commit message 合并或修改记录

  • command 命令
git rebase -i HEAD~$x

其中$x代表你期望操作的记录数,小于提交记录数 $x is the count of commit that you want to combine or change, $x is less than commit count

如 e.g.

你想操作最后十条,则$x为10 if you want to change the last ten commits, the value of $x is 10.

pick 123456 init
pick 7890ab add text
pick cdef12 modify text
pick 345678 modify text

  • edit 编辑

change the "pick" that is in front of the commit line to "s", the commit will combine to previous commit. 在你期望合并的commit将前面的pick更改成s就行, 此条commit将于上一条commit合并

change the "pick to "r", the commit message will be modify. pick改成r表示修改当前提交信息

e.g.例如:

"pick 345678 modify text" --> "s 345678 modify text"

  • change commit message after saving 保存后,重新编写提交信息
 # This is a combination of 2 commits.
 # The first commit's message is:

 modify text

 # This is the 2nd commit message:

 modify text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached at 8658d47
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   ignorelist
 #  modified:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
 change text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached from 18e598b
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
  • push 推送至远程
git push -f
标签: git
日期: 2014-03-07 17:30:06, 10 years and 315 days ago

modules

+--------------+       +-----+
|planet.Channel|-+-is--|cache|
+----------+---+  \    +-----+
            \      \         +------+
             \      +-have-+-|dbhash|
              \           /  +------+
                +--------+

dbhash

Planet(http://www.planetplanet.org/) uses the hashdb module to cache the feeded data.

The dbhash module provides a function to open databases using the BSD db library. This module mirrors the interface of the other Python database modules that provide access to DBM-style databases. The bsddb module is required to use dbhash.

"""output the hashdb"""
import sys
import dbhash
db = dbhash.open(sys.argv[1], 'r')
print db.first()
for i in xrange(1, len(db)):
    print db.next()
db.close()

The dbm library was a simple database engine, originally written by Ken Thompson and released by AT&T in 1979. The name is a three letter acronym for database manager, and can also refer to the family of database engines with APIs and features derived from the original dbm.

planet.Channel and cache modules

the module description is very clear and easy to know, so you can use help() to show the module description and read it.

database file

the database is key/value database * " keys" is the key of the root item.

  • the root item's value is the keys of the channel properties that is splited by blank space.

  • the key in that there is not blank space is the key of the news item.

  • the news item's value is the keys of the news properties that is splited by blank space.

  • the news property's key is the unit of the news item's key and the part of the news item's value.

  • the channel property item and the news property item the key of that includes the string " type" is provided the type of the news property's value.

For example: the RSS:




CodePongo: json
Thu, 22 Aug 2013 18:16:02 +0200

<h1>cJSON source analysis</h1> 



the database:

(' keys', 'lastbuilddate title')
('lastbuilddate type', 'string')
('lastbuilddate', 'Thu, 22 Aug 2013 18:16:02 +0200')
('title type', 'string')
('title', 'CodePongo: json')
('http://codepongo.com/blog/3uhyc1/ title type', 'string')
('http://codepongo.com/blog/3uhyc1/ title', '

cJSON source analysis

') ('http://codepongo.com/blog/3uhyc1/', 'title')

reference

planet home page

planet introduction

dbhash module database

标签: planet, dbhash, python
日期: 2014-02-21 17:30:06, 10 years and 329 days ago

从visual C++.NET 2002(VC 7.0)开始,一些存在于MFC的基础类被重写和修订,削减了与 其他MFC类之间的关系。这些类库可以独立被用于任何的native C++工程。

  • CFileTime
  • CFileTimeSpan
  • CFixedStringT
  • CImage
  • COleDateTime
  • COleDateTimeSpan
  • CPoint
  • CRect
  • CSimpleStringT
  • CSize
  • CStrBufT
  • CStringData
  • CStringT
  • CTime
  • CTimeSpan
  • IAtlStringMgr
CSimpleStringT
 |
 +--CStringT
     |
     +--CFixedStringT

测试代码

例子

https://github.com/codepongo/utocode/tree/master/windows/independentmfc

int 
main(int argc, char* argv[])
{
    /* string */
    CStringT< char, StrTraitATL< char, ChTraitsCRT< char > > > str;
    str = "hi";
    str += ",independent MFC!\n";
    printf(str);


    /* point size rect */
    CPoint pt;
    CRect rc;
    CSize sz;
    rc.left = rc.top = 0;
    rc.right = rc.bottom = 100;
    sz = rc.Size();
    pt.x = 10;
    pt.y = 10;
    printf("rect(%d, %d, %d, %d):(%d,%d) move (%d, %d)\n",
        rc.left, rc.top, rc.right, rc.bottom, sz.cx, sz.cy, pt.x, pt.y);

    /* time */
    CTime tms;
    CTime tm;
    str.Format("%04d-%02d-%02d %02d:%02d:%02d\n",
        tms.GetYear(), tms.GetMonth(), tms.GetDay(), tm.GetHour(), tm.GetMinute(), tm.GetSecond());
    printf(str);

    CFileTime ft;
    CFileTimeSpan fts;
    COleDateTime dt;
    COleDateTimeSpan dts;

    str.Format("%lld\n", ft.GetTime());
    printf(str);

    /* image */
    CImage image;
    image.Load(L"image.png");
    str.Format("width:%d height%d\n", image.GetWidth(), image.GetHeight());
    printf(str);

    system("pause");
    return 0;
}

对MFC无依赖

参考

ATL/MFC Shared Classes

Classes Shared by MFC and ATL

MFC Hierarchy Chart

CString模板结构解析

标签: cplusplus, windows
日期: 2014-01-10 17:30:06, 11 years and 6 days ago