Category Archives: Chỉ dẫn lập trình

Think to do best

Chia để chạy!

Trong thư mục /home/huypv/film có 8000 thư mục con
– Nhat-ky-vang-anh
+ Nhat-ky-vang-anh.mp4
+ Nhat-ky-vang-anh.srt
+ Nhat-ky-vang-anh.log

– Gap-nhau-cuoi-tuan
+ Gap-nhau-cuoi-tuan.mp4
+ Gap-nhau-cuoi-tuan.srt
+ Gap-nhau-cuoi-tuan.log

– Dep-tung-centimet
+ Dep-tung-centimet.mp4
+ Dep-tung-centimet.srt
+ Dep-tung-centimet.log

– Gai-nhay
+ Gai-nhay.mp4
+ Gai-nhay.srt
+ Gai-nhay.log

– Tam-quoc-dien-nghia
+ Tam-quoc-dien-nghia.mp4
+ Tam-quoc-dien-nghia.srt
+ Tam-quoc-dien-nghia.log

…

Hãy copy sang “/home/huy phung/phim” một cách nhanh nhất?

SSH chạy lệnh rồi đi ngủ

Bình thường:
SSH vào server
Rồi chạy lệnh/script XXX gì đó (mất nhiều thời gian mới hoàn thành)
Nếu có việc phải exit hoặc bị disconnect thì lệnh XXX đang chạy sẽ tèo :|

Do đó, phải chạy lênh như này:
nohupYOUR_COMMAND &

Tham khảo thêm:
– http://en.wikipedia.org/wiki/Nohup
– nice

Meaning of RTSP Status Code

This is a list of the supported RTSP status codes and their meanings

100 – Continue
200 – OK
201 – Created
250 – Low on Storage Space
300 – Multiple Choices
301 – Moved Permanently
302 – Moved Temporarily
303 – See Other
304 – Not Modified
305 – Use Proxy
400 – Bad Request
401 – Unauthorized
402 – Payment Required
403 – Forbidden
404 – Not Found
405 – Method Not Allowed
406 – Not Acceptable
407 – Proxy Authentication Required
408 – Request Time-out
410 – Gone
411 – Length Required
412 – Precondition Failed
413 – Request Entity Too Large
414 – Request-URI Too Large
415 – Unsupported Media Type
451 – Parameter Not Understood
452 – Conference Not Found
453 – Not Enough Bandwidth
454 – Session Not Found
455 – Method Not Valid in This State
456 – Header Field Not Valid for Resource
457 – Invalid Range
458 – Parameter Is Read-Only
459 – Aggregate operation not allowed
460 – Only aggregate operation allowed
461 – Unsupported transport
462 – Destination unreachable
463 – Key management Failure
500 – Internal Server Error
501 – Not Implemented
502 – Bad Gateway
503 – Service Unavailable
504 – Gateway Time-out
505 – RTSP Version not supported
551 – Option not supported

Đôi khi muốn cho server nghỉ

User – URL [.htacess, mod_rewrite] – index.php [route] – path/script-will-be-exec.php [access DB] – data [template] – HTML

Chèn vào đầu file index.php:
if (file_exists(‘offline’)) {
echo ‘Offline!’;
exit(0);
}

// current code

Và thế là mỗi khi muốn làm gì đó (update/upload code, upgrade version, fix bug…), chỉ cần: touch offline
Cách này hay hơn so với:
– Offline nhờ thiết lập cấu hình trong db
– Offline bằng cách tạo index.html và cấu hình ưu tiên index.html lớn hơn index.php (user nhập hẳn index.php thì sao)