2013年8月31日 星期六

mysql-if example sample eg e.g.

if statment


IF expression THEN commands 
[ELSEIF expression THEN commands] 
[ELSE commands] 
END IF; 


IF quantity_in_stock < 100 THEN 
INSERT INTO infologs(msg) 
VALUES (prd_code); 
END IF; 
FETCH cur_product INTO prd_code; 
UNTIL no_more_products = 1 
END REPEAT; 
CLOSE cur_product; 
SELECT * FROM infologs; 
DROP TABLE infologs; 
END$$ 
DELIMITER; 

mysql-procedure example sample eg e.g.


DELIMITER // 
CREATE PROCEDURE GetOfficeByCountry(IN countryName VARCHAR(255)) 
BEGIN 
SELECT city, phone 
FROM offices 
WHERE country = countryName; 
END // 
DELIMITER ;


CALL GetOfficeByCountry('USA') 
CALL GetOfficeByCountry(‘France’) 




/***********************************************************/
NO PARAMETER

DELIMITER $$
DROP PROCEDURE UPDATE_TEMP_SUMMARY_VIEW01 $$
CREATE PROCEDURE UPDATE_TEMP_SUMMARY_VIEW01()
BEGIN 
truncate table TEMP_SUMMARY_VIEW01; 
insert ignore into TEMP_SUMMARY_VIEW01 select * from SOINVPOSUMMARY;
END ;
$$

DELIMITER ; 

linux-lan

/etc/sysconfig/network-scripts
ifdown ifcfg-eth0
ifup
ifconfig
szexzdz



/etc/sysconfig/network[top] gateway
  • NETWORKING=yes
  • HOSTNAME=host.domainname.com ## set Host Name
  • GATEWAY=20.0.0.254 && SET THE ROUTER'S GATEWAY
/etc/sysctl.conf[top]
net.ipv4.ip_forward=1 && 0 for disable routner, default is 0
net.ipv4.tcp_syncookies = 1 && prevents the Linux machine from sync flood attacks
net.ipv4.icmp_echo_ignore_broadcasts = 1 && prevents attackers make use smurf attacks.
kernel.shmmax = 5000000
/etc/sysconfig/network-scripts/ifcfg-eth0[top]
  • DEVICE=eth0 &&eth0 it must match the file name , when second id, then the eth0, change to eth0:0
  • BOOTPROTO =dhcp ii(dhcp , none, dhcp or static)
  • HWADDR==00:12:34:56:78:90
  • ONBOOT=yes && when linux boot up
  • DHCP_HOSTNAME=servera.domain.com
  • SEARCH=
  • NM_CONTROLLED=
  • IPADDR=192.168.65.31 && iif(dhcp, 192.168.65.31, no this line)
  • NETMASK=255.255.255.0 && iif(dhcp, 255.255.255.0, no this line)
  • GATEWAY=192.168.65.254 && iif(dhcp, 192.168.65.3254, no this line)
Remark : The Second will call ifcfg-eth1

/etc/resolv.conf ## DNS Setting
echo "nameserver 202.14.67.4" >> /etc/resolv.conf




tcp-port

TCP port (Listen)Service  
    
20Ftp data  
21Ftp command  
22SSH  
23Telnet  
25SMTP  
37Time Protocol  
53DNS  
66Oracle Sql-net  
67DHCP  
80Http  
88Authentication  
110POP3  
119NNTP  
123NTPnetwork time protocol 
135epmapend point map for mc rpc locator 
137samba (nmbd) for net bios  
138samba  
139samba (smbd for printer share and file share)  
143IMAP  
389LDAPhttp://www.hkitn.com/article.php/4897AD Active Directory windows2003 firwall setting,
流覽當前正在使用 NetMeeting 2.0 的用戶名單
 
    
   
443https  
445samba, microsoft-dssmb protocol , directory share 
    
631cups  
636LDAPS  
873rsyncd  
993imaps  
995Pop 3 (ssh)  
1158oracle emhttp://localhost.localdomain:1158/em 
1154-1500Ip-Phone  
1521Oraclehttp://localhost.localdomain:1521/isqplus/dba 
1526Oracle Listen Port  
1720H323IP Phone 
1723VPN  
1863xp 一般連線,msm  
3128squid (proxy server)  
3306MySql  
3389
  • Terminal Service
  • xp 遠端協助
  
5100即時影音通訊  
5560Oracle isqplus
  • http://localhost.localdomain:5560/isqlplus
  • http://localhost.localdomain:5560/isqplus/dba
 
5631Anywhere  
6000 TCP guarantees delivery of data and also guarantees that packets will be delivered on port 6000 in the same order in which they were sent. Guaranteed communication over port 6000 is the key difference between TCP and UDP. UDP port 6000 would not have guaranteed communication in the same way as TCP.
...more,
 
6346foxy  
6501 udpxp   
6885-6889BT  
8080IPPhone Hutch...  
30000-31000IP-Phone  
6891-6900
  
7800-7825
 

abc class private-network private-lan

TCP ClassIp NetworkPrivate LANMust masksubnet 
A1-126
[00000001] [01111111]
10.0.0.0 /8255.0.0.0255.128.0.0 
B128-191
[10000001]
[10111111]
172.16.0.0 /16 to 172.31.0.0 /16255.255.0.0255.255.192.0 
C192-223
[11000000]
[11011111]
192.168.0.0 /24 to 192.168.255.0 /24255.255.255.0255.255.255.224 
D224-239Multi case   
E240-255Remain   
      
Class D is multicase purpose. Some software can
add a ip number on the lan Card for rec'd purpose. A lan can have more than 1 this number. 1 < many.

Subnet Mask option : 0,128,192,224,240,248,252,254,255, A subnet mask is used to idenify the network ID or the Host ID of an IP address.

sub-net-mask


subnet mask

A /24 network may be divided into the following subnets by increasing the subnet mask successively by one bit. This affects the total number of hosts that can be addressed in the /24 network (last column).
Prefix sizeNetwork maskAvailable
subnets
Usable hosts
per subnet
Total
usable hosts
/24255.255.255.01254254
/25255.255.255.1282126252
/26255.255.255.192462248
/27255.255.255.224830240
/28255.255.255.2401614224
/29255.255.255.248326192
/30255.255.255.252642128
/31255.255.255.2541282 *256

osi-7layer

osi7layer


1
Physical
2
Data-Link
3
Network
4
Transport
5
Session
6
Presen tation
7
Application
ExampleCables, AdaptersEthernet Lan, PPP, Token Ring, Frame Relay, Telephone Lines, ATMIPTCP, UDPNetBIOS
Check Point
open 1 IE connect
ASCIIFTP, SMTP, Telnet
AddressMACNetwork
ProtocolTransfer logical device to prhysical device protocol (DNS, NBP, X500)IPX,IP NWLINK, NetBeui, DECnet, XNS, DDP (datagram delivery Protocol : Apple talk)SPX,TCP,NWLink, ATP (Apple Talk Protocol)
NBP (Name binding Protocol)
Netbeui (not routable)
LAT (loca area trasnport , not routable)
NetBIOSAPPC - AS400 Advance Protoprog comm
FTAM OSI, File Transfer access Management,
X.400; x.500, SMTP, FTP, SNMP, Telnet, NCP (novell core protocol) , SMB (server manage Block), AFP (Apple Talk Filing Protocol) , DAP (Data access protocol) DEC (Apple Talke/ Apple Share)
HardwareHub, Switch, Bridge, Repeater
100M bit per second = 30 g Byte transfer per hour.
RouterGateway
OracleOracle Net
ARPARP
Netbeuinetbeui
*