Sunday, January 29, 2017

Performance testing of hard disks

# mount /dev/xvdf /mnt/volume/

To perform block-level write:

# dd if=/dev/zero of=/mnt/volume/tempfile bs=1M count=1024 conv=fdatasync,notrunc

To flush caches:

echo 3 | sudo tee /proc/sys/vm/drop_caches

To perform block-level read:

# dd if=/mnt/volume/tempfile of=/dev/null bs=1M count=1024

Wednesday, January 18, 2017

比 Packet Tracer 更貼近現實!免費 GNS3 自建模擬網絡環境測試平台

比 Packet Tracer 更貼近現實!免費 GNS3 自建模擬網絡環境測試平台

若您是網路初學者或是資深的網路工程師,相信不時都要進行各項相關的實驗。此時大家第一時間在腦海中想起的應該都是由 Cisco 自家出品的 Packet Tracer 網路環境模擬器。其可以為用家提供真實的網路模擬功能,如:建立網路拓撲圖、網路封包拆解和實時網路觀察等。雖然 Packet Tracer 看起來優點甚多,但優點背後隱藏着三大缺點。

其一,它並不是免費軟件,只提供給自家網路學院的師生及註冊學校的用戶;其二,不支援部分設備的完整指令集,用起來會帶來一些不便;其三,Packet Tracer 只能與軟件內的模擬電腦及模擬伺服器連接,能提供的功能有限。雖則 Cisco 研發了一個全新網路環境模擬器-VIRL 以解決以上問題,但格價不算親民,令一般初學者為之卻步。

而這次要為大家介紹的是一款名為 Graphical Network Simulator-3 ( 下稱 GNS3 ) 的多平台網路環境模擬器,其可以在 Windows、Linux 及 OS X 等操作系統上運行。加上 GNS3 可以無縫連接 VMware Workstation 及 Oracle VirtualBox 等虛擬機程式,為用家提供更豐富和更貼近現實世界的網路環境。

在稍後時間將為大家詳細說明和進行測試。最重要的是 GNS3 是開放源碼的軟件,可以在其官方網站或 GitHub 頁面上免費下載,用家更可自行改寫其源始碼,定製一個合乎自己需求的版本。以上特色吸引了不少國際公司與機構應用使 GNS3,例如:Walmart、AT&T 及 NASA。

GNS3 的主要部件大約可分為 Dynamips、Dynagen 及 WinPCAP

Dynamips 是 Cisco 設備的模擬器,由 Christophe Fillot 於 2005 年研發。其可以模擬 1700、2600、3600 及 7200 等多個系列的 Cisco 設備,為用家提供一個操作簡單,但功能強大的網路測試和學習環境。Dynamips 也可以說是 GNS3 的核心部分,GNS3 簡單來說是基於它的一個使用者介面 ( GUI ),相對原始的 Dynamips,GN3 為初學者提供可視化的平台,一個具較佳操成性的媒介。

Dynagen 則是一個虛擬網路環境配置生成器。其可以分配路由器的端口配置,生成網路拓撲圖的設定文件等。

對網路工程師來說,一定不會對 WinPCAP 感到陌生。WinPCAP 是免費且強大的網路編程函數庫,為應用程式提供操作網路底層的能力,方便程式編寫員進行網路程式開發,如網絡封包分折、網路掃描、網路監控及網路入侵檢測系統等等。WinPCAP 也為 GNS3 提供即時網絡封包拆解和分折功能等。

Reference:

http://www.hkitblog.com/?p=37641

Wednesday, January 11, 2017

Install Git from the source code

Install Git from the source code

# apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

# wget https://github.com/git/git/archive/v2.11.0.tar.gz

# tar -zxf v2.11.0.tar.gz

# cd git-2.11.0

# make prefix=/usr/local all

# make prefix=/usr/local install

Friday, January 6, 2017

How to group by date in different time zone when it's in UTC

SELECT ... FROM ... GROUP BY DATE(CONVERT_TZ(start_dt,'UTC','America/Vancouver'))

Note that you need to load the timezone data into MySQL before this will work.

Apart from Windows environment, You can set Time Zone by

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

In Windows environment,

1. download Time zone description tables from http://dev.mysql.com/downloads/timezones.html

2. Stop MySQL server

3. Put then inside Mysql installation package (ie. C:\Program Files\MySQL\data\mysql)`

4. Start MySQL server

..Your work is finished..

If still you are getting NULL for CONVERT_TZ Download these database tables and insert it into mysql database http://www.4shared.com/folder/Toba2qu-/Mysql_timezone.html

Reference:

http://stackoverflow.com/questions/28015068/how-to-group-by-date-accounting-for-timezones-and-dst

http://stackoverflow.com/questions/14454304/convert-tz-returns-null/14454465#14454465

http://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html

Exception thrown: 'System.ArgumentNullException' in mscorlib.dll

Exception thrown: 'System.ArgumentNullException' in mscorlib.dll

Debug > Windows > Exception Settings > check "Common Language Runtime Exceptions" checkbox

Tools -> Options -> Debugging -> Symbols -> Server -> Yes

Reference:

http://stackoverflow.com/questions/16237475/a-first-chance-exception-of-type-system-argumentnullexception-occurred-in-msco

http://stackoverflow.com/questions/4813975/why-is-visual-studio-2010-not-able-to-find-open-pdb-files