Monday, May 23, 2011

赵永夫开枪镇压的不是“造反的劳改犯”_夏韵_新浪博客

赵永夫开枪镇压的不是“造反的劳改犯”_夏韵_新浪博客

出国后的心态


出国的我就像是青楼的风尘女子!
走的时候跟家人依依不舍,但不走不行 <=> 刚被卖给青楼,跟家里人依依不舍,但不去不行;
很想回国并再也不想回来 <=> 期待有一天能从良,永远做良家妇女;
熬到假期,并准备回国,充满期待 <=> 等到才子倾心,并准备私奔,充满期待;
发现自己家跟原来有点不同,但还挺兴奋 <=> 发现现实的生活并不轻松,但还想坚持;
周围的人用不同的眼光看你 <=> 周围的人用不同的眼光看你;
假期结束,不想回学校,但没办法 <=> 银子花光,不想二进宫,但没办法;
......过了很多年......
又有假期,回还是不回呢?有期待但怕麻烦 <=> 又有才子倾心,跑还是不跑呢?有希望但有顾忌
.......又过了几年......
回个屁啊,快绿卡了 <=> 从良个屁啊,快当上老鸨了!

都是出门在外,希望大家都能开开心心的,如果你觉得上面的比喻不恰当,就当我放了个屁吧,哈哈!

Saturday, May 21, 2011

Install MeeGo 1.2 on Virtualbox and Fedora 14

First, you could download MeeGo from official website, https://meego.com/downloads. I download the one for netbook with Chrome.

The image file is ended with ".img", which is not directly supported by virtualbox. However, fortunately, you may change it to "iso" directly and it works fine.
Then, proper your virtualbox. You have to enable the following check box to enable "PAE", otherwise, the booting process will be halted. You may also need to set the system type to Linux 2.6 or Fedora.

Then, everything would be very similar to the installation of Linux.
After you finish installation and type in your user name, you may cannot login the system for the infinite halting. If so, try to modify the boot kernel input as follow when GRUB is booting:
vmlinuz-2.6.33.3-11.1-netbook ro root=/dev/sda2 vga=current s
This input will lead you to single user model and enable kernel output during booting. Then, type the following to add suid for Xorg:
chmod +s /usr/bin/Xorg
After doing above steps, system can be booted, as follow:

Friday, May 20, 2011

If your Cmake cannot find FFMpeg for OpenCV 2.1, try to do the following!

Modify your ".bash_profile" like the following:
First you need to make sure the FFMpeg libraries you installed can be found by your Cmake;
Then, make sure your "pkgconfig" can be found!
It works for me!

PATH=$PATH:$HOME/bin
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PATH
export LD_LIBRARY_PATH

Sunday, May 15, 2011

How to program CUDA in C++ with Qt Creator

Some threads in Nvidia forum show that we could make the CUDA code into C++ shared library, which contains device/host memory as needed and do the CUDA calls. Then we link this into a Qt program.

Saturday, May 14, 2011

Some Fragments of CUDA, from Johan`s slides


1. Multiple levels of parallelism.
The first level is grid, which consist of a grid of thread blocks. Each thread block has a number of threads, which can be up to 512 threads.


2. Programming Interface.
CUDA can be seemed as a minimal C extensions and a runtime library, which provide built-in types and a subset of C standard library. A host component, which executed on CPU, controls and access GPUs to run the specified kernel code.
  • Function qualifiers, specify where to call and execute a function;
  • Variable type qualifiers, defines where to allocate space for the variable;
  • Kernel execution directive, defines what is the size of thread block and grid.  

function<<<block_dimension>>>( ... )
3. NVCC compiler
nvcc could automatically handle include files and linking. However, most STL libraries, such as string and iostream, and exceptions are not supported. The CUDA source code file need to be with “.cu” extension.

Operations on GPU Operations on CPU
fast, less accurate functions,
such as __sin(x)
device management
__syncthreads() memory management
Type conversion functions and
type casting functions
texture management
texture functions OpenGL inter-operations
atomic functions asynchronous concurrent
execution
low level API

4. A GPU consist of N multiprocessors(MP) and each MP has M scalar processors. Each MP processes batches of blocks. Each block is split into SIMD groups of threads, which called "warp"s. When on executing, scheduler switches warps!
5. Memory optimization
 For best performance, global memory accesses should be coalesced. All memory allocation should be contiguous, aligned. The Warp base address must be a multiple of 16 * sizeof(type). In addition, the kth thread should access the element at WBA + k.

Sunday, May 8, 2011

QFileDialog causes crash


QFileDialog causes crash when non-static functions used - Qt Programming - QtForum.org: "fd->setOption( QFileDialog::DontUseNativeDialog, true );"

This problem seems related to Gnome themes with Qt 4.7. There are several bug reports on internet but no one gives answer to eradicate this problem. However, some one purpose a method, use Qt simulated theme to instead the system theme, and it works for me.
Add "-style plastique" in "Arguments" as above.

Enable Compiz Fusion on Fedora 14 : Ranjith Siji – Programming the Web

Enable Compiz Fusion on Fedora 14 : Ranjith Siji – Programming the Web

OpenCV 2.1 with FFmpeg


In the past few dayes, I tried to install OpenCV, with FFmpeg enabled. During the process, I faced few problems. Fortunately, those errors seem solved. The first problem is an error seems like this:
"cvcap_ffmpeg.cpp:250: error: integer constant is too large for 'long' type"
You need to add two lines as follow in the beginning of ".../highgui/cvcap_ffmpeg.cpp".
#define INT64_C
#define __STDC_CONSTANT_MACROS

Then, run make again. This error will be caused if your FFmpeg is properly installed. My first few attempts of installations seem lucky but the reality is that FFmpeg is not enabled.

The next error would looks like this:
/usr/include/libavutil/common.h: In function ‘int32_t av_clipl_int32(int64_t)’:
/usr/include/libavutil/common.h:154:47: error: ‘UINT64_C’ was not declared in
this scope
This problem is triggered by some incompatibilities of C code and C++ code. You could solve this by simply adding "-D__STDC_CONSTANT_MACROS" in "Extra_C_Flags", like what I did in the following image.

Saturday, May 7, 2011

OpenCV 2.1 installation on Fedora 14


Every thing should work well except a bug... You may need to add one line in specified file as follow: