PHP cơ bản và nâng cao

Tính thời gian xử lý lệnh $start = microtime(true);sleep(10);$time_elapsed_secs = microtime(true) – $start; echo $time_elapsed_secs; Sử dụng IF trong ECHO echo “Một Hai Ba “.(($val==’aaa’) ? ‘Điều kiện đúng’ : ‘Nếu không đúng’).”Bốn Năm Sáu”; Tìm String trong String $a = ‘nguyen van a’; if (strpos($a, ‘nguyen) !== false) {return true;} Còn tiếp…

Mở Port trên Windows 10

Trên Windows 10 Mở Windows Firewall. Click vào Inbound Rules -> New Rule Chọn Custom -> Next Chọn All Programs -> Next Prototype chọn “TCP” Local Port chọn “Specific Ports“ Nhập Port muốn mở ví dụ: 3389 -> Next Scope -> Next Action -> Next Profile -> Next Name -> Nhập tên ví dụ: “Remote … Read more

Các dòng lệnh cơ bản và nâng cao khi sử dụng Linux

I. VỚI NỘI DUNG FILE. Xem 10 dòng đầu tiên head -10 file-input.txt Xem 10 dòng cuối tail -10 file-input.txt Xem từ dòng 10 đến dòng 20 awk ‘NR >= 10 && NR <= 20’ file-input.txt Xóa dòng 10 đến dòng 20, sau đó tạo file mới sed ‘1,20d’ file-input.txt > file-output.txt Xóa các dòng có … Read more

Một số câu lệnh cơ bản và nâng cao MySQL

Cơ bản Login MySQL. mysql -u root -p Tạo user và Database. create database dbcuaban; create user ‘usercuaban’@’localhost’ identified by ‘passcuaban’; grant all on dbcuaban.* to [email protected]; FLUSH PRIVILEGES; Tạo table. CREATE TABLE ten_table(id INT(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, cot1 VARCHAR(20) NOT NULL Unique, cot2 VARCHAR(50) NOT NULL, cot3 DATETIME NOT NULL) ENGINE=InnoDB; Chèn thêm 1 … Read more

Tổng hợp kiến thức Jquery, JavaScript

Delay khi onkeyup //Sử dụng function này function delay(callback, ms) { var timer = 0; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } //Demo bên dưới 500ms sẽ chạy Log 1 lần, Bình thường thì gõ tới đâu chạy … Read more

Chuyển file HTML thành PDF hoặc Image với Linux

Cách 1. yum install fontconfig libXrender libXext xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi freetype libpng zlib libjpeg-turbo wget http://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm rpm -Uvh wkhtmltox-0.12.5-1.centos7.x86_64.rpm Cách 2 Cài đặt evince yum install evince Cài đặt wkhtmltopdf wget http://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz Giải nén tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz Copy tới /usr/bin/ cp wkhtmltox/bin/wkhtmltopdf /usr/bin/ cp wkhtmltox/bin/wkhtmltoimages /usr/bin/ Lệnh chuyển HTML thành PDF wkhtmltopdf file.html file.pdf Lệnh chuyển HTML thành … Read more