Tmux usage

# run tmux as 256 color
tmux -2

# new tab
(ctrl + b) +c

# switch tab
(ctrl + b) + w and select a window number : select a window in a list
(ctrl + b) + n : next window
(ctrl + b) + p : previous window

# panes (split a tab)
(ctrl + b) + % : vertical split
(ctrl + b) + ” : horizontal split

# switch pane
(ctrl + b) +  ←/↑/→/↓ : switch a pane to a direction of arrow(ctrl + b) + o : next pane
(ctrl + b + o) : swap panes

# kill session
ctrl + d
(ctrl + b) + x

# resize a pane
(ctrl + b + ←/↑/→/↓)

 

 

Tmux usage

Windows 10 | move workspace shortcut

So cool function is Windows 10. It is so light performance in Windows 10.
Move workspace quickly and enhance the performance.
When using Cygwin, ‘Ctrl + tab’ can move Cygwin windows. It also so nice to work.

Windows Key + Ctrl + D : Add a new workspace
Windows Key + Ctrl + ← / → / ↑ / ↓ : Move(Navigate) worksapce

Windows 10 | move workspace shortcut

Mingw To Compile Source To Windows Executable File On Linux

sudo apt-get install mingw-w64

# C
i686-w64-mingw32-gcc hello.c -o hello32.exe # 32-bit
x86_64-w64-mingw32-gcc hello.c -o hello64.exe # 64-bit

# C++
i686-w64-mingw32-g++ hello.cc -o hello32.exe # 32-bit
x86_64-w64-mingw32-g++ hello.cc -o hello64.exe # 64-bit

Mingw To Compile Source To Windows Executable File On Linux

C# | Access Violation When Using Shared Memory From C/C++

When using dll made in C/C++ with the API below, a program in C# occurs ‘Access Violation’.

CreateFileMapping
OpenFileMapping
MapViewOfFile

 
The below doesn’t work. So message passing with named pipe is in the air instead of shared memory.

 
 
———————————————————————-
 
It can be resolved by using another API in C#.

 

[Resolution]
Apply this

                for (int i = 0; i < size; i++)
                    rawDataArray[i] = Marshal.ReadByte(rawData + i);

Instead of the below.

                //Marshal.Copy(rawData, rawDataArray, 0, size);

 

[Shared Memory Example]

	SECURITY_ATTRIBUTES SecAttr, *pSec = 0;
	SECURITY_DESCRIPTOR SecDesc;

	if (InitializeSecurityDescriptor(&SecDesc, SECURITY_DESCRIPTOR_REVISION) &&
		SetSecurityDescriptorDacl(&SecDesc, TRUE, (PACL)0, FALSE))
	{
		SecAttr.nLength = sizeof(SecAttr);
		SecAttr.lpSecurityDescriptor = &SecDesc;
		SecAttr.bInheritHandle = TRUE;
		pSec = &SecAttr;
	}

	live_h_map_file = CreateFileMapping(
		INVALID_HANDLE_VALUE,    // use paging file
		pSec,                    // default security
		PAGE_READWRITE,          // read/write access
		0,                       // maximum object size (high-order DWORD)
		sizeof(LIVE_DATA),                // maximum object size (low-order DWORD)
		LIVE_SHARED_MAP_OBJ_NAME);                 // name of mapping object

	if(!live_h_map_file)
	{
		cs_log("Could not set shared memory for live capture variable.\n");
		return -1;
	}

*h_map_file = OpenFileMapping(
		FILE_MAP_WRITE, //FILE_MAP_ALL_ACCESS,   // read/write access
		FALSE,                 // do not inherit the name
		LIVE_SHARED_MAP_OBJ_NAME);                 // name of mapping object

	if(!(*h_map_file)) {
		cs_log("Could not get shared memory for live catpure.\n");
		return -1;
	}
	*live_data = (LIVE_DATA *) MapViewOfFile(*h_map_file,   // handle to map object
		FILE_MAP_WRITE, // FILE_MAP_ALL_ACCESS, // read&write permission
		0,
		0,
		sizeof(LIVE_DATA));

	if(!(*live_data)) {
		cs_log("Could not set shared live catpture.\n");
		CloseHandle(*h_map_file);
		return -2;
	}
C# | Access Violation When Using Shared Memory From C/C++