Truy vấn có tham số từ form trong Visual Foxpro 6.0

Người đăng: ngaybennhau on Thứ Bảy, 19 tháng 2, 2011

Trong lúc lập trình, chúng ta thường phải xây dựng các lệnh truy vấn theo nội dung động do người dùng nhập vào. Ngôn ngữ FoxPro (và các ngôn ngữ lập trình khác) cho phép ta thực hiện điều này dễ dàng.

Thí dụ ta thiết kế 1 Form FoxPro đơn giản gồm 1 textbox có tên là txtHoten và 1 button có tên là btnSearch, đoạn code FoxPro sau (nằm trong thân thủ tục xử lý sự kiện click chuột vào button btnSearch) sẽ tạo lệnh truy vấn Select để tìm các record của bảng table1 trong file database data1.dbc mà nội dung trường hoten có chứa chuỗi nhập vào textbox txtHoten:

*khai báo biến cần dùng
public shoten
*mở database cần dùng
open database c:datadata1.dbc
*chứa chuỗi nhập vào biến
shoten = ALLTRIM(thisform.txtHoten.Text)
*thực hiện tìm kiếm
Select * from table1 where hoten like '%&str%'

Lưu ý, trong lệnh Select (hay bất kỳ lệnh truy vấn SQL nào), bạn có thể chèn nội dung động bằng cách dùng cú pháp &ten, trong đó ten là tên biến chứa nội dung chuỗi động cần dùng.

Theo pcworld

Nguồn : Thanglong-Aptech.com

More about

Cảnh giác virus tấn công người dùng Twitter

Người đăng: ngaybennhau

Các chuyên gia của Kaspersky Lab lại vừa đưa ra cảnh báo về một loại sâu mới tấn công các tài khoản Twitter. Loại sâu này khai thác dịch vụ rút gọn đường dẫn của nhà cung cấp Google là goo.gl.

 Cảnh giác virus tấn công người dùng Twitter

Các đường dẫn được rút gọn đang được sử dụng rộng rãi trong các hệ thống mạng xã hội giúp rút ngắn độ dài các thông điệp, tin nhắn cho người sử dụng dịch vụ Twitter. Tuy nhiên, theo cảnh báo gần đây của phòng thí nghiệm Kaspersky, các đường dẫn ngắn này có nhiều mối đe dọa tiềm ẩn, bởi các đường dẫn rút gọn làm cho người dùng không biết trước nội dung của chúng và dễ bị dẫn vào các trang web có thể gây hại. Những dấu hiệu mới nhất càng chứng tỏ giới tin tặc đang tăng cường sử dụng phương thức tấn công này.

Đợt tấn công mới nhất trên mạng xã hội Twitter chứng kiến một loại sâu máy tính sử dụng dịch vụ đường dẫn rút gọn uy tín của Google là goo.gl. Chúng sẽ dẫn dụ người dùng đến một trang web cung cấp phần mềm diệt virus giả mang tên "Security Shield". Sau nhiều lần chuyển trang, người sử dụng bị chuyển đến một trang bị bọn tin tặc nhúng vào các mã độc hại bao gồm cả các mã RSA chạy trên nền phổ biến JavaScrip, có hàng ngàn các thông điệp Twitter tiếp tục phát tán loại sâu này mỗi ngày.

Quá trình tấn công sẽ xảy ra như sau, người dùng sẽ nhận được một cảnh báo rằng máy tính bạn đang chạy các ứng dụng nguy hiểm khi đang truy cập các trang web. Lời cảnh báo còn đưa hướng dẫn chi tiết giúp người dùng loại bỏ tất cả các mối đe dọa đó bằng cách tải phầm mềm diệt virus "Security Shield". Kết quả là máy tính người dùng sẽ bị nhiễm các mã độc hại khi chọn cài đặt chương trình diệt virus giả mạo đó.

Bên cạnh dùng phần mềm diệt virus, các chuyên gia bảo mật cũng khuyến cáo người dùng phải luôn cẩn thận khi truy cập vào các liên kết ngẫu nhiên ngay cả trên những mạng xã hội phổ biến như Twitter và các dịch vụ uy tín như Goo.gl.

Lê Mỹ
Theo ictnews

Nguồn: Cảnh giác virus tấn công người dùng Twitter

More about

Thêm lớp bảo mật cho quá trình đăng nhập Windows

Người đăng: ngaybennhau

Bài viết sẽ trình bày các biện pháp để tăng tính bảo mật cho quá trình đăng nhập vào máy tính. Tùy theo nhu cầu bạn có thể chọn lựa cho mình một phương pháp phù hợp để bảo vệ dữ liệu khỏi các cặp mắt tò mò của người khác khi không có bên cạnh chiếc máy tính.

1.Dùng mật khẩu

Đây là cách phổ biến nhất được đại đa số người dùng chọn lựa.Từ khi khởi động máy tính cho đến lúc vào giao diện desktop của Windows bạn có thể thiết lập cho mình 3 lớp mật khẩu để tăng tính an toàn: mật khẩu CMOS, mật khẩu syskey và mật khẩu đăng nhập Windows.

+Mật khẩu BIOS: tùy vào nhà sản xuất mainboard mà các phím tắt để vào BIOS có khác nhau nhưng thông thường là các phím Del, F1, F2, F10, ...Đối với những người chưa có kinh nghiệm không nên thiết lập mật khẩu này. Nếu chẳng may quên sẽ không thể khởi động vào windows được. Hơn nữa việc gỡ bỏ không hề đơn giản, đặc biệt trên các máy laptop.

+Mật khẩu syskey: gõ syskey trong hộp thoại tìm kiếm ở Start menu, nhấn Update trong hộp thoại xuất hiện. Đánh dấu chọn vào mục Password Startup và nhập cùng một mật khẩu tại hai trường Password và Confirm xong nhấn OK để kết thúc.

syskey Thêm lớp bảo mật cho quá trình đăng nhập Windows


+Mật khẩu đăng nhập: Đây là mật khẩu được sử dụng phổ biến nhất và cũng dễ dàng bị bẻ khóa nhất bằng rất nhiều các công cụ trên đĩa Hiren Boot. Để tạo mật khẩu này bạn vào Control Panel, mục User accounts, chọn tài khoản muốn tạo mật khẩu và chọn mục Create a password for your account. Nhập cùng mật khẩu vào hai trường New password và Confirm new password xong nhấn Create password.

account Thêm lớp bảo mật cho quá trình đăng nhập Windows

2.Dùng chức năng nhận dạng khuôn mặt

Với phương pháp này đòi hỏi bạn phải có một chiếc webcam chất lượng tốt và một phần mềm nhận dạng khuôn mặt được cài đặt sẵn. Phần mềm miễn phí Luxand Blink được đánh giá cao về lĩnh vực này. Với Luxand Blink, bạn có thể đăng nhập vào ban ngày hay ban đêm nhờ các thuật toán nhận dạng khuôn mặt rất tinh vi và tự động điều chỉnh để thích ứng với sự thay đổi điều kiện ánh sáng.

Trong quá trình cài đặt bạn sẽ được yêu cầu chọn loại webcam mình sử dụng như USB 2.0 Camera (kết nối qua cổng USB), Cyberlink webcam Filter ...(thường tích hợp trên các laptop được cài sẵn phần mềm Cyberlink Youcam).

Quá trình cài đặt sẽ tự động diễn ra, nhấn Next hai lần để vào bước cấu hình. Webcam sẽ được khởi động để tiến hành quá trình nhận dạng khuôn mặt. Bạn nhìn thẳng trực diện vào webcam và chầm chậm quay đầu từ trái sang phải theo yêu cầu. Kế đến nhập mật khẩu đăng nhập Windows (nếu có) vào khung Your password xong nhấn Finish để kết thúc.

webcame Thêm lớp bảo mật cho quá trình đăng nhập Windows

Trong lần đăng nhập kế tiếp sẽ có thêm tùy chọn đăng nhập bằng khuôn mặt để bạn chọn lựa. Chương trình mặc định khởi động cùng Windows và kèm theo biểu tượng dưới khay hệ thống khi hoạt động. Bạn nhấn phải chuột vào biểu tượng chọn Settings để thiết lập lại webcam và khuôn mặt hay vô hiệu hóa chương trình nếu không muốn dùng cách đăng nhập này nữa.

webcame2 Thêm lớp bảo mật cho quá trình đăng nhập Windows

3.Dùng chức năng nhận dạng vân tay:

Tính năng nhận dạng vân tay này thường chỉ xuất hiện trên các dòng máy tính xách tay cao cấp và các máy trạm. Tuy nhiên nếu có điều kiện bạn có thể trang bị thêm thiết bị đầu đọc dấu vân tay như sản phẩm Microsoft Fingerprint Reader ( giá khoảng 50USD ). Chỉ cần cài đặt phần mềm kèm theo khi mua thiết bị và bắt đầu sử dụng. Cách nhận dạng vân tay cho độ chính xác và bảo mật cao vì không phụ thuộc vào yếu tố môi trường như trong trường hợp của webcam.

Bên cạnh đó chức năng này có thể được sử dụng để đăng nhập vào các trang web, mạng không dây, ...miễn là các trình điều khiển và phần mềm đi kèm với thiết bị hỗ trợ các tính năng này. Có thể nói đây là cách an toàn nhất để bảo vệ quá trình đăng nhập vào máy tính.

vantay Thêm lớp bảo mật cho quá trình đăng nhập Windows

Theo quản trị mạng

Nguồn : Thêm lớp bảo mật cho quá trình đăng nhập Windows

More about

Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x

Người đăng: ngaybennhau

Theo thông tin từ phía hãng, Rsyslog có khả năng cải thiện khả năng hỗ trợ syslogd, có thể được sử dụng như 1 phương án thay thế hoặc dự phòng.

Bên cạnh đó, những tính năng nâng cao khá phù hợp với các tầng lớp doanh nghiệp, khả năng bảo mật mã hóa cũng khá đơn giản và dễ thiết lập, dù cho đối tượng người sử dụng có ít kinh nghiệm. Cụ thể, chúng ta sẽ cùng nhau kết hợp và cài đặt tất cả các tính năng của Rsyslog 5.7.2 trên nền tảng CentOS 5.5 server.
Để bắt đầu, chúng ta cần cài đặt những gói hỗ trợ sau:

yum install -y pcre pcre-devel mysql-server mysql-devel gnutls gnutls-devel gnutls-utils net-snmp net-snmp-devel net-snmp-libs net-snmp-perl net-snmp-utils libnet libnet-devel

Tiếp theo là gói librelp (Reliable Event Logging Protocol Library) để sử dụng các thư viện dành cho giao thức RELP - có nhiệm vụ cung cấp khả năng ghi lại các sự kiện xảy ra trong hệ thống mạng và đảm bảo rằng không bỏ sót bất kỳ tin nhắn cũng như email nào, cho dù có vấn đề xảy ra với quá trình kết nối hoặc các đầu peer không ổn định.

cd /tmp
wget http://download.rsyslog.com/librelp/librelp-1.0.0.tar.gz
tar -xvf librelp-1.0.0.tar.gz
cd librelp-1.0.0
./configure --prefix=/usr
make
make install
cd /tmp
wget http://sourceforge.net/projects/libestr/files/libestr-0.1.0.tar.gz/download
tar -xvf libestr-0.1.0.tar.gz
cd libestr-0.1.0
./configure --prefix=/usr
make
make install
cd /tmp
wget http://www.libee.org/files/download/libee-0.1.0.tar.gz
tar -xvf libee-0.1.0.tar.gz
cd libee-0.1.0
./configure --prefix=/usr
make
make install
Tại thời điểm bài viết này, chúng tôi sử dụng rsyslog 5.7.2:
cd /tmp
wget http://www.rsyslog.com/files/download/rsyslog/rsyslog-5.7.2.tar.gz
tar -xvf rsyslog-5.7.2.tar.gz
cd rsyslog-5.7.2
Để tìm hiểu thông tin về những tùy chọn có sẵn trong Rsyslog, các bạn có thể sử dụng lệnh
./configure -help.
Câu lệnh sau sẽ kích hoạt hầu hết các tính năng rsyslog như Compression, Multithreading, MySql, SNMP, Mail, RELP... :
 
./configure --enable-regexp --enable-zlib --enable-pthreads --enable-klog --enable-inet --enable-unlimited-select --enable-debug --enable-rtinst --enable-memcheck --enable-diagtools --enable-mysql --enable-snmp --enable-gnutls --enable-rsyslogrt --enable-rsyslogd --enable-extended-tests --enable-mail --enable-imptcp --enable-omruleset --enable-valgrind --enable-imdiag --enable-relp --enable-testbench --enable-imfile --enable-omstdout --enable-omdbalerting --enable-omuxsock --enable-imtemplate --enable-omtemplate --enable-pmlastmsg --enable-omudpspoof --enable-omprog --enable-impstats
make
make install
Cài đặt và khởi tạo cơ sở dữ liệu MySQL:
mysql -u root -p < plugins/ommysql/createDB.sql
mysql -u root -p mysql
 
GRANT ALL ON Syslog.* TO rsyslog@localhost IDENTIFIED BY 'your-mysql-password';
flush privileges;
 
Tiếp theo, chúng ta sẽ cấu hình mã init:
vi /etc/init.d/rsyslog
#!/bin/bash
#
# rsyslog Starts rsyslogd/rklogd.
#
#
# chkconfig: - 12 88
# description: Syslog is the facility by which many daemons use to log
# messages to various system log files. It is a good idea to always
# run rsyslog.
### BEGIN INIT INFO
# Provides: $syslog
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Enhanced system logging and kernel message trapping daemons
# Description: Rsyslog is an enhanced multi-threaded syslogd supporting,
# among others, MySQL, syslog/tcp, RFC 3195, permitted
# sender lists, filtering on any message part, and fine
# grain output format control.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
RETVAL=0
start() {
[ -x /usr/local/sbin/rsyslogd ] || exit 5
#[ -x /usr/local/sbin/rklogd ] || exit 5
# Do not start rsyslog when sysklogd is running
if [ -e /var/run/syslogd.pid ] ; then
echo $"Shut down sysklogd before you run rsyslog";
exit 1;
fi
# Source config
if [ -f /etc/sysconfig/rsyslog ] ; then
. /etc/sysconfig/rsyslog
else
#SYSLOGD_OPTIONS="-c3"
SYSLOGD_OPTIONS="-c5"
#KLOGD_OPTIONS="-2"
fi
if [ -z "$SYSLOG_UMASK" ] ; then
SYSLOG_UMASK=077;
fi
umask $SYSLOG_UMASK
echo -n $"Starting system logger: "
daemon /usr/local/sbin/rsyslogd $SYSLOGD_OPTIONS
RETVAL=$?
echo
#echo -n $"Starting kernel logger: "
#daemon rklogd $KLOGD_OPTIONS
#echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyslog
return $RETVAL
}
stop() {
#echo -n $"Shutting down kernel logger: "
#killproc rklogd
#echo
echo -n $"Shutting down system logger: "
killproc rsyslogd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rsyslog
return $RETVAL
}
reload() {
RETVAL=1
syslog=`cat /var/run/rsyslogd.pid 2>/dev/null`
echo -n "Reloading system logger..."
if [ -n "${syslog}" ] && [ -e /proc/"${syslog}" ]; then
kill -HUP "$syslog";
RETVAL=$?
fi
if [ $RETVAL -ne 0 ]; then
failure
else
success
fi
echo
RETVAL=1
#echo -n "Reloading kernel logger..."
#klog=`cat /var/run/rklogd.pid 2>/dev/null`
#if [ -n "${klog}" ] && [ -e /proc/"${klog}" ]; then
#kill -USR2 "$klog";
# RETVAL=$?
#fi
#if [ $RETVAL -ne 0 ]; then
#failure
#else
#success
#fi
#echo
return $RETVAL
}
rhstatus() {
status rsyslogd
#status rklogd
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload|force-reload)
reload
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/rsyslog ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart}"
exit 2
esac
exit $?
Hãy lưu ý đến giá trị SYSLOGD_OPTIONS="-c5″ đã được thiết lập. Sau đây, chúng ta sẽ thiết lập Syslog và Rsyslog:
service syslog stop
chkconfig syslog off
chmod 755 /etc/init.d/rsyslog
chkconfig --add rsyslog
chkconfig rsyslog on
 
Các đoạn mã init có thể download tại đây (http://honeynet.ir/software/rsyslog/). Một số mẫu tham khảo khác các bạn có thể tìm và tham khảo thêm tại trang chủ (http://www.rsyslog.com/):
vi /etc/rsyslog.conf
# Input Modules -----------------------------------This line is comment
#--------------------------------------------------This line is comment
$ModLoad impstats.so
$PStatsInterval 300
syslog.info /var/log/rsyslog-stats
#--------------------------------------------------This line is comment
$ModLoad immark.so # provides --MARK-- message capability
$ModLoad imuxsock.so # provides support for local system logging (via logger command)
$ModLoad imklog.so # provides kernel logging support (previously done by rklogd)
#--------------------------------------------------This line is comment
$ModLoad imudp.so # provides UDP syslog reception
$UDPServerAddress * # all local interfaces
$UDPServerRun 514 # start UDP server (log server receiver)
#--------------------------------------------------This line is comment
$ModLoad imtcp.so # provides TCP syslog reception and GSS-API (if compiled)
$InputTCPServerRun 514 # start TCP server (log server receiver)
#--------------------------------------------------This line is comment
$ModLoad imrelp.so # RELP input
$InputRELPServerRun 20514 # start RELP Protocol
#--------------------------------------------------This line is comment
$ModLoad imfile.so # Text file input
$InputFileName /var/log/i-am-a-text-file.log
$InputFileTag my-text-file:
$InputFileStateFile stat-file1
$InputFileSeverity error
$InputFileFacility local7
$InputFilePollInterval 10 # check for new lines every 10 seconds
$InputRunFileMonitor
#--------------------------------------------------This line is comment
#$ModLoad imgssapi.so # Plain TCP and GSSAPI
#$ModLoad im1395.so # Messages via RFC1395
# Output Modules ----------------------------------This line is comment
#--------------------------------------------------This line is comment
$ModLoad omsnmp.so # Send SNMP traps
#$actionsnmptransport udp
#$actionsnmptarget 192.168.x.x
#$actionsnmptargetport 162
#$actionsnmpversion 1
#$actionsnmpcommunity public
#*.* "http://npower.vn/wp-includes/images/smilies/icon_surprised.gif" alt="icon surprised Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x" class="wp-smiley" title="Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x"> msnmp:
#--------------------------------------------------This line is comment
$ModLoad ommysql.so # Log to MySQL
#$ModLoad ompgsql.so # Log to PostgreSQL
#--------------------------------------------------This line is comment
$ModLoad ommail.so # Send mail
#$ActionMailSMTPServer mail.example.net
#$ActionMailFrom rsyslog@example.net
#$ActionMailTo operator@example.net
#$ActionMailTo admin@example.net
#$template mailSubject,"disk problem on %hostname%"
#$template mailBody,"RSYSLOG Alertrnmsg='%msg%'"
#$ActionMailSubject mailSubject
#$ActionExecOnlyOnceEveryInterval 21600
#if $msg contains 'hard disk fatal failure' then "http://npower.vn/wp-includes/images/smilies/icon_surprised.gif" alt="icon surprised Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x" class="wp-smiley" title="Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x"> mmail:;mailBody
#--------------------------------------------------This line is comment
$ModLoad omrelp.so # Send to another host via RELP
#$ModLoad omlibdbi.so # Log via generic DB output
#$ModLoad omgss.so # GSS enabled output
# Globals -----------------------------------------This line is comment
$umask 0000
$DirCreateMode 0640
$FileCreateMode 0640
$RepeatedMsgReduction on
$WorkDirectory /var/log/rsyslog # default location for work (spool) files
$ActionQueueType LinkedList # use asynchronous processing
$ActionQueueFileName queue # set file name, also enables disk mode
$ActionResumeRetryCount -1 # infinite retries on insert failure
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
$MainMsgQueueMaxFileSize 100M
$ActionQueueMaxFileSize 5M
#--------------------------------------------------This line is comment
# Below find some samples of what a template can do. Have a good
# time finding out what they do [or just tun them] "http://npower.vn/wp-includes/images/smilies/icon_wink.gif" alt="icon wink Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x" class="wp-smiley" title="Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x">
# A template that resambles traditional syslogd file output:
$template TraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%n"
# a template useful for debugging format issues
$template DEBUG,"Debug line with all properties:nFROMHOST: '%FROMHOST%', HOSTNAME: '%HOSTNAME%', PRI: %PRI%,nsyslogtag '%syslogtag%', programname: '%programname%', APP-NAME: '%APP-NAME%', PROCID: '%PROCID%', MSGID: '%MSGID%',nTIMESTAMP: '%TIMESTAMP%', STRUCTURED-DATA: '%STRUCTURED-DATA%',nmsg: '%msg%'nescaped msg: '%msg:::drop-cc%'nrawmsg: '%rawmsg%'nn"
# A template that resembles RFC 3164 on-the-wire format:
# (yes, there is NO space betwen syslogtag and msg! that's important!)
$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"
# a template resembling traditional wallmessage format:
$template wallmsg,"rn7Message from syslogd@%HOSTNAME% at %timegenerated% ...rn %syslogtag%%msg%nr"
# The template below emulates winsyslog format, but we need to check the time
# stamps used. for now, it is good enough icon wink Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS 5.x This format works best with
# other members of the MonitorWare product family. It is also a good sample
# where you can see the property replacer in action.
$template WinSyslogFmt,"%HOSTNAME%,%timegenerated:1:10:date-rfc3339%,%timegenerated:12:19:date-rfc3339%,%timegenerated:1:10:date-rfc3339%,%timegenerated:12:19:date-rfc3339%,%syslogfacility%,%syslogpriority%,%syslogtag%%msg%n"
# A template used for database writing (notice it *is* an actual
# sql-statement):
$template dbFormat,"insert into SystemEvents (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%, '%HOSTNAME%',%syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')",sql
$template FileFormat,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%n"
$template ForwardFormat,"<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%"
# Selector lines are somewhat different from stock syslogd. With
# rsyslog, you can add a semicolon ";" after the target and then
# the template name. That will assign this template to the respective
# action. If no template name is given, a hardcoded template is used.
# If a template name is given, but the template was not defined, the
# selector line is DEACTIVATED.
#--------------------------------------------------------------------
#--------------------------------------------------This line is comment
# Forward via TCP with maximum compression:
#$AllowedSender TCP, 127.0.0.1, 192.0.2.0/24, [::1]/128, *.example.net, somehost.example.com
#*.* @@(z9)192.168.x.x:514
# Forward via UDP with maximum compression:
#$AllowedSender UDP, 127.0.0.1, 192.0.2.0/24, [::1]/128, *.example.net, somehost.example.com
#*.* @(z9)192.168.x.x:514
# Forward via RELP Protocol :
#*.* icon surprised Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS  5.x mrelp:192.168.2.4:20514;TraditionalFormat
# Store all log files in MySQL DB :
#*.* icon surprised Hướng dẫn cài đặt Rsyslog 5.7.x trên nền tảng CentOS  5.x mmysql:127.0.0.1,Syslog,rsyslog,your-mysql-password
#--------------------------------------------------This line is comment
#--------------------------------------------------This line is comment
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console;TraditionalFileFormat
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
#--------------------------------------------------This line is comment
$IncludeConfig /etc/rsyslog.d/*.conf
#--------------------------------------------------This line is comment
#if message contains 'network error' then run the restart-network.sh shell script!!!
#:msg, contains, "network error" ^/root/restart-network.sh
 
Sau đó, khởi động Rsyslog:
chmod 640 /etc/rsyslog.conf
service rsyslog start
tail -f /var/log/messages
 
Và kiểm tra quá trình hoạt động của Rsyslog như sau:
 
logger "this is a test message"
logger -p local0.info -t testtag "this is a test message"
 
Khi hệ thống hiển thị thông tin đúng theo mẫu kiểm tra thì có nghĩa là toàn bộ quá trình cài đặt và cấu hình trên đã thành công. Chúc các bạn thành công!
Theo quản trị mạng
More about

Tiện ích Recent Posts Today và Recent Posts Yesterday

Người đăng: ngaybennhau on Thứ Sáu, 18 tháng 2, 2011

Theo yêu cầu của bạn Blogphantich.com về tiện ích Posts Today và Posts Yesterday giống trang http://www.calculatedriskblog.com//. Tôi “ngâm cứu” và viết bài này để hướng dẫn tạo tiện ích gọi là Bài viết mới nhất hôm nay và hôm qua (Recent Posts Today - Recent Posts Yesterday). Script từ tiện ích này được tùy biến từ tiện ích Bài viết mới nhất dạng cơ bản mà chúng ta biết.

Bạn có thể xem Demo dưới đây.


Recent Posts Today



Recent Posts Yesterday



Để cài đặt tiện ích này, bạn hãy thực hiện như sau.

Đăng nhập Blogger, vào Design >> Page Elements. Trên phần sidebar thêm một tiện ích HTML/Javascript rồi đặt toàn bộ đoạn code dưới đây vào phần nội dung của tiện ích và bỏ trống tiêu đề tiện ích.

<script type="text/javascript">
//<![CDATA[
function show2dayrecentposts(json) {

var entry0 = json.feed.entry[0];
var postdate0 = entry0.published.$t;
var cdyear0 = postdate0.substring(0,4);
var cdmonth0 = postdate0.substring(5,7);
var cdday0 = postdate0.substring(8,10);
var cdhour0 = postdate0.substring(11,13);
var cdmin0 = postdate0.substring(14,16);

var poststoday = 1;
var postsyesterday = 0;
for (var j = 1; j < 24; j++) {
var entry1 = json.feed.entry[j];
var postdate1 = entry1.published.$t;
var cdday1 = postdate1.substring(8,10);
if (cdday0 == cdday1) {
poststoday++;
}
else {
if (postsyesterday == 0) var cdday2 = cdday1;
if (cdday1 == cdday2) {
postsyesterday++;
}
}
}
if (showposttoday == true) {
var numend = poststoday;
var numposts = poststoday;
}
else {
var numend = poststoday + postsyesterday;
var numposts = postsyesterday;
}

document.write('<ul>');
for (var l = 0; l < numposts; l++) {
var i = numend - l - 1;
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;

var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}
posttitle = posttitle.link(posturl);
var readmorelink = "(more)";
readmorelink = readmorelink.link(posturl);
var postdate = entry.published.$t;
var cdyear = postdate.substring(0,4);
var cdmonth = postdate.substring(5,7);
var cdday = postdate.substring(8,10);
var cdhour = postdate.substring(11,13);
var cdmin = postdate.substring(14,16);
var cdampm = "AM";


var _mTime = parseInt(cdhour,10);

if (_mTime > 11) {
cdampm = "PM";
}
if (_mTime > 12) {
_mTime = _mTime - 12;
}

var _hr = _mTime.toString().substr(0, 2);

var postbold = 0;
var pll = '';
if ("category" in entry) {
for (var k = 0; k < entry.category.length; k++) {
pll = entry.category[k].term;
if (pll == 'mark') postbold = 1;
}
}

document.write('<li>');

if (postbold == 1) document.write('<font color="red" size="+2"><b>*</b></font>');
document.write(' at ' + _hr + ':' + cdmin + ' ' + cdampm + ' ');

document.write(posttitle);

document.write('</li>');
}
document.write('</ul>');

}
//]]>
</script>

<div class="today-rcposts">
<h2><span style="color:blue;font-size:14px;font-weight:bold">Recent Posts Today</span></h2>
<script type="text/javascript">
var showposttoday = true;
</script>
<script src="http://huynh-nhat-ha.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=show2dayrecentposts"></script>
<div class="clear"></div>
<h2><span style="color:brown;font-size:14px;font-weight:bold">Recent Posts Yesterday</span></h2>
<script type="text/javascript">
var showposttoday = false;
</script>
<script src="http://huynh-nhat-ha.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=show2dayrecentposts"></script>
</div>

Bạn cần thay huynh-nhat-ha bằng tên blogspot của bạn. Những phần được đánh dấu màu đỏ là phần bạn có thể tùy chỉnh được theo ý thích.

Nếu bạn muốn tiện ích chia thành hai cột, với phần bài viết mới nhất hôm nay nằm bên trái thì thay phần code nằm giữa 2 thẻ <div class="today-rcposts">, </div> bằng đoạn code dưới đây.

<table border=1 bgcolor=#f1f5f6 width=100%><th align="center" width=50%>Posts Today</th><th align="center">Posts Yesterday</th><tr><td>
<script type="text/javascript">
var showposttoday = true;
</script>
<script src="http://huynh-nhat-ha.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=show2dayrecentposts"></script></td><td>
<script type="text/javascript">
var showposttoday = false;
</script>
<script src="http://huynh-nhat-ha.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=show2dayrecentposts"></script></td></tr></table>

Chúc bạn thành công. :44)
More about

Tạo nút Back to Top siêu đơn giản

Người đăng: ngaybennhau on Thứ Năm, 17 tháng 2, 2011

Để tạo nút Back to Top ở cuối blogspot, thông thường các blogger sử dụng đến javascript hoặc jQuery. Tuy nhiên nếu dùng script thì ít nhiều cũng ảnh hưởng đến tốc độ tải trang cho blogspot. Tôi xin giới thiệu một cách rất đơn giản mà không hề sử dụng đến script.

Đăng nhập Blogger, vào Design >> Edit HTML. Tìm đến đoạn code nói đến phần bản quyền blog, thường nằm sau thẻ <div id='footer-wrapper'>. Bạn chỉ cần đặt đoạn code dưới đây vào sau thẻ nói trên.

<p style='float:right;'><a href='#top' title="Back to top">&#8657;</a></p>

Lưu Template là OK. Nếu trong Template của bạn có id header (thử tìm xem trong Template có dòng #header hay không) thì có thể thay #top bằng #header.
More about

AVG PC TuneUp 2011

Người đăng: ngaybennhau on Thứ Ba, 15 tháng 2, 2011


You already know how AVG can protect you online. Now we take that expertise one step further by fixing problems that slow you down. AVG PC Tuneup is your one-stop shop to help you get the most out of your PC. AVG PC Tuneup is designed in order to provide you with all the necessary tools for keeping your system in top-notch shape.


Key features of "AVG PC Tuneup 2011":

Disk Cleaner:
· Removes junk files slowing down your computer

Disk Defrag:
· Defragments disk drives and optimizes system files placement

Registry Cleaner:
· Repairs thousands of registry errors to increase PC stability

Registry Defrag:
· Compacts the registry eliminating memory-consuming gaps

Disk Doctor:
· Finds bad sectors, lost clusters and directory errors and fixes them

Internet Optimizer:
· Tailors the one-size-fits-all settings to your specific Internet connection

Track Eraser:
· Removes the history of your computer and Internet usage

Disk Wipe:
· Wipes free space on disks to prevent the recovery of sensitive data

File Shredder:
· Erases selected files beyond recovery on a disk or USB stick

File Recovery:
· Recovers accidentally deleted files from disks, USB sticks or cameras

Duplicate File Finder:
· Helps to find and remove duplicate files that waste disk space

Services Manager:
· Disables unnecessary services slowing down your computer

Startup Manager:
· Allows to manage programs that start automatically on Windows boot

Uninstall Manager:
· Completely uninstalls the software programs that you
· no longer need

Tweak Manager:
· Allows to tune hundreds of Windows settings to increase your PC speed

Task Manager:
· Lists all running processes, services and locked files

Disk Explorer:
· Shows which files take up the most space on your computer

System Information:
· Provides detailed information about your hardware and software.








More about