WengQiang's Blog

where there is a will, there is a way!

判断一个表达式是lvalue or rvalue

A useful heuristic to determine whether an expression is an lvalue is to ask if you can take its address. If you can, it typically is. If you can’t, it’s usually an rvalue.

一般情况下, 可以根据以上所述进行判断。

关于exception safe

如果一个函数是exception safe的,则它表示提供basic exception safety guarantee ,至少要保证:即使函数有exception抛出,pragram invariants remain intact(比如: 没有数据结构出错) and no resources are leaked 如果函数提供strong exception safety guarantee, 则保证:if an exception arises, the state of the program remains as it was prior to the call.

decltype

int x = 0

阅读全文 »

在mac osx下进行wpa/wpa2 加密的wifi破解

  • 首先要安装aircrack-ng工具

    1
    2
    3
    #可以使用Homebrew进行安装

    brew install aircrack-ng
    如果安装过程中出现下载失败, 这篇文章

  • 用airport搜索附近wifi
    1
    sudo airport -s
    阅读全文 »

今天又碰到了brew install安装时不能下载相关的文件, 哎! 天朝的"防火墙"已无力吐槽...

之前碰到过的, 记得brew可以手动下载文件放入到brew的cache文件夹即可. 果然好记性不如烂笔头,这里将方法记录下,不用每次得上网去搜, 要是没有联网咋办!

brew install failed
brew install failed
1
2
3
#使用如下命令得到brew下载的cache目录

brew --cache

将下载的文件放到该目录, 然后重新运行安装命令即可(要注意下载文件的文件名要[修改]与上面的一致)

阅读全文 »

A Maze is given as N*N binary matrix of blocks where source block is the upper left most block i.e., maze[0][0] and destination block is lower rightmost block i.e., maze[N-1][N-1]. A rat starts from source and has to reach destination. The rat can move only in two directions: forward and down.

In the maze matrix, 0 means the block is dead end and 1 means the block can be used in the path from source to destination. Note that this is a simple version of the typical Maze problem. For example, a more complex version can be that the rat can move in 4 directions and a more complex version can be with limited number of moves.

Following is an example maze.

Gray blocks are dead ends(value = 0).

ratinmaze_filled
ratinmaze_filled
阅读全文 »

git帮助

git help [command]

本地创建repository, 推送到远端

  1. git init
  2. git remote add [remote repository name] [remote repository url] git remote add origin https://github.com/BlockLink/blocklink_crosschain_privatekey.git

  3. git push -u [remote repository name] [remote branch name] git push -u origin master

分支相关

跳转分支

git checkout <branch> > 跳转到分支:将HEAD指向, 并 更新index和文件.

创建本地分支并且推送到远端

  1. 创建本地分支 git checkout -b [branch_name]

  2. 推送到远端 git push <remote_repository_path> <branch_name>[:<remote_branch_name>]

  3. 设置跟踪分支 git branch -u <remote_repository_path/remote_branch_name>

设置跟踪分支

git checkout [-b [branch]] [--track] <remotename>/<branch> > 用于对未创建的分支建立跟踪分支; 并且跳转到分支上.

git branch -u <remotename>/<branch> or git branch --set-upstream-to=origin/<branch> <localbranch> > 为当前所在的分支创建跟踪分支

一般如果你直接通过clone命令拉取一个仓库, 则git会自动设置一个本地master到origin/master的跟踪 分支. * master 3cf359f [origin/master] Site updated: 2015-12-18 11:55:19

阅读全文 »
0%