智慧家庭與智慧家電這些年來大行其道,不過陸續都有隱私與資安的問題爆出來
將這些智慧家電跟主要設備(如電腦等)隔離開來,可以降低發生事故時影響的範圍
在網路方面做隔離常見的方法是訪客wifi。現在的無線分享器/無線路由器多數都有提供這個功能,讓智慧家電連上訪客wifi就能跟主要網路隔離了
不過筆者的無線路由器因為位置的關係wifi訊號沒有很好,因此本文將介紹另外一種方法 - 用vlan來隔離網路
智慧家庭與智慧家電這些年來大行其道,不過陸續都有隱私與資安的問題爆出來
將這些智慧家電跟主要設備(如電腦等)隔離開來,可以降低發生事故時影響的範圍
在網路方面做隔離常見的方法是訪客wifi。現在的無線分享器/無線路由器多數都有提供這個功能,讓智慧家電連上訪客wifi就能跟主要網路隔離了
不過筆者的無線路由器因為位置的關係wifi訊號沒有很好,因此本文將介紹另外一種方法 - 用vlan來隔離網路
在使用手機看網頁的時候最煩人的就是各種網頁廣告,尤其是痞X邦的廣告特別多,各種全螢幕覆蓋的擋住文章內容
這一切問題直到我遇到了AdGuard後都解決了。這是一款協助你移除各種惱人影響上網體驗的擋廣告app
不過前面說了這是手機app,只有手機才能使用。如果我想要讓家中的PC或是家中網路的任何一台上網裝置都能用到這功能怎麼做?
仔細看AdGuard的官網,它其實有一系列的產品包含AdGuard、AdGuard DNS、AdGuard TempMail等,並且其實功能也不只是擋廣告而已,它能透過封鎖DNS等一些技術來達成擋廣告、保護隱私、封鎖特定網域(例如封鎖詐騙網站、色情或賭博網站),因此家中有長輩或小朋友的人建議可以安裝起來多提供一層防護
public delegate int Calculator(int a, int b);
public class Operator
{
public static int Plus(int a, int b)
{
return a + b;
}
public static int Sub(int a, int b)
{
return a - b;
}
public static int Mul(int a, int b)
{
return a * b;
}
public static int Div(int a, int b)
{
return a / b;
}
}
public static void Main()
{
var calc = new Calculator(Operator.Plus);
Console.WriteLine(calc(3,5));
calc = new Calculator(Operator.Sub);
Console.WriteLine(calc(3,5));
}
public delegate int Calculator(int a, int b);
public static void Main()
{
Calculator calc = delegate(int a, int b)
{
return a+b;
};
Console.WriteLine(calc(3,5));
}
public delegate int Calculator(int a, int b);
public static void Main()
{
Calculator calc = (int a, int b) => { return a+b; };
Console.WriteLine(calc(3,5));
}
第4行的(int a, int b) => { return a+b; }; 即是lamdba expression。Calculator calc = (a, b) => { return a+b; };
Calculator calc = (a, b) => a+b;如此,是不是比匿名方法簡潔許多呢?
var list = new List{1,2,3,4,5}; var list2 = list.Where(x => x > 3);
public delegate int Comparator(int first, int second);這邊宣告名為Comparator的delegate類別,Comparator將會接受一種"參數是2個int並回傳1個int"的這種方法。
public void BubbleSort(int[] array, Comparator c)
{
for(var round=0; round < array.Length; round++)
{
for(var i=0; i<array.Length-1; i++)
{
if(c(array[i], array[i+1]) > 0)
{
var temp = array[i];
array[i] = array[i+1];
array[i+1] = temp;
}
}
}
}
在第7行時呼叫此Comparator所接收到的方法。public int SortByAsc(int first, int second)
{
if(first < second)
{
return -1;
}
else if(first > second)
{
return 1;
}
else
{
return 0;
}
}
public static void Main()
{
var array = new [] {4,7,1,6,9};
var sorter = new Sorter();
sorter.BubbleSort(array, sorter.SortByAsc);
foreach(var elem in array)
{
Console.WriteLine(elem);
}
}
using System.IO;
using System;
public delegate int Comparator(int first, int second);
public class Sorter
{
public static void Main()
{
var array = new int[] {4,7,1,6,9};
var sorter = new Sorter();
sorter.BubbleSort(array, sorter.SortByAsc);
foreach(var elem in array)
{
Console.WriteLine(elem);
}
}
public void BubbleSort(int[] array, Comparator c)
{
for(var round=0; round < array.Length; round++)
{
for(var i=0; i<array.Length-1; i++)
{
if(c(array[i], array[i+1]) > 0)
{
var temp = array[i];
array[i] = array[i+1];
array[i+1] = temp;
}
}
}
}
public int SortByAsc(int first, int second)
{
if(first < second)
{
return -1;
}
else if(first > second)
{
return 1;
}
else
{
return 0;
}
}
}