Cassandra – import snapshot tables(column family)

The following command will import a table(column family) to the destination Cassandra node.

$ sstableloader -d [destination IP address] -p [port number] [table directory]
Posted in cassandra, Programming | Leave a comment

SHELL – tmux configuration example

# Make mouse useful in copy mode
# setw -g mode-mouse on

# Allow mouse to select which pane to use
# set -g mouse-select-pane on

set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Set ability to capture on start and restore on exit window data when running an application
setw -g alternate-screen on

# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50

set-option -g history-limit 5000

Posted in Programming, tmux | Leave a comment

Functional Programming – Simple Explaining of Keyword

1. Functor -> Mappable
2. Currying -> Currying
3. Applicative -> Applicative
4. Monad -> Chainable
5. Monoid -> Aggregatable
6. Catamorphism -> Collapsable

Posted in Functional Programming, Programming | Leave a comment

Monad – Definition of Monad with Monoid

Monad is a binding function to connect two functions where are different types between returning value and input argument. So Monad will allow to compose two incompatible functions.

A monad is just a monoid in the category of endofunctors.

This is because Monad has the following properties
1. Closure
2. Associative
3. Identity

| Leave a comment

Monoid – Simple definition of Monoid

1. Closure: Two same type pair operation results a new result with same type.
2. Associative: Doesn’t matter or operation order wit a pair.
3. Identity: There is an identity can always result the original value.

Integer plus:

1 + 2 = 3
(1 + 2) + 3 = 1 + (2 + 3)
1 + 0 = 1
0 + 1 = 1

String concatenation:

"1" + "2" = "12"
"1" + ("2" + "3") = ("1" + "2") + "3"
"" + "1" = "1"
"1" + "" = "1"

Importance of Monoids:
Once it is identified that provided data is Monoid, it can be parallelized very easily.
For instance, we can calculate the number of total sold items in a day from million items.



Log file aggregation:
From a giant log file, we can aggregate useful data such as what is the average request on Monday, Tuesday, …, Sunday because String is Monoid.
It is important to know that Metric data should be Monoid.

Posted in Functional Programming, Programming | Leave a comment

Mid night commander short cuts

MC commands
—– Esc —–
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
Open same working directory in the inactive panel: Esc + i
Open parent working directory in the inactive panel: Esc + o
Go to top of directory in active pane: Esc + v / Esc + g
Go to bottom of directory in active pane: Esc + j / Ctrl + c
Go to previous directory: Esc + y
Search pop-up: Esc + ?
—– Ctrl —–
Refresh active panel: Ctrl + r
Selecting files and directories: Ctrl + t
Switch active inactive panels: Ctrl + i
Switch active inactive panels content: Ctrl + u
Execute command / Open a directory: Ctrl + j
—– F —–
F1: help
F2: user menu
F3: read file / open directory
F4: edit file
F5: copy file or direcotry
F6: move file or directory
F7: create directory
F8: delete file / directory
F9: open menu bar
F10: exit MC

—– Utils —–

next-page, C-v
move the selection bar one page down.

prev-page, Alt-v
move the selection bar one page up.

Alt-o If the currently selected file is a directory, load that directory on the other panel and moves the selection to the next file. If the currently selected file is
not a directory, load the parent directory on the other panel and moves the selection to the next file.

Alt-i make the current directory of the current panel also the current directory of the other panel. Put the other panel to the listing mode if needed. If the current
panel is panelized, the other panel doesn’t become panelized.

C-PageUp, C-PageDown
only when supported by the terminal: change to “..” and to the currently selected directory respectively.

Alt-y moves to the previous directory in the history, equivalent to clicking the with the mouse.

Alt-Shift-h, Alt-H
displays the directory history, equivalent to depressing the ‘v’ with the mouse.

Alt-t toggle the current display listing to show the next display listing mode. With this it is possible to quickly switch to brief listing, long listing, user defined
listing mode, and back to the default.

C-\ (control-backslash)
show the directory hotlist and change to the selected directory.
Ctrl-x, H: Add a current directory in the hotlist.

Alt-g, Alt-r, Alt-j
used to select the top file in a panel, the middle file and the bottom one, respectively.

Alt-s(Ctrl-s) search a file name in the current panel

Alt-Shift-?: Find a file in the sub directories.

Posted in Etc | Leave a comment

Monad – simple example definition

Combines the following concept.

1. Functor
– Type constructor.
– Value lifting.
– class Functor f where
fmap :: (a -> b) -> (fa -> fb)
2. Bind
– Create a functor then unwrap -> for example, flatMap in optional in Java8.

| Leave a comment