Emacs (line break/buffer coding system) Conversion From DOS to UNIX and Vice Versa

If in emacs you need a different file coding system (line terminator/line break), for example you are on a windows system and need to type a unix like text file (or vice versa), you can easily convert the buffer coding system.

DOS/Windows to UNIX


M-x set-buffer-file-coding-system RET undecided-unix

or


C-x RET f undecided-unix
C-x C-f

UNIX to DOS/Windows


M-x set-buffer-file-coding-system RET undecided-dos

or


C-x RET f undecided-dos
C-x C-f

Ref: http://edivad.wordpress.com/2007/04/03/emacs-convert-dos-to-unix-and-vice-versa/

Using CMake and C++11 With Eclipse

Eclipse is a Good IDE for C++.

And, CMake is a useful Makefile generation tool.

We hope that we might integrate them together.

1 Quick Start with Old Projects

mkdir buildeclipse
cd buildeclipse/
cmake ../SOURCE_FILES/ -G"Eclipse CDT4 - Unix Makefiles"\
    -DCMAKE_ECLIPSE_VERSION=4.3\
    -DCMAKE_CXX_COMPILER_ARG1=-std=c++11

Note:

If you get an error of like this:

Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.

use -D_ECLIPSE_VERSION=4.3 instead of -DCMAKE_ECLIPSE_VERSION=4.3.

2 A Project Example

PROJECT(HELLO)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Optional
# or SET(_ECLIPSE_VERSION 4.3). If you add these, you may omit `-DCMAKE_ECLIPSE_VERSION=4.3`
SET(CMAKE_ECLIPSE_VERSION 4.3)

ADD_EXECUTABLE(main main.cpp)
TARGET_LINK_LIBRARIES(main pthread)

Refs:

CDT/User/FAQ

CMake:Eclipse UNIX Tutorial

stackoverflow

日语输入法快捷键

操作系统自带快捷键

  • 多语言切换 Alt+Shift
    • 例如:搜狗中文输入法 和 Google日文输入法 之间切换
  • 同一语言下输入法切换 Ctrl+Shift
    • 例如:搜狗中文输入法 和 百度中文输入法 之间切换
  • 同一语言下输入法切换热键还原 Ctrl+space
    • 例如:搜狗中文输入法 和 无输入法状态 之间切换

Google日语输入法

Google日语输入法快捷键(和微软日语输入法大体相同,当然也可以自己设置)

  1. 快捷键 Alt + ~(Esc键下边的那个键) 可以在直接输入Direct Input(图标A)和平假名Hiragana(图标あ)间切换
  2. 快捷键 Alt + Shift 在系统默认输入/中文输入法和日文输入法之间切换
  3. 快捷键 Alt +CapsLock 和 Ctrl + CapsLock

输大量片假名时,在平假名Hiragana(图标あ)模式下,可以按 Alt+CapsLock 切换到片假名Katakana(图标カ)模式,输完按

Ctrl+CapsLock 可切回平假名Hiragana(图标あ)。

Baidu日语输入法

  • 中文系统下支持 Shift 键切换平假名和半角英文输入模式
  • 日文系统下支持 Shift 键、无変换+仮名/汉字变换 键切换平假名和半角英文输入模式

微软日语输入法

  1. 平假名、片假名、英数字间的转换 * 输入罗马字之后 * 按 F6 转换为平假名
    • 按 F7 转换为全角片假名
      • 按 F8 转换为半角片假名
      • 按 F9 转换为全角英文数字
      • 按 F10 转换为半角英文数字。
  2. 快捷键
    • 快捷键Alt+~(Esc键下边的那个键)
      • 可以在直接输入Direct Input(图标A)和平假名Hiragana(图标あ)间切换
    • 快捷键Alt + Shift
      • 在系统默认输入/中文输入法和日文输入法之间切换
    • 快捷键Alt +CapsLock 和Ctrl + CapsLock * 输大量片假名时,在平假名Hiragana(图标あ)模式下,可以按 Alt+CapsLock 切换到片假名Katakana(图标カ)模式,输完按 Ctrl+CapsLock 可切回平假名Hiragana(图标あ)。

注: 加上Direct Input,共有6种日文输入模式,分别是:

  • Direct Input:直接输入
  • Hiragana:平假名
  • Full-width Katakana:全角片假名
  • Full-width Alphanumeric:全角英数
  • Half-width Katakana:半角片假名
  • Half-width Alphanumeric:半角英数

(注2:后面提到的英数均指日文输入模式下的Alphanumeric,而非Direct Input)

  • 平假名:Ctrl+CapsLock

    • 日文模式下切换到平假名,Direct Input下则是切换回日文模式,如原先不在Hiragana,则必须多按一次。
  • 全角片假名:Alt+Caps Lock

    • 日文模式下切换到全角片假名,Direct Input下则是切换回日文模式,如原先不在Full-width Katakana,则必须多按一次。
  • 全半角切换:Shift+Space

    • 在Full-width Katakana(全角片假名)与Half-width Katakana(半角片假名)间切换。或是在Full-width Alphanumeric(全角英数)与Half-width Alphanumeric(半角英数)间切换。
  • 英数与假名切换:Shift+Caps Lock

    • 在假名模式下切换到Full-width Alphanumeric(全角英数),在英数模式下则是切换到Full-width Katakana(全角片假名)。

另外,在英数模式下输入后,尚未按下Enter送出前:

  • F9转换为全角英数
  • F10转换为半角英数

而假名模式下则是:

  • F6转换为平假名
  • F7转换为全角片假名
  • F8转换为半角片假名
  • F9F10仍可以转换为英数

Ref: http://blog.hjenglish.com/muramase/archive/2011/07/30/1697222.html

博客遷移啦~

新地址如下:

http://blog.modest-destiny.net/

Let OMNet++(OMNetpp) support c++11 or c++0x standard

There're a lot of people asking how to customly define c++ compile flags (CXX_FLAGS) under OMNet++ 4 (OMNetpp 4), but don't really get an answer.

Here is the answer now. First follow my instruction and then I'll explain the reason.

Important: These are instructions under Linux. However, it's still very easy to port these instructions to Windows. Try it yourself.

  • mkdir -p ~/.omnetpp/
  • cp $omnetpp_root/Makefile.inc ~/.omnetpp/
    • if you do not know about the omnetpp_root environment variable, you probably have a false setup of OMNet++.
  • vim ~/.omnetpp/Makefile.inc
  • add -std=c++11 to CFLAGS_DEBUG and CFLAGS_RELEASE
  • You may edit the Makefile.inc as you wish as long as you know what you're doing.
  • vim ~/.bashrc
  • Append export OMNETPP_CONFIGFILE="~/.omnetpp/Makefile.inc" to the end of your ~/.bashrc file
  • source ~/.bashrc
  • Finally, rebuild your project either with Eclipse or opp_makemake.
  • Enjoy!

Reasons Here:

If you examine the Makefile generated by opp_makemake carefully, something may catch your eyes.

# Pull in OMNeT++ configuration (Makefile.inc or configuser.vc)

ifneq ("$(OMNETPP_CONFIGFILE)","")
CONFIGFILE = $(OMNETPP_CONFIGFILE)
else
ifneq ("$(OMNETPP_ROOT)","")
CONFIGFILE = $(OMNETPP_ROOT)/Makefile.inc
else
CONFIGFILE = $(shell opp_configfilepath)
endif
endif

This part of Makefile code pull in the configuration defined by the users (You!).

Where to pull?

The environment variable: OMNETPP_CONFIGFILE

so ... set it and enjoy whatever you like, either c++11 or openmp or valgrind, etc.

 

link: http://blog.modest-destiny.net/omnetpp/2014/01/05/Let-OMNet++(OMNetpp)-support-c++11-or-c++0x-standard/