Bay Cao và Bay Xa – Fly High and Fly Far

August 18, 2009

All about Linux’s Memory

Filed under: Other — doqkhanh @ 1:56 PM

1. Basic command to monitor memory in linux

All you need stored in this file – EVERYTHING:
# cat /proc/meminfo

Easier way to view memory usage :

Show cpu, memory, up time and process status
# top

Easy command to see free memory
# free -m
# free -k

2. Advance

In a server with lager memory installed, disk cached memory may make you comfused.
To see memory in cached, use this command
# cat /proc/meminfo | grep Cached

To count real memory in used by every process, try count in top command’s result
# ps aux | awk ‘{sum +=$4}; END {print sum}’

Hope this is helpful !

June 1, 2009

Đạo đức con người mới Việt Nam luôn luôn gắn với truyền thống văn hóa

Filed under: Other — doqkhanh @ 8:52 AM

Đạo đức con người mới Việt Nam luôn luôn gắn với truyền thống văn hoá, những giá trị tinh thần cao đẹp của tổ tiên, học hỏi điều tiến bộ, văn minh của nhân loại để làm giàu tri thúc cho mình phụng sự quốc kế, dân sinh. Những ai không còn mang trong mình những đức tính tốt đẹp của tổ tiên, ông cha, kế thừa và phát triển lên mãi thì đó là những người mất gốc. Gốc sâu, rễ bền của đạo đức bắt nguồn từ lòng yêu nước, thương dân, hoà mình, hiểu biết, tin cậy và lắng nghe quần chúng nhân dân, đoàn kết, kính già, yêu trẻ… Không thể trở thành một người Việt Nam chân chính nếu không phấn đấu rèn luyện “cần, kiệm, liêm, chính, chí công vô tư”.

Thi hào Nguyễn Du dạy “Chữ tâm kia mới bằng ba chữ tài” thật đúng lắm thay! Đất nước ta đang bước vào quy luật nền kinh tế thị trướng có sự quản lý của Nhà nước theo định hướng xã hội chủ nghĩa. Bên cạnh những thành tựu quan trọng, bức tranh kinh tế – xã hội khởi sắc rõ rệt, thì Đảng và nhân dân ta hết sức băn khoăn lo lắng trước hàng loạt hiện tượng tha hoá về phẩm chất, đạo đức trong một bộ phận cán bộ, Đảng viên và nhân dân. Quyền lực đồng tiền đang dẫm đạp, giày xéo lên đạo đức con người, sinh ra các tệ nạn tham nhũng, buôn lậu, làm hàng gian, hàng giả… bất chấp đạo lý luân thường. Tâm lý sùng ngoại, như tôi có lần lên tiếng báo động, trở thành phổ biến trong dân cư, nhất là sự tiêm nhiễm văn hoá ngoại lai, phản động, đồi truỵ trong một số lớp trẻ chúng ta.

Trích : http://www.chungta.net/PortletBlank.aspx/E87168AED88D45648F671CE3F2BB4818/View/Suy-ngam/Dao_duc_va_tai_nang/?print=1580824358

May 25, 2009

perl -MCPAN -e shell TIPs, TRICKs

Filed under: Other, Perl, Programming — doqkhanh @ 10:06 AM

1. With history
Using   perl -MCPAN -e shell -xdg
Instead of perl -MCPAN -e shell

You can using up/down arrow key to get local history.

2. When you get this message
CPAN.pm panic
Simply delete your lock file and reload cpan to continue without any error. Thanks Mr Bang for this handy tip.

3. You can set ftp site to empty for better support in case your wget cannot get file with cpan shell
Try to locate Config.pm in cpan directory
# locate CPAN/Config.pm
And edit it with vim, vi or any editor like that and make sure your urllist is empty, it is empty but it will working like a champ.
'urllist' => [],

4. Update cpan
# Backup your current module list
perl -MCPAN -e autobundle
# That will create a file with a name like
## /root/.cpan/Bundle/Snapshot_yyyy_mm_dd_00.pm
# Enter CPAN
perl -MCPAN -e shell -xdg
# Update
install Bundle::CPAN
# Reload cpan
reload cpan

April 20, 2009

Perl does not do any automatic dereferencing for you

Filed under: Other, Perl, Programming — Tags: , — doqkhanh @ 12:49 PM

No Automatic Dereferencing

Perl does not do any automatic dereferencing for you. You must explicitly dereference using the constructs just described. This is similar to C, in which you have to say *p to indicate the object pointed to by p. Consider

$rarray = \@array;

push ($rarray,  1, 2, 3);   # Error: $rarray is a scalar, not an array

push (@$rarray, 1, 2, 3);   # OK

push expects an array as the first argument, not a reference to an array (which is a scalar). Similarly, when printing an array, Perl does not automatically deference any references. Consider

print "$rarray, $rhash";

This prints

ARRAY(0xc70858), HASH(0xb75ce8)

This issue may seem benign but has ugly consequences in two cases. The first is when a reference is used in an arithmetic or conditional expression by mistake; for example, if you said $a += $r when you really meant to say $a += $$r, you’ll get only a hard-to-track bug. The second common mistake is assigning an array to a scalar ($a = @array) instead of the array reference ($a = \@array). Perl does not warn you in either case, and Murphy’s law being what it is, you will discover this problem only when you are giving a demo to a customer.

Copyright: http://oreilly.com/catalog/advperl/excerpt/ch01.html

March 8, 2009

I am using Windows Vista, but I need set …

Filed under: Other — doqkhanh @ 12:19 AM

I am using Windows Vista, but I need setup this Ubuntu Version on my friend laptop. That is a pretty old laptop but it can run Ubuntu very well.

ubuntuwithxpstyle

Blog at WordPress.com.