- 以前利用更改 /etc/fstab 或是利用工具 Paragon NTFS 來達成, 但在沒有購買軟體的情形下, 還是參考使用了 ntfs-3g
- 從癮科技的教學來看, 需使用 NTFS-3G+Fuse For OSX + fuse_wait, ...但我第一步下載安裝就一直給我顯示版本錯誤了, 後面提的
mount -t ntfs-3g /dev/disk2s5 /Volumes/mountPoint
我也失敗, 就先放棄這作法惹(我的理解, 安裝完應該要有/sbin/mount-ntfs03g
之類的才是...) - 以下是我嘗試後, 目前可用的作法
- 從 MacPort 安裝
sudo port install ntfs-3g
- 查詢要 mount的 ntfs disk並先 unmount, 最後 mount到 newMountPoint
diskutil list diskutil unmount /dev/disk2s5 sudo ntfg-3g /dev/disk2s5 /Volumes/newMountPoint
- Reference
2017年1月22日 星期日
[Mac] read & writer NTFS by ntfs-3g
2017年1月17日 星期二
[Toolchain] Autotools & CMake
- Autotools
- autoconf, automake, libtools
- Note: Mac OSX 自 XCode 4.3之後, 沒有內建這些 autotools了. 可以透過 port install autoconf automake
- Open source 三部曲
- ./configure
- 產生 Makefile 及 config.h (所以程式中盡量少用 config.h)
- make
- make install
- flowchart
- 利用 autoscan 建立 configure.ac (舊版 autotool叫做 configure.in)
autoscan mv configure.scan configure.ac
- 產生範本 configure.scan, 自行更名為 configure.ac供後面 autoconf使用. 同時會產生 autoscan.log (但成功的狀態似乎沒填任何東西, 要看過程反而是要用 autoscan --verbose來看)
- 從 verbose可以看到這個 autoscan做了些什麼事, 從掃描 source files開始, 會以目前執行的 directory 當作 srcdir, 分別掃描 cfiles, makefiles, shfiles, 以及瀏覽用到的 function, header, install 及相關變數 lists, 如下 samples (可自行以 open source project 驗證, 或如 reference裡用的 LilyTerm來練習)
autoscan: srcdir = . cfiles: src/console.c src/console.h src/data.h src/dialog.c src/dialog.h src/font.c src/font.h src/lilyterm.h src/main.c src/main.h src/menu.c src/menu.h src/misc.c src/misc.h src/notebook.c src/notebook.h src/pagename.c src/pagename.h src/profile.c src/profile.h src/property.c src/property.h src/window.c src/window.h makefiles: data/Makefile po/Makefile shfiles: src/unit_test.sh function: bzero: src/main.c:314 memset: src/menu.c:1995 src/menu.h:29
vi configure.ac
- configure.ac 基本上就是個 script, 只是裡面呼叫非常多 macros以利 m4 (GNU Marco Processor) 處理, e.g. AC_*( ), 其中 [ ] 為區隔字元, 以及 AC prefix代表 AutoConf 相關 marco; AM_*代表 AutoMake相關marco. 另外注意, macro名稱與左括號 ( 中間不要有空格, e.g. AC_PREREQ([2.69]) 而不是 AC_PREREQ ([2.69])
- #為註解
- 未更改
-
# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS]) AC_CONFIG_SRCDIR([src/console.c]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET # Checks for libraries. # Checks for header files. AC_PATH_X AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h string.h sys/socket.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T # Checks for library functions. AC_FUNC_FORK AC_CHECK_FUNCS([bzero memset setenv setlocale socket strcasecmp strstr]) AC_CONFIG_FILES([data/Makefile po/Makefile]) AC_OUTPUT
- 利用 Autotools來建立 Makefile檔案
- Porting UNIX/Linux Applications to OS X
- A tutorial for porting to autoconf & automake
- front-end of make
- CTest
- 目的: 簡化 compile, install linux software to Mac. 可想成 apt-get, 即為 command line based package management
- 操作: port install, port search, port contents
- 通常會放在 /opt/local 底下
- 亦可透過 pkg-config --cflags port, 找到需要的 installed port header與 library
2017年1月15日 星期日
[Blog] 在 blog 中張貼程式碼
- 原理:
- 以 HTML的 pre tag來實作, 如 HTML裡的 <img> 表示圖片、<h1>表示等級1的header等等, pre表示的是 pre-formatted text, 會以定寬字型以及保留空格與換行的方式來處理。
- 設計特別的 class 來指定這些程式碼, 如 Google 的 prettyprint
- 設計 CSS 來 highlight畫面
- 利用 javascript 來做是否為keyword等字的判斷, 來highlight特別的字 (每個語言都有自己的 keywords, 如: class、printf 等等, 這些 keywords因語言不同而不同, 所以應該也要有對不同語言提供不同 keywords highlight的功能)
- 方法:
- 載入上面提到的 CSS (以blog-替程式碼上色提供的 sample為例)與 Javascript (以 Google Code Prettify 為例)
- 在 Blogger中, 新增 HTML/Javascript 小工具
- 在自己的程式碼中輸入程式碼區塊
- 指定為 pre block, 並指定 class 與特定 config (例如特別的語言: lang-*, support list, 或是顯示行號的 linenum)
<pre class="prettyprint lang-cpp linenums">code snippet</pre>
- 需要注意的是, 這邊的 code snippet要經過處理, 也就是有經過 escape符號預處理, 簡單來說, 通常任何程式語言都會有 escape characters, 簡單就是用以告知 compiler/interpreter, 你就是要用該符號, 例如: printf的語法是 printf("what you want to print"), 但你就是要 print 引號 (")的時候怎麼辦咧? 就是加入 escape character (\), 而在 HTML則是輸入 < > 等等, 不過也有網頁服務直接幫你轉換 => HTMLEscape .net
- 另外, 也有很多類似的相關 js 可以套用, 如 SyntaxHighlighter
<style type='text/css'>
.pre-highborder{
border: 1px solid #ff0000;
padding: 3px 3px 3px 0;
}
pre.prettyprint, code.prettyprint {
border-radius: 8px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
padding: 5px;
overflow: auto;
background-color: #eee !important;
color: black;
box-shadow: 0 0 5px #999;
-moz-box-shadow: 0 0 5px #999;
-webkit-box-shadow: 0 0 5px #999;
}
/*font*/
pre span, code span {
font-family: 'Consolas', 'Courier New', 'Microsoft JhengHei', sans-serif !important;
font-size: 12px !important;
}
/*each line*/
li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 {
margin: 0 !important;
padding: 2px 0 2px 4px !important;
list-style-type:decimal !important;
border-left: 1px solid #999;
}
/*even line*/
li.L1, li.L3, li.L5, li.L7, li.L9 {
background-color: #f6f6f6 !important;
}
/*odd line*/
li.L0, li.L2, li.L4, li.L6, li.L8 {
background-color: #FFF !important;
}
/*line-number background color*/
ol.linenums {
color: black;
background-color: #eee;
margin-left: 10px;
}
</style>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js">
</script>
- 當然也可直接使用網站服務
- Reference
2017年1月14日 星期六
[Codec] Video Codec 參考書目
覺得不錯的參考書目:
- H.264 and MPEG-4 Video Compression
- 雖然年代有點久, 但內容滿適合入門以及了解相關知識,包含簡述codec 發展歷史、codec 觀念 (Chapter Video Coding Concept - 包含 block diagram, e.g. DPCM/DCT video encoder/decoder架構)及 standard相關細節 (e.g. Chapter H.264/MPEG4 Part 10)
- Video Demystified
- 比較偏向訊號面來講解, e.g. 數位訊號(e.g. PAL, color space)、廣播制式(e.g. DVBC/ATSC)
- Next Generation Video Coding and Streaming
- 以 HEVC為主, 滿 spec. 導向, 另外在 container(e.g. mp4, ts), 以及 streaming 著墨較多
以上是目前覺得不錯的書目, 由於工作需要, 所以開始 K相關技術, 若有相關技術可以分享交流, 甚至一起來個讀書會. 都非常歡迎 feedback哦
2014年11月25日 星期二
[Git] .gitignore
# Mac OS X
.DS_Store
profile
# XCode
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
xcuserdata/
project.xcworkspace/
# Generated files
*.o
*.pyc
build/
DerivedData
*.hmap
*.ipa
*.moved-aside
.idea/
Pods
# Backup files
*.swp
*~
*.lock
*.out
# version control
*.xccheckout
2014年11月13日 星期四
[Computer Vision] Object Segmentation algorithms
- 影像分割概述 (called "object segmentation" or "pixel labeling")
- 演算法分類:
- threshold-based
- edge-based
- Sobel
- histogram-based
- region grow-based
- region grow
- dilation & erosion
- watershed
- graph theory-based(min-cut)
- graph cut
- grab cut
- random walk
- energy function-based
- active contour model
- parametric, geometric active contour model
- Kaas Snake
- optimization method
- Lagrange, Euler
- random field-based
- 分類方式參考:
2013年8月17日 星期六
[C++] 印 endl而非 '\n'
- 問題:
- C++中, 平常印訊息用 cout << endl 好, 還是 cout "\n" 好?
- 解法:
- 傾向使用 cout << endl, 原因是, IO的 buffer不會在程式 crash時自動清空 (flush), 也就是有可能一直在錯誤的地方 debug(在程式根本沒執行到的地方 debug, 因為誤以為印出的訊息是正確的), 但 endl中隱含了 flush buffer的動作, 因此可避免此一情形
2013年8月11日 星期日
[Qt] Qt Quick error in re-writing
- 問題:
- Qt 利用 Qt Design 設計 UI時, 有時在存檔時會遇到無法更新存檔, 甚至 Qt當掉的問題
- Qt Quick application在 Build時出現 module QtQuick 1.1 not installed
- 解法
- 基本上就是沒有安裝 QtQuick 1.1, 在 main.qml裡頭又 import多個 QtQuick modules造成的, 請檢查 .qml檔的 import設定即可
2013年8月10日 星期六
[CMake] Install command line fail
- 問題
- 在安裝 CMake command line tools可能會發生 "Failed create symlink installation may be incomplete" 的錯誤
- 原因
- 主要原因是之前安裝過其他版本的 CMake而造成的衝突
- 解法
- 自行 link吧!
- 在 /usr/bin中找到以下相關 binary
- ccmake
- cmake
- cmake-gui
- cmakexbuild
- cpack
- ctest
- 刪除其 link, 並建立新的link
- e.g. sudo ln -s /Applications/CMake\ 2.8-11.app/Contents/bin/cmake /usr/bin/cmake
[Development] Memory leak check -Valgrind
- 簡介
- 相信寫 C, C++的人應該不陌生, 該 new空間沒 new, 或是使用完沒 delete, 都會造成 memory的問題, 而 Valgrind便是一套 tool可以幫忙做 memory check
- 安裝
- 目前一般 linux已內建, Mac可藉由 MacPort安裝 (sudo port install valgrind)
- 使用
- 基本流程
- build時候開啓 debug, e.g. g++ -g -o program
- 用 valgrind執行: valgrind --leak-check=full --log-file=memProg.log ./program
- 解讀 log: vi memProg.log
- 官方一頁版快速上手: Valgrind Quick Start Quide
- 網友介紹: Valgrind Tutorial
- 完整 options: Valgrind User Manual
訂閱:
文章 (Atom)