Rsyslog 日志相關內容

[root@server vusers_home]# rpm -ql rsyslog|more ? ? ? ###.so結尾為模塊,模塊有分im為輸入模塊,om 為輸出模塊
/etc/logrotate.d/syslog
/etc/pki/rsyslog
/etc/rc.d/init.d/rsyslog
/etc/rsyslog.conf
/etc/rsyslog.d
/etc/sysconfig/rsyslog
/lib64/rsyslog
/lib64/rsyslog/imfile.so
/lib64/rsyslog/imklog.so
/lib64/rsyslog/immark.so
/lib64/rsyslog/impstats.so
/lib64/rsyslog/imptcp.so
/lib64/rsyslog/imtcp.so
/lib64/rsyslog/imudp.so
/lib64/rsyslog/imuxsock.so
/lib64/rsyslog/lmnet.so
/lib64/rsyslog/lmnetstrms.so
/lib64/rsyslog/lmnsd_ptcp.so
/lib64/rsyslog/lmregexp.so
/lib64/rsyslog/lmstrmsrv.so
/lib64/rsyslog/lmtcpclt.so
/lib64/rsyslog/lmtcpsrv.so
/lib64/rsyslog/lmzlibw.so
/lib64/rsyslog/ommail.so
/lib64/rsyslog/omprog.so
/lib64/rsyslog/omruleset.so
/lib64/rsyslog/omtesting.so
/lib64/rsyslog/omuxsock.so
/lib64/rsyslog/pmlastmsg.so
/sbin/rsyslogd

......

?

主程序:rsyslogd
配置文件:/etc/rsyslog.conf
服務腳本:/etc/rc.d/init.d/rsyslog
/var/log/dmesg #是用來記錄系統啟動日志的

?

rsyslog.conf(配置文件)
RULES:
facility.priority target
日志收集方:
facility:設施,從功能或程序上對日志進行分類;
auth, authpriv, cron, daemon, kern, lpr, mail, mark, news, security, user, uucp, local0-local7, syslog
priority
debug, info, notice, warn(warning), err(error), crit(critical), alert, emerg(panic)
示例:
*.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

指定級別:
*: 所有級別
none: 沒有級別
priority: 此級別及更高級別的日志信息
=priority:此級別

target:
文件路徑:記錄于指定的日志文件中,通常應該在/var/log目錄下;文件路徑前的“-”表示異步寫入;
用戶:將日志通知給指定用戶
*: 所有用戶
日志服務器:@host
host: 必須要監聽在tcp或udp協議514端口上提供服務;
管道: |COMMAND

?

測試實例:

ssh 服務單獨記錄一個日志文件:

[root@server vusers_home]# vim /etc/ssh/sshd_config?

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#SyslogFacility AUTHPRIV
SyslogFacility local2 ? ? ? ? ? ?#將原有的換成local2

[root@server vusers_home]# service sshd reload
Reloading sshd: [ OK ]
[root@server vusers_home]# vim /etc/rsyslog.conf

# Save boot messages also to boot.log
local7.* ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /var/log/boot.log
local2.* ?                  /var/log/sshd.log

[root@server vusers_home]# service rsyslog restart
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]

在另外一個端口重新登錄并查看日志:
[root@server vusers_home]# cat /var/log/sshd.log
May 18 16:04:50 server sshd[5290]: reverse mapping checking getaddrinfo for bogon [192.168.244.2] failed - POSSIBLE BREAK-IN ATTEMPT!
May 18 16:04:50 server sshd[5290]: Accepted password for root from 192.168.244.2 port 62797 ssh2
[root@server vusers_home]# cat /var/log/sshd.log
May 18 16:04:50 server sshd[5290]: reverse mapping checking getaddrinfo for bogon [192.168.244.2] failed - POSSIBLE BREAK-IN ATTEMPT!
May 18 16:04:50 server sshd[5290]: Accepted password for root from 192.168.244.2 port 62797 ssh2

?

文件記錄的日志的格式:
事件產生的日期時間 主機 進程(pid):事件內容

例:

May 18 16:02:27 server sshd[5239]: Server listening on :: port 22.

May 18 16:03:46 server kernel: Kernel logging (proc) stopped.

有些日志記錄二進制格式:/var/log/wtmp,/var/log/btmp
/var/log/wtmp: 當前系統上成功登錄的日志;
last

例子:

[root@server ~]# last
root pts/1 192.168.244.2 Thu May 18 16:04 still logged in
root pts/1 192.168.244.2 Thu May 18 16:04 - 16:04 (00:00)
root pts/0 192.168.244.2 Thu May 18 10:40 - 16:37 (05:56)
root pts/0 192.168.244.2 Wed May 17 11:43 - 10:39 (22:55)
root pts/1 192.168.244.2 Mon Jun 13 19:19 - 11:24 (337+16:05)
root pts/0 192.168.244.2 Mon Jun 13 18:57 - 11:24 (337+16:27)
root pts/1 192.168.244.2 Mon Jun 13 08:55 - 18:45 (09:50)
root pts/0 192.168.244.2 Mon Jun 13 03:59 - 10:45 (06:46)
reboot system boot 2.6.32-573.el6.x Mon Jun 13 03:58 - 16:37 (339+12:39)
root pts/1 192.168.244.2 Sun Jun 12 23:58 - down (03:59)
root pts/0 192.168.244.2 Sun Jun 12 23:39 - 01:52 (02:13)
root tty1 Sun Jun 12 23:28 - down (04:29)
reboot system boot 2.6.32-573.el6.x Sun Jun 12 23:27 - 03:57 (04:30)
root tty1 Sun Jun 12 23:26 - down (00:01)
reboot system boot 2.6.32-573.el6.x Sun Jun 12 23:25 - 23:27 (00:01)


/var/log/btmp:當前系統上失敗的登錄嘗試;
lastb

[root@server ~]# lastb
root ssh:notty 192.168.244.101 Thu May 18 16:33 - 16:33 (00:00)

lastlog命令:顯示當前系統每一個用戶最近一次的登錄時間;

例子:

[root@server ~]# lastlog
Username Port From Latest
root pts/0 192.168.244.2 Thu May 18 16:37:34 +0800 2017
bin **Never logged in**
daemon **Never logged in**

?

####日志服務器如何完成(也就是如何作為收集其他機器日志信息的日志服務器)#############

環境:日志服務器:192.168.244.100

? ? ? ? 被收集服務器:192.168.244.101

#要成為rsyslog只需打開監聽模塊即可

[root@192.168.244.100 ~]# vim /etc/rsyslog.conf ? #需要監聽514端口,用udp還是tcp可自選

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

[root@server ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 5407/rsyslogd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2785/mysqld
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 5112/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5239/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1389/master
tcp 0 0 :::514 :::* LISTEN 5407/rsyslogd
tcp 0 0 :::22 :::* LISTEN 5239/sshd
tcp 0 0 ::1:25 :::* LISTEN 1389/master
udp 0 0 0.0.0.0:514 0.0.0.0:* 5407/rsyslogd
udp 0 0 :::514 :::* 5407/rsyslogd

[root@192.168.244.101 ~]# vi /etc/rsyslog.conf

#*.info;mail.none;authpriv.none;cron.none ?/var/log/messages
*.info;mail.none;authpriv.none;cron.none ?@192.168.244.100 ? ?

[root@192.168.244.101 ~]# service rsyslog restart?

[root@192.168.244.101 ~]# yum install -y vsftpd?

在rsyslog服務器的/var/log/message上可以看到: ?

[root@192.168.244.100 ~]# tail -f /var/log/messages

May 18 05:19:29 localhost yum[5817]: Installed: vsftpd-3.0.2-21.el7.x86_64

注意點:如果有防火墻,需放行514端口

?

#####################如何讓rsyslog服務器將日志記錄到遠端mysql數據庫中#####################

環境:

mysql-server:192.168.244.101

rsyslog-server:192.168.244.100

[root@server ~]# ip addr|grep global
inet 192.168.244.100/24 brd 192.168.244.255 scope global eth0

?

[root@centos7 ~]# ip addr|grep inet|grep global
inet 192.168.244.101/24 brd 192.168.244.255 scope global eno16777736

?

?

[root@centos7 ~]# rpm -qa mariadb
mariadb-5.5.52-1.el7.x86_64

[root@centos7 ~]# ss -tnl|grep 3306
LISTEN 0 50 *:3306 *:*

[root@server src]# yum list all rsyslog* ? ?#查看相關包,最主要的需要rsyslog-mysql 這個程序包,連接mysql的驅動

rsyslog-mysql.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5.8.10-10.el6_6 ? ? ? ? ? ? ? ? ? ? ? ? ?base?

[root@server ~]# yum install -y rsyslog-mysql

[root@server ~]# rpm -ql rsyslog-mysql
/lib64/rsyslog/ommysql.so ? ? ? ? ? ? #模塊
/usr/share/doc/rsyslog-mysql-5.8.10
/usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql ? ?#mysql命令包,需要在mysql中運行

[root@centos7 ~]# mysql ? ? ? ?#登陸mysql-server 為sysloguser 這個用戶授權
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> grant all on Syslog.* to 'sysloguser'@'192.168.%.%' identified by 'syslogpass';

?

[root@centos7 ~]# vim /etc/my.cnf ?#增加如下兩行
[mysqld]

skip_name_resolve = on
innodb_file_per_table = on

[root@centos7 ~]# systemctl restart mariadb.service ?#重啟mysql-server

[root@server ~]# mysql -usysloguser -h192.168.244.101 -p ? ?#在rsyslog服務器連接測試mysql-server中新建的用戶可連接性
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

接下來導入下面的sql 包:

[root@server ~]# mysql -usysloguser -h192.168.244.101 -p < /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql ??

[root@server ~]# mysql -usysloguser -h192.168.244.101 -p ? ? #登陸mysql-server 查看操作是否成功,Syslog庫是否建立
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Syslog |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> use Syslog;
Database changed
mysql> show tables;
+------------------------+
| Tables_in_Syslog |
+------------------------+
| SystemEvents |
| SystemEventsProperties |
+------------------------+
2 rows in set (0.00 sec)

mysql> desc SystemEvents;
+--------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+------------------+------+-----+---------+----------------+
| ID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| CustomerID | bigint(20) | YES | | NULL | |
| ReceivedAt | datetime | YES | | NULL | |
| DeviceReportedTime | datetime | YES | | NULL | |
| Facility | smallint(6) | YES | | NULL | |
| Priority | smallint(6) | YES | | NULL | |
| FromHost | varchar(60) | YES | | NULL | |
| Message | text | YES | | NULL | |
| NTSeverity | int(11) | YES | | NULL | |
| Importance | int(11) | YES | | NULL | |
| EventSource | varchar(60) | YES | | NULL | |
| EventUser | varchar(60) | YES | | NULL | |
| EventCategory | int(11) | YES | | NULL | |
| EventID | int(11) | YES | | NULL | |
| EventBinaryData | text | YES | | NULL | |
| MaxAvailable | int(11) | YES | | NULL | |
| CurrUsage | int(11) | YES | | NULL | |
| MinUsage | int(11) | YES | | NULL | |
| MaxUsage | int(11) | YES | | NULL | |
| InfoUnitID | int(11) | YES | | NULL | |
| SysLogTag | varchar(60) | YES | | NULL | |
| EventLogType | varchar(60) | YES | | NULL | |
| GenericFileName | varchar(60) | YES | | NULL | |
| SystemID | int(11) | YES | | NULL | |
+--------------------+------------------+------+-----+---------+----------------+
24 rows in set (0.00 sec)

mysql> desc SystemEventsProperties;
+---------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+----------------+
| ID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| SystemEventID | int(11) | YES | | NULL | |
| ParamName | varchar(255) | YES | | NULL | |
| ParamValue | text | YES | | NULL | |
+---------------+------------------+------+-----+---------+----------------+
4 rows in set (0.01 sec)

mysql>

?

##################接下里配置rsyslog服務器能使用mysql###################

[root@server ~]# vim /etc/rsyslog.conf ? ? #編輯文件,在MODULES 里,增加一行

#### MODULES ####

$ModLoad ommysql

#### RULES ####

#*.info;mail.none;authpriv.none;cron.none ? ? ? ? ? ? ? ?/var/log/messages

*.info;mail.none;authpriv.none;cron.none ? ? ? ? ?:ommysql:192.168.244.101,Syslog,sysloguser,syslogpass

注釋::ommysql:192.168.244.101,Syslog,sysloguser,syslogpass ??

?輸出到mysql模塊:mysql地址,數據庫名,數據庫登陸名,數據庫登陸密碼

[root@server ~]# /etc/init.d/rsyslog restart ? ?#重啟rsyslog

[root@server ~]# yum install -y zile ??

[root@centos7 ~]# mysql ? ?#mysql-server #查看安裝zile是否有記錄

MariaDB [Syslog]> select count(*) from SystemEvents;

+----------+
| count(*) |
+----------+
| 4 |
+----------+
1 row in set (0.01 sec)

MariaDB [Syslog]> select count(*) from SystemEventsProperties;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)

MariaDB [Syslog]> select * from SystemEvents\G;
*************************** 1. row ***************************
ID: 1
CustomerID: NULL
ReceivedAt: 2017-05-18 18:25:57
DeviceReportedTime: 2017-05-18 18:25:57
Facility: 0
Priority: 6
FromHost: server
Message: imklog 5.8.10, log source = /proc/kmsg started.
NTSeverity: NULL
Importance: NULL
EventSource: NULL
EventUser: NULL
EventCategory: NULL
EventID: NULL
EventBinaryData: NULL
MaxAvailable: NULL
CurrUsage: NULL
MinUsage: NULL
MaxUsage: NULL
InfoUnitID: 1
SysLogTag: kernel:
EventLogType: NULL
GenericFileName: NULL
SystemID: NULL
*************************** 2. row ***************************
ID: 2
CustomerID: NULL
ReceivedAt: 2017-05-18 18:25:57
DeviceReportedTime: 2017-05-18 18:25:57
Facility: 5
Priority: 6
FromHost: server
Message: [origin software="rsyslogd" swVersion="5.8.10" x-pid="5626" x-info="http://www.rsyslog.com"] start
NTSeverity: NULL
Importance: NULL
EventSource: NULL
EventUser: NULL
EventCategory: NULL
EventID: NULL
EventBinaryData: NULL
MaxAvailable: NULL
CurrUsage: NULL
MinUsage: NULL
MaxUsage: NULL
InfoUnitID: 1
SysLogTag: rsyslogd:
EventLogType: NULL
GenericFileName: NULL
SystemID: NULL
*************************** 3. row ***************************
ID: 3
CustomerID: NULL
ReceivedAt: 2017-05-18 18:28:51
DeviceReportedTime: 2017-05-18 18:28:51
Facility: 1
Priority: 6
FromHost: server
Message: Installed: gc-7.1-12.el6_4.x86_64
NTSeverity: NULL
Importance: NULL
EventSource: NULL
EventUser: NULL
EventCategory: NULL
EventID: NULL
EventBinaryData: NULL
MaxAvailable: NULL
CurrUsage: NULL
MinUsage: NULL
MaxUsage: NULL
InfoUnitID: 1
SysLogTag: yum[5666]:
EventLogType: NULL
GenericFileName: NULL
SystemID: NULL
*************************** 4. row ***************************
ID: 4
CustomerID: NULL
ReceivedAt: 2017-05-18 18:28:51
DeviceReportedTime: 2017-05-18 18:28:51
Facility: 1
Priority: 6
FromHost: server
Message: Installed: zile-2.4.9-1.el6.x86_64
NTSeverity: NULL
Importance: NULL
EventSource: NULL
EventUser: NULL
EventCategory: NULL
EventID: NULL
EventBinaryData: NULL
MaxAvailable: NULL
CurrUsage: NULL
MinUsage: NULL
MaxUsage: NULL
InfoUnitID: 1
SysLogTag: yum[5666]:
EventLogType: NULL
GenericFileName: NULL
SystemID: NULL
4 rows in set (0.00 sec)

?

###################安裝loganalyzer##################

[root@server ~]# yum install -y httpd php php-mysql ?php-gd(后面數據統計,出圖形需要用到)


[root@server ~]# netstat -ant
tcp ? ? ? ?0 ? ? ?0 :::80 ? ? ? ? ? ? ? ? ? ? ? :::* ? ? ? ? ? ? ? ? ? ? ? ?LISTEN?

測試下php,與mysql的連通性:

[root@server ~]# cd /var/www/html/
You have new mail in /var/spool/mail/root
[root@server html]# ll
total 8
-rw-r--r-- 1 root root 329 May 18 18:45 index.php
-rw-r--r-- 1 root root 20 May 18 18:42 phpinfo.php
[root@server html]# cat phpinfo.php
<?php
phpinfo();
?>
[root@server html]# cat index.php
<?php
$conn = mysql_connect('192.168.244.101','sysloguser','syslogpass');
if ($conn)
echo "OK";
else
echo "Failure";

mysql_close();
?>

[root@server ~]# curl 192.168.244.100/index.php ? ? ?#可以連接上數據庫
OK
[root@server ~]# curl -I 192.168.244.100/phpinfo.php ? #訪問php頁面OK
HTTP/1.1 200 OK

################安裝LogAnalyzer#################

[root@server ~]# cd /usr/local/src/

[root@server src]# wget http://download.adiscon.com/loganalyzer/loganalyzer-3.6.5.tar.gz

[root@server src]# mv loganalyzer-3.6.5 /var/www/html/loganalyzer
[root@server src]# cd /var/www/html/loganalyzer/

[root@server ~]# cd /var/www/html/loganalyzer/contrib/

[root@server contrib]# cat configure.sh
#!/bin/sh

touch config.php
chmod 666 config.php
[root@server contrib]# chmod +x *.sh

[root@server contrib]# ./configure.sh ? ? ?#讓其生成config.php 文件

[root@server src]# chmod 666 config.php
[root@server src]# pwd
/var/www/html/loganalyzer/src
[root@server src]# ll config.php
-rw-rw-rw- 1 root root 0 May 19 15:02 config.php

然后去瀏覽器操作:

?

?

完成!!!!!!!!!!!!!!!!!!

?

?

大致總結下過程:

配置使用基于mysql存儲日志信息:
(1) 準備好MySQL服務器,創建用戶,授權對Syslog數據庫的全部訪問權限;
(2) 安裝rsyslog-mysql程序包;
(3) 創建rsyslog-mysql依賴的數據庫;
# mysql -uUSERNAME -hHOST -pPASSWORD < /usr/share/doc/rsyslog-mysql-VERSION/createDB.sql
(4) 配置rsyslog使用ommysql模塊
#### MODULES ####
$ModLoad ommysql

#### RULES ####
facility.priority :ommysql:DBHOST,DB,DBUSER,USERPASS

重啟rsyslog服務
(5) 安裝loganalyzer
(a) 配置webserver, 支持php
# yum install httpd php php-mysql php-gd
# service httpd start
(b) loganalyzer
# cp -r loganalyzer-3.6.5/src /var/www/html/loganalyzer
# cp loganalyzer-3.6.5/contrib/*.sh /var/www/html/loganalyzer
# cd /var/www/html/loganalyzer
# chmod +x *.sh
# ./configure.sh
# ./secure.sh
# chmod 666 config.php

?

?

?

?

?

?

?

?

?

?




?

轉載于:https://www.cnblogs.com/shanhua-fu/p/6873960.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/254567.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/254567.shtml
英文地址,請注明出處:http://en.pswp.cn/news/254567.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

MFC導出對話框類DLL的實現

1.新建基于對話框的應用程序 2.新建MFC DLL工程 3.選擇MFC DLL 4.選擇擴展Dll選項&#xff08;重要&#xff01;&#xff01;&#xff01;&#xff09; 5.為Dll工程添加一個MFC類&#xff0c;基類為CDialogEx 6.Dll新建的MFC 類中添加resource.h防止編譯出錯…

中國如何引進CMM評估,促進軟件產業發展

北京軟件行業協會 &#xff08;本文轉載自軟件工程專家網www.21cmm.com&#xff09; 一、CMM的含義及作用   CMM&#xff08;軟件能力成熟度模型&#xff1a;Capability Maturity Model For Software&#xff09;是由美國卡內基梅 隆大學的軟件工程研究所&#xff08;SEI&a…

關于游戲平衡性——王者榮耀英雄傷害數值參考

收集王者榮耀各個英雄的裝備對技能增加的百分比&#xff0c;這樣的主要目的為保證游戲的平衡性。對于技能主要包括&#xff1a;血量、物理攻擊、法術攻擊、物理穿透、法術穿透、暴擊等。關于各個裝備&#xff0c;已經列成一張excel表格&#xff0c;在這里不再詳細描述表格。在這…

Swift-setValuesForKeysWithDictionary

重寫 setValuesForKeysWithDictionary 那么字典中可以有的字段在類中沒有對應屬性 class Person : NSObject {var age :Int 0 // 重寫 setValuesForKeysWithDictionary 那么字典中可以有的字段在類中沒有對應屬性override func setValuesForKeysWithDictionary(keyedValues…

hdu 1269 迷宮城堡(trajan判環)

題目鏈接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1269 題意&#xff1a;略 題解&#xff1a;trajan模版直接求強連通分量。 #include <iostream> #include <cstring> #include <cstdio> using namespace std; const int N 1e4 10; const i…

Arithmetic圖像處理halcon算子持續更新

目錄abs_diff_imageabs_imageacos_imageadd_imageasin_imageatan2_imageatan_imagecos_imagediv_imageexp_imagegamma_imageinvert_imagelog_imagemax_imagemin_imagemult_imagepow_imagescale_imagesin_imagesqrt_imagesub_imagetan_imageabs_diff_image 功能&#xff1a;計算…

身于“亂世”,我們程序員應該如何打算?

今天看了這篇文章&#xff0c; 發現自己也有點生處亂世&#xff0c;不平之感&#xff0c;但是文章的樸實卻讓我有了一個良好的反省&#xff0c;特此轉載 分類&#xff1a; 項目管理 2011-09-04 00:58 770人閱讀 評論(12) 收藏 舉報 不僅要低頭拉車&#xff0c;還要抬頭看路。…

Activity的啟動流程

Activity的啟動流程 努力工作 自己平時工作接觸的frameworks代碼比較多&#xff0c;但真正理解的很有限&#xff0c;一直在努力分析。。我主要還是用補丁的形式來看 core/java/android/app/Activity.java | 6 core/java/android/app/ActivityManagerNative.jav…

es6--箭頭函數

基本用法 ES6允許使用“箭頭”&#xff08;>&#xff09;定義函數。 var f v > v; 上面的箭頭函數等同于&#xff1a; var f function(v) {return v; }; 如果箭頭函數不需要參數或需要多個參數&#xff0c;就使用一個圓括號代表參數部分。 var f () > 5; // 等同于…

halcon Bit圖位像素處理算子,持續更新

目錄bit_andbit_lshiftbit_maskbit_notbit_orbit_rshiftbit_slicebit_xorbit_and 功能&#xff1a;輸入圖像的所有像素的逐位與。 bit_lshift 功能&#xff1a;圖像的所有像素的左移。 bit_mask 功能&#xff1a;使用位掩碼的每個像素的邏輯與。 bit_not 功能&#xff1…

NYOJ題目839合并

--------------------------- AC代碼&#xff1a; 1 import java.util.Scanner;2 3 public class Main {4 5 public static void main(String[] args) {6 7 8 Scanner scnew Scanner(System.in);9 10 int timessc.nextInt(); 11 …

指針的魅力

序 指針說&#xff1a;love me&#xff0c;love me&#xff01; 但是他對指針說&#xff1a;I hate u&#xff0c;I hate u&#xff01; …… 指針僅僅是作為指針&#xff0c;我們可以把它當做有用的工具&#xff0c;為我們提供便利與好處。說起工具不得不讓我想起一樣東西—…

python多進程

2019獨角獸企業重金招聘Python工程師標準>>> python多進程 進程簡介 進程是程序在計算機上的一次執行活動。當你運行一個程序&#xff0c;你就啟動了一個進程。顯然&#xff0c;程序是死的(靜態的)&#xff0c;進程是活的(動態的)。進程可以分為系統進程和用戶進程。…

halcon彩色圖像顏色處理算子,持續更新

目錄apply_color_trans_lutcfa_to_rgbtrans_to_rgbclear_color_trans_lutcreate_color_trans_lutgen_principal_comp_translinear_trans_colorprincipal_comprgb1_to_grayrgb3_to_graytrans_from_rgbapply_color_trans_lut 功能&#xff1a;申請使用顏色查找表。 cfa_to_rgb …

奪命雷公狗---node.js---20之項目的構建在node+express+mongo的博客項目5mongodb在項目中實現添加數據...

我們上一步就引入了mongodb了&#xff0c;那么下一步就要開始寫添加數據了&#xff0c;不過有個前提是先將表單的數據處理好&#xff1a; 最基本的這部現在已經成功了&#xff0c;因為最基本的這步就是先將表單處的提交方式和提交地址給處理好&#xff0c;這里和PHP的基本上是一…

重新綁定ItemsSource先設置ItemsSource = null;的原因

即報錯信息為&#xff1a;在使用 ItemsSource 之前&#xff0c;項集合必須為空。原因&#xff1a;Items和ItemSource&#xff0c;只能有一個生效&#xff0c;想用其中一個&#xff0c;另一個必須是空。重新綁定ItemSource&#xff0c;雖然綁定的集合對象Clear了&#xff0c;但是…

敏捷開發學習

Scrum 敏捷開發&#xff0c;績效管理&#xff0c;團隊管理&#xff0c;企業管理&#xff0c;ASP.net MVC 敏捷開發 培訓|咨詢 工具開發 課題研討 http://blog.csdn.net/cheny_com/article/category/794542 http://blog.csdn.net/vincetest/article/category/650747 http://blog…

Git commit后,本地代碼丟失解決方法

問題描述&#xff1a; 提交代碼時&#xff0c;rebase了兩次&#xff0c;本地代碼丟失了&#xff0c;嚇得我差點跳起來。解決方法如下&#xff1a; 1、執行命令&#xff1a; git reflog d6ea731 (HEAD -> dev, origin/dev, master) HEAD{0}: checkout: moving from master to…

Edges圖像邊緣處理halcon算子,持續更新

目錄close_edgesclose_edges_lengthderivate_gaussdiff_of_gaussedges_coloredges_color_sub_pixedges_imageedges_sub_pixfrei_ampfrei_dirhighpass_imageinfo_edgeskirsch_ampkirsch_dirlaplacelaplace_of_gaussprewitt_ampprewitt_dirrobertsrobinson_amprobinson_dirsobel_…

Android存儲數據方式

可以查看Android開發文檔中的&#xff1a;/docs/guide/topics/data/data-storage.html Android provides several options for you to save persistent application data. The solution you choose depends on your specific needs, such as whether the data should be privat…