1. cin vs getline vs cin.getline

    cin vs getline vs cin.getline

    Case with '\n'

    cin

    drop all `'\n'` except last one (just leave it in the buffer,won't get it and will finally drop it).
    

    getline

    read until `'\n'` and replace `'\n'` with `'\0'`.
    

    cin.getline

    same with getline, replace `'\n'` with `'\0'`.
    
    but …
    Tagged as : C++ program
  2. config git

    Git saves your system config in /etc/gitconfig , user config in ~/.gitconfig or ~/.config/git/config and repository config in .git/config

    Each config will override the previous one so the repository config will override the other config

    Config your username and email:

    $ git config --global user.name "fx-moon"
    $ git …
    Tagged as : git
  3. strlen_analyze

    #include <iostream>
    
    #include <vector>
    
    #include <string>
    
    #include <stack>
    #include <ctime>
    #include <windows.h>
    
    const int n = 1024*1024*500;
    
    using namespace std;
    class timer
    {
        long long t;
    
      public:
        timer()
        {
            t = clock();
        }
        ~timer()
        {
            cout << clock() - t << endl;
        }
    };
    size_t strlen1(const char *str)
    {
        register int length = 0;
    
        while (*str++)
    
            ++length;
    
        return (length …
    Tagged as : program analyze
  4. Very Simple Powershell

    Basic Powershell

    Variable

    $<name>=<value>

    $usrname='John'
    $len=32
    

    $null -> null value

    $true -> boolean true

    $false -> boolean false

    $_ -> the variable currently being processed

    Data Structure

    Array

    $var=@(<element>,<element>,...)
    $var[0]
    $var[100]=2333
    

    Hash Table

    $var=@{<key>=<value>,...}
    $var[<key>]
    $var.key
    

    Process Control

    Branch

    if()
    {
        ...
    }
    elseif()
    {
        ...
    }
    else …
    Tagged as : powershell
  5. boost learning note (2) Boost.Core

    Introduction

    The Boost.Core library is a collection of core utilities. The criteria for inclusion is that the utility component be:

    • simple
    • used by other Boost librarys, and
    • not dependent on any other Boost modules except Core itself, Config, Assert, Static Assert, or Predef.

    addressof

    Overview

    The header <boost/core …

    Tagged as : boost
  6. boost learning note (1) getting started on Windows

    1 Get boost

    just find a copy on https://www.boost.org

    2 The boost distribution

    boost_1_67_0\ .................The “boost root directory”
       index.htm .........A copy of www.boost.org starts here
       boost\ .........................All Boost Header files
       lib\ .....................precompiled library binaries
       libs\ ............Tests, .cpps, docs, etc., by library
         index.html ........Library …
    Tagged as : boost
  7. try pelican

    try pelican

    I just forget the usage again and again,so I decided to WcRoIpTyE it=.=

    getting start

    installing

    Pelican currently runs best on Python 2.7.x and 3.3+; earlier versions of Python are not supported.

    You can install Pelican via several different methods. The simplest is via …

    Tagged as : pelican
  8. git learning note

    git learning note


    git init

    This creates a new subdirectory named .git that contains all of your necessary repository files — a Git repository skeleton. At this point, nothing in your project is tracked yet.

    git add

    If you want to start version-controlling existing files (as opposed to an empty directory …

    Tagged as : git

Pages