This blog moved to medium->https://medium.com/@cocoamaemae

Monday, October 22, 2018

Regarding URL encode

What's URL encode?

URL can be sent only ASCII characters over internet. When doing http request with query parameters, query parameters are needed to be encoded.  It is called as percent encoding. It is defined in RFC3986.

How to do URL encode

Basically encode only values in query parameters to avoid collision of keys and =.
e.g.
http://example.com/?key1=value1&key2=value2....

reference

https://www.w3schools.com/tags/ref_urlencode.asp
https://en.wikipedia.org/wiki/Percent-encoding#Types_of_URI_characters

Monday, October 8, 2018

MySQL, MariaDB partitioning

What is partitioning?

The structure which divides one table data to multiple data.
When not using partitioning, one table data is aggregated to one file. On the other hand, when using partitioning, one table data is divided to multiple files. Especially table which is referenced can focus on and select performance can be improved. Also, deleting unnecessary data is easier.

There are vertical partitioning and horizontal partitioning, but explains regarding horizontal partitioning in this section.

Regarding MySQL, partition functionality is attached from 5.1
Regarding MariaDB, partition functionality can be used from initial version, 5.1

Assumption of using partition

The used column needs to have primary key.

Kind of partitioning

Range

Specify range of column value.
e.g.
CREATE TABLE sample_table (
    id int NOT NULL,
    day DateTime NOT NULL
    ) ENGINE=InnoDB
    PARTITION BY RANGE (id) (
    PARTITION p0 VALUES LESS THAN (3),
    PARTITION p0 VALUES LESS THAN (4)
)

List

Specify data list of column value.
e.g.

CREATE TABLE sample_table ( id int(2), day DateTime Not NULL ) ENGINE=InnoDB PARTITION BY LIST(id)( PARTITION p1 VALUES IN (1,2), PARTITION p2 VALUES IN (3,4,5));


Hash

RDBMS engine calculates hash and divides automatically.
e.g.
CREATE TABLE sample_table (
   id int(2),
   day DateTime NotNULL
 ) ENGINE=InnoDB
    PARTITION BY HASH(id)
    PARTITIONS 10;
;

Key

Specify more than one keys(primary or unique), and RDBMS engine create hash and divides automatically.
e.g.
CREATE TABLE t4 (
   id int(2) PRIMARY KEY,
   day DateTime NOT NULL
 ) ENGINE=InnoDB
    PARTITION BY KEY()
    PARTITIONS 10;
;





Front End Development Tools

TaskRunner Tool executing multiple tasks by only one execution. Tasks are like CSS preprocessor, Transpire, Module Bundler, etc... e.g. ...