Làm thế nào để lấy ra một số bản ghi ngẫu nhiên từ database?
Nếu tư duy một cách đơn giản thì đầu tiên bạn sẽ phải generate các mã ID ngẫu nhiên rồi từ các mã ID đó query lấy ra bản ghi tương ứng.
Tuy nhiên mã ID generate ra phải làm sao đảm bảo là có tương ứng một bản ghi với nó :-? Điều này có vẻ khó. Thôi vứt đê, đừng bận tâm, bởi MySQL đã hỗ trợ sẵn việc lấy ra các bản ghi ngẫu nhiên rồi :-j
Ví dụ nè:
- Lấy ra ngẫu nhiên 10 người may mắn để trao giải thưởng may mắn sau khi tàn cuộc vui
SELECT * FROM people ORDER BY RAND() limit 10;
- Lấy ra 5 người phụ nữ ngẫu nhiên may mắn để tôn vinh
SELECT * FROM people WHERE sex=’female’ ORDER BY RAND() LIMIT 5;
After making changes to Apache’s configuration file (httpd.conf), it is necessary to restart Apache for the changes to take effect. A normal restart will close active connections which may cause problems for users.
To restart Apache gracefully without aborting open connections or to start Apache if it is not running:
apachectl graceful
If apachectl is not in your PATH and you don’t know where it is, refer to the recipe Find a file by name to find the location of apachectl, then run it with the fully qualified path, for example:
/usr/local/apache/bin/apachectl graceful
Bonus: add your dir into your PATH
vim ~/.bash_profile
export PATH=$PATH:/path/to/my/directory
English: Just use the [Ctrl] p keystroke after you’ve entered some text.
Vietnamese: Gõ vài chữ (đầu) rồi nhấn Ctrl + P

Vim auto complete feature
Symptoms
A message saying “WARNING: Directory mismatch” appeared immediately after starting the XAMPP Control Panel program (xampp-control.exe).
No effect, but I hate warning!
Resolution
1. Sign in using an account with administrative privileges. You will need this to run the Windows Registry Editor.
2. Click on the Windows Start button, type regedit, and press Enter.
3. In the left pane of the Registry Editor window, navigate to HKEY_LOCAL_MACHINE and then SOFTWARE.
4. Right-click on SOFTWARE, choose New, and choose Key.
5. Type XAMPP and press Enter.
6. Navigate to the XAMPP key you just created.
7. Right-click on XAMPP, choose New, and choose String.
8. Enter Install_Dir and press Enter.
9. Right-click on Install_Dir and choose Modify.
10. Enter the path to your XAMPP installation (such as C:\xampp) in the Value data text box and click the OK button.
11. Close the Registry Editor.
12. Run the XAMPP Control Panel program and the error should no longer appear.
ls -l /var/www/webspace/hostpro/baodongkhoi/baodongkhoi.com.vn
images
index.php
logs
.htaccess
cd /var/www/webspace/hostpro/baodongkhoi/
tar -czf bdk.tgz baodongkhoi.com.vn –exclude “logs”
tar -tzfv bdk.tgz
images
index.php
.htaccess
Đại loại thế (chú ý cái ngoại trừ exclude này là theo so khớp kiểu mẫu pattern chứ không phải so bằng bằng: logs ~ logs; xxx.logs, mylogs)