2013年12月30日 星期一

x11

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'

2013年12月26日 星期四

Visual Studio C++ 2003 在 Win7 上搜尋就當機的問題

Visual Studio .NET 2003 on Windows 7 hangs on search

個人推薦最簡單的方法
在下面的討論
You can do this by right clicking the shortcut to launch VS.NET 2003 and selecting properties, choosing the “Compatibility” sub-tab and then checking “Disable Desktop Compositing” as well as “Disable Visual Themes”

簡單講就是先單獨關閉 VC2003 的圖形主題,若真的不行再關閉 Aero 主題一定有效。

[Ubuntu] source: not found 的問題

我在 .sh 中寫:
source /home/myEnv

結果:
sh: 1: source: not found

解法:
在 .sh 中面加上指定使用的 Shell
#!/bin/bash

StackOverflow 上的討論是說:
The source command is built into some shells. If you have a script, it should specify what shell to use on the first line, such as:#!/bin/bash

[1] source command not found in sh shell

2013年12月25日 星期三

待整理 fork pipe dup2 execlp

fork()、pipe()、dup2() 和 execlp() 的組合技法
fred-zone.blogspot.tw/2010/05/forkpipedup2-execlp.html

GDB: breakpoint 出現 No Such File 的問題


有時使用遠端 Remote Debug 時,在下斷點時 GDB 會莫名出現 "No Such File" 的訊息,使得斷點一下在該檔案 GDB 就會提示一次,並且執行不到該檔案的路徑。

解決方法:
Debug Configurations → Source Tab → Add → Compilation Directory

指定到該找不到的檔案的目錄(或是 Project 目錄也行)


同場加映:

8 gdb tricks you should know

https://blogs.oracle.com/ksplice/entry/8_gdb_tricks_you_should

2013年12月23日 星期一

使用 boost::lexical_cast

在該篇討論中,最後提到,使用 Boost 的 lexical_cast 會有效率不彰的問題,除非真的必要(或是效率不重要),否則還是少用。


[1] 在文字和數字間轉換:boost::lexical_cast

2013年12月20日 星期五

When Ubuntu Mount Permission denied


[root@freescale component]# mount -o nolock 192.168.1.126:/home/MyShare /mnt/nfs/
mount: 192.168.1.126:/home/MyShare failed, reason given by server: Permission denied

root@susan-ubuntu:~# cd /etc
root@susan-ubuntu:/etc# gedit exports

/home/MyShare *(rw,sync,no_root_squash)
/home/Others *(rw,sync,no_root_squash)



restart nfs server
# sudo /etc/init.d/nfs-kernel-server start

check nfs server mount
# showmount -e localhost


1. Install
$ sudo apt-get install nfs-common
$ sudo apt-get install nfs-kernel-server

2. 設定 /etc/exports (For example: 將/mnt/iso share給all net使用)
$ sudo vi /etc/exports
/mnt/iso *(ro,sync)

3. 啟動 nfs server
$ sudo /etc/init.d/nfs-kernel-server start

FC6
重啟
/etc/init.d/nfs restart
檢查
exportfs
http://linux0101.blog.hexun.com.tw/8225946_d.html

4. 檢查
$ showmount -e localhost
成功的話應該可以看到這樣的訊息:
Export list for localhost:
/mnt/iso *


Ubuntu 架設nfs server

http://go-linux.blogspot.tw/2007/07/ubuntu-nfs-server.html

2013年12月11日 星期三

MTP 是什麼?

MTP 模式是微軟制訂的媒體傳輸協議(Media Transfer Protocol),透過 Windows Media Player 10 以上可以輕鬆管理影音檔案。

Android 4.1 開始使用這種方式來取代 USB 碟模式,基本上也不要擔心,因為兩者使用上幾乎沒有差別,同樣可以透過 USB 線來互傳檔案。

MTP 模式好處就是你可以同時在手機跟 PC 上存取手機上的檔案,記得以前手機接上 PC 後 (變成 USB 碟) 手機就不能執行某些 APP 了 (還能接電話啦!)

尤其是一些 APP 安裝在 SD 卡上的話。而且當手機脫離 PC 之後還要等一會兒,讓手機重新掃過內部儲存空間或室外插 SD 記憶卡之後才能正常運作

參考來源:
[1] 手機更新後出現 " 已啟用 MTP 模式 "

How do I check my Ubuntu version is 32-bit or 64-bit

How do I check my Ubuntu version is 32-bit or 64-bit?
uname -a
Result for 32-bit Ubuntu:
Linux discworld 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux
whereas the 64-bit Ubuntu will show:
Linux discworld 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

[1] How do I check if I have a 32-bit or a 64-bit OS?

Ubuntu 12.04 Install Firefox 20

In this article I will show you how to install the latest (stable) Firefox, Firefox 20, on your Ubuntu 13.04 Raring Ringtail, Ubuntu 12.10 Quantal Quetzal, Ubuntu 12.04 Precise Pangolin, Linux Mint 14 Nadia and Linux Mint 13 Maya.

Installing Firefox 20 on Ubuntu and Mint is quite easy. All you have to do is:
Add the Firefox repo:
$ sudo add-apt-repository ubuntu-mozilla-security/ppa


Update the system:
$ sudo apt-get update


Install Firefox:
 sudo apt-get install firefox


[1] to Install Firefox 20 in Ubuntu 13.04, Ubuntu 12.10, Ubuntu 12.04, Linux Mint 14 and Linux Mint 13 by PPA