Mapping one-to-one

SITUATION

mappingab

A2B (where A, as source, is in consecutive order)

sourceinconsord

 

B2A (where B, as source, is NOT in consecutive order)

sourcebarabara

Advertisements

Basic C-sharp

Contents:
C1. Event handler for form closing (button X)

C1. Event handler for form closing (button X)
SO1 , SO2

tried & works

this.FormClosing += this.fDAQ_FormClosing;

or

this.Load += new System.Windows.Forms.FormClosingEventHandler(fDAQ_FormClosing)

then

private void fDAQ_FormClosing(object sender, EventArgs e)

not tried yet

if (string.Equals((sender as Button).Name, @"CloseButton"))
// something
else
// Then assume that X has been clicked and act accordingly.

Geometri & Bilangan

Geometri:
cabang matematik yang berurusan dengan bentuk, ukuran, posisi relatif suatu figur, dan property (sifat) ruang.

Euclidean geometry:
geometri klasik. Tentang titik, garis, bidang, sudut, segitiga, kongruen (bentuk dan ukuran sama), kemiripan, figur solid, lingkaran, & geometri analitik (geometri koordinat/geometri kartesian).

Non-euclidean geometry:
e.g., elliptic geometry & hyperbolic geometry. Contoh termudah elliptic geometry: sphere/bole (misal bumi) di mana “garis” adalah lingkaran (e.g., lintang/bujur).
Pada bola, jumlah sudut pada segitiga (yang menghubungkan 3 titik pada permukaan sphere), tidak sama dengan 180 derajat.

Euclidean space:
meliputi bidang 2D, ruang 3D dari geometri Euclidean, dan dimensi yg lebih tinggi.

Real coordinate space, Rn, di mana n = dimensi ūüėÄ

Angka/Bilangan

Real (R): nilai yang merepresentasikan kuantitas pada suatu garis kontinu.

Real mencakup:
1. Irrational (misalnya akar 2, bilangan transendental -misalnya phi)
2. Rational (Q, quotient): ratio of two integers
Rational mencakup:
2.1. Floating point(?)
2.2. Integer (Z)
Integer mencakup:
2.2.1. negative integer(?)
2.2.2. Natural number (N): bilangan yg digunakan untuk mencacah/counting. -> non-negatif, cardinal numbers

Simple Regex

Find

  1. Finditer
    reg = ‘\\s(\\w*?)=’ ¬† ¬† ¬† ¬† ¬† ¬† ¬† # word between space and =
    line = ‘<lalala=”x” lala=”y” la=”z”>’
    .for match in re.finditer(reg, line, re.S):
    .print(match.group(1), end=””)
  2. Findall
    reg =¬†‘”(.*?)”‘ ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†#¬†between ” and ”
    line =¬†‘<lalala=”x” lala=”y” la=”z”>’
    .ret = re.findall(reg, line)

 

Notes:
. wildcard/any character
* repeated  more than 1
? occurrence 0 or 1

*? is used to make it lazy (match the shortest one) because there are many ” in the input string line. If ? is not used, it will match the longest possible answer (from the first ” to the last “)

Quantifier, by default: greedy
e.g. for string “123”, ¬†regex \d+ will match 123, instead of 1
(additional note: + is for occurrence more than 1)

lazy = as few as possible = shortest match = reluctant
by adding ?
string: 123EEE
reg = \w*?E
match = 123E

*? :

http://www.rexegg.com/regex-quantifiers.html