發表文章

Synology 群暉 NAS 2.5G 10G 多網卡 橋接

圖片
1. 控制台→網路→網路介面→管理→Open vSwitch設定→啟動Open vSwitch(把這個選項打勾)→確定 2. 透過SSH連線,輸入"ovs-vsctl show",會顯示目前網卡橋接狀態,第一個網卡為eth0 第二為eth1 以此類推。 3. 確定要橋接的網卡編號,輸入"ovs-vsctl del-br ovs_eth1"(eth後的數字自行更改),將網卡從預設橋接器中移除。 4. 輸入 "ovs-vsctl add-port ovs_eth0 eth1",將網卡橋接到某虛擬橋接器。 範例 ovs-vsctl del-br ovs_eth1 //刪除ovs_eth1橋接器 ovs-vsctl del-br ovs_eth2 //刪除ovs_eth12接器 ovs-vsctl add-port ovs_eth0 eth1 // 將eth1橋接到 ovs_eth0 ovs-vsctl add-port ovs_eth0 eth2 // 將eth2橋接到 ovs_eth0 ovs-vsctl show // 顯示橋接狀態 5. 只要關機或重新開機後Open vSwitch設定會消失,如需啟動後自動設定,可以將指令加入倒任務排程表。 控制台→任務排程表→新增→觸發任務→使用者定義指令碼 使用者帳號選root 事件選開機 任務設定→使用者定義指令碼→填入要執行的Open vSwitch指令 可以把"透過電子郵件寄送執行結果"打勾,就可以看到執行結果

UVA 11321 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNextInt()) { int num = sc.nextInt(); int m = sc.nextInt(); System.out.printf("%d %d\r\n", num, m); if(num == 0&& m == 0) break; Data[] datas = new Data[num]; for(int i = 0; i < num; i++) { int n = sc.nextInt(); datas[i] = new Data(n, n % m, n % 2 == 0); } Arrays.sort(datas); for(int i = 0; i < num; i++) { System.out.println(datas[i].toString()); } } } public static class Data implements Comparable { int n; int r; boolean even; Data(int n, int r, boolean even) { this.n = n; this.r = r; this.even = even; } public String toString() { return Integer.toString(this.n); } @Override public int compareTo(Data other) { if(this.r != other.r) return this.r < other.r ? -1 : 1

UVA 118 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int w = sc.nextInt(), h = sc.nextInt(); boolean drop_loc[][] = new boolean[51][51]; while(sc.hasNext()) { int x = sc.nextInt(), y = sc.nextInt(); char ori = sc.next().charAt(0); String cmd = sc.next(); boolean drop = false; for(int i = 0; i < cmd.length(); i++) { char c = cmd.charAt(i); int tempx = x; int tempy = y; if(c == 'L') { if(ori == 'N') ori = 'W'; else if(ori == 'E') ori = 'N'; else if(ori == 'S') ori = 'E'; else if(ori == 'W') ori = 'S'; } else if(c == 'R') { if(ori == 'N') ori = 'E'; else if(ori == 'E') ori = 'S'; else i

UVA 10415 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int cases = sc.nextInt(); for(int t = 0; t < cases; t++) { String finger[] = {"c0111001111", "d0111001110", "e0111001100", "f0111001000", "g0111000000", "a0110000000", "b0100000000", "C0010000000", "D1111001110", "E1111001100", "F1111001000", "G1111000000", "A1110000000", "B1100000000"}; String current = "00000000000"; String cmd = sc.next(); int[] count = new int[10]; for(int index = 0; index < cmd.length(); index++) { char c = cmd.charAt(index); for(int i = 0; i < 14; i++) { if(finger[i].charAt(0) == c) { String temp = finger[i]; for(int j = 1; j < 11; j++) { if(current.charAt(j)

UVA 10409 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNextInt()) { int num = sc.nextInt(); if(num == 0) break; int top = 1, n = 2, w = 3, s = 5, e = 4; for(int i = 0; i < num; i++) { String cmd = sc.next(); if(cmd.equals("north")) { n = top; top = s; s = 7 - n; } else if(cmd.equals("east")) { e = top; top = w; w = 7 - e; } else if(cmd.equals("south")) { s = top; top = n; n = 7 - s; } else if(cmd.equals("west")) { w = top; top = e; e = 7 - w; } } System.out.println(top); } } };

UVA 10189 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t = 0, h = 0, w =0; while(sc.hasNextInt()) { h = sc.nextInt(); w = sc.nextInt(); if(h == 0 || w == 0) break; if(t != 0) System.out.println(); System.out.printf("Field #%d:\r\n", ++t); char[][] map = new char[h][w]; for(int i = 0; i < h; i++) { String str = sc.next(); for(int j = 0; j < w; j++) map[i][j] = str.charAt(j); } for(int i = 0; i < h; i++) { for(int j = 0; j < w; j++) { int count = 0; if(map[i][j] == '*') System.out.print("*"); else { if( i - 1 >= 0 && map[i - 1][j] == '*') count++; if( i + 1 < h && map[i + 1][j] == '*') count++; if( j - 1 >= 0 &&

UVA 10057 Java

import java.util.*; import static java.lang.System.*; public class main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNextInt()) { int n = sc.nextInt(); int[] datas = new int[n]; for(int i = 0; i < n; i++) datas[i] = sc.nextInt(); Arrays.sort(datas); int mid = datas[(n - 1) / 2]; int mid2 = datas[n / 2]; int count = 0; for(int i = 0; i < n; i++) if(datas[i] == mid || datas[i] == mid2) count++; System.out.printf("%d %d %d\r\n", mid, count, mid2 - mid + 1); } } };