2014年9月17日 星期三

Install VBox Guest Additions

The steps to install Guest Additions for Virtual Box.

1. Start you Linux.
2. Select 'Devices' on V-Box menu.
3. Select 'Insert Guest Additions CD Image'
4. Open Terminal appilcation.
5. Execute cd /media/VBOXADDITIONS_4.3.10.93012
6. Execute sudo sh VBoxLinuxAdditions.run

Done.

* If you got error message in step 3 'Unable to mount the CD/DVD image C:\#######\VBoxGuestAdditions.iso on the machine Ubuntu-##.##. Would you like to force mounting of thins medium?'
   Please select 'Device->CD/DVD Devices->Remove disc from virtual drive' and try again.


2014年7月31日 星期四

[GCC] error : Sleep was not declared in this scope

Situation:
I got error message when I compiling my c++ code with sleep(1); inline.
"error : Sleep was not declared in this scope"


Solution:
The solution is add folling including message in the head of your code.
#include <unistd.h>


Reference:
http://stackoverflow.com/questions/10976176/c-error-sleep-was-not-declared-in-this-scope

2014年5月27日 星期二

[Linux] Check linux kernel is 32 bit or 64 bit

Problem:

How to check linux kernel is 32 bit or 64 bit



Command:
Input following command in terminal.

uname -m
OR
file /bin/bash


Example:
allen@www ~/work$ file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

allen@www ~/work$ uname -m
x86_64


Reference:
http://www.linuxquestions.org/questions/linux-general-1/how-to-check-linux-kernel-is-32-bit-or-64-bit-612352/
http://blog.longwin.com.tw/2011/01/linux-check-32-64-bits-2011/

2014年3月28日 星期五

[Linux] Disk quota exceeded

Problem:
I got following message when I am trying to remove some files.

$ rm cmakeconfig.h

rm: cannot remove `cmakeconfig.h': Disk quota exceeded

Solution:
We could use command 'wipe' to delete some file for more disk space and execute rm later on.

$ wipe CMakeCache.txt

Wipe CMakeCache.txt

delete CMakeCache.txt

done


2014年3月21日 星期五

Find string and files on linux

To find files at linux bash command.

$ find [path] -name 'filename'


To find string in files at linux bash command.

$ find [path] | xargs grep 'string'



2014年3月1日 星期六

[Webkit] Debug QtWebkit with Visual Studio 2010.

1. Install Tools

  • Install Visual Studio 2010
  • Install VS2010 SP1.  (http://www.microsoft.com/zh-tw/download/confirmation.aspx?id=23691)


2. Get qt source code
Doload qt 4.8.5 from following address.
http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.zip

Decompress qt source code at D:\qt-4.8.5


3. Add path
Add D:\qt-4.8.5\bin to the Path variable


4. Run Visual Studio 2005 Command Prompt
Execute following commands in the VS command prompt:
cd D:\qt-4.8.5

configure –opensource -confirm-license –no-qt3support –debug –webkit –platform win32-msvc2010
Wait few minutes.

Remove the illegal quote characters  and ” at line 327 in
D:\qt-4.8.5\src\3rdparty\webkit\Source\WebCore\platform\DefaultLocalizationStrategy.cpp if VC stops compiling this file.

Execute following command in the VS command prompt:
nmake

5. Debug Webkit
Use VC 2010 to open and build D:\qt-4.8.5\src\3rdparty\webkit\Source\Webkit.sln
Set QtWebkit as start project.
Right click on QtWebkit project -> Properties -> Configuration Properties -> Debugging -> Set Command as C:\qt-4.8.5\examples\webkit\fancybrowser\debug\fancybrowser.exe
Start Debugging. (F5)


My operating system is Windows 7 (64bits).

2014年2月28日 星期五

[Visual Studio] The Breakpoint will not be hit. No Symbols have been loaded for this document.

Situation:

Break point is invalid and I got message below if mouse over it.
The Breakpoint will not be hit. No Symbols have been loaded for this document.


Solution:
Right click on project -> properties -> Configuration Properties -> C++ -> General -> Debug Information Format
Set to Program Database for Edit And Continue (/ZI)


Reference:
http://stackoverflow.com/questions/8341686/visual-studio-no-symbols-have-been-loaded-for-this-document



2014年2月27日 星期四

[Webkit] error C2001: newline in constant

Error Message:

platform\DefaultLocalizationStrategy.cpp(327) : error C2001: newline in constant

platform\DefaultLocalizationStrategy.cpp(327) : fatal error C1057: unexpected en
d of file in macro expansion
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
l.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\n
make.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.



Solution:

Edit DefaultLocalizationStrategy.cpp
Look at line 327.
return WEB_UI_STRING("Look Up <selection>", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
Chang to
return WEB_UI_STRING("Look Up <selection>", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));




2014年2月22日 星期六

[GIT] git out of memory.

Error Message:
fatal: Out of memory, malloc failed (tried to allocate xxxxxxxxxxx bytes)


Solution:
Type following command in git bash.
git config --global pack.windowMemory 256m


Reference:
https://github.com/hbons/SparkleShare/issues/519
http://stackoverflow.com/questions/10292903/git-on-windows-out-of-memory-malloc-failed


2014年1月29日 星期三

Tar tool brief manual.

Tar
tar is a tool for file compression on Linux, you can compress files into other format , like gzip (.tar.gz), bzip2 (.tar.bz2) and so on.

Compress Format
tar [cvfz] [tar ball file] [the files or directory are compressed in]

c          Create a tar ball
f          Specify tar ball file name
v          Show the processing verbose.
z          Compress to gzip format.

Example
tar zcvf etc.tar.gz /etc/*

Decompress Format
tar [-xvfz] [tar ball file] [target directory for decompressing out]

x             Decompress tar ball
f             Specify tar ball file name
v             Show the processing verbose.
z             Decompress for gzip format.(.gz)

Example
tar zxvf etc.tar.gz /home/