I have had both VS2008 and VS2015 installed on my machine for a while, and VS2015 was installed after VS2008.
Now I notice that whenever I click on a VS2008 solution to open it, it won’t ask me anything but to use VS2015 to open it. I have no idea what this is but the same happens with VS2015. This is only whenever I double click on a solution file to open it. If I right click on the .sln file and give it the version to open with (like VS2008 for example),  it is still opened with VS2015 without asking this question. Then only thing I can open VS2008 .sln file with VS2008, is to open VS2008 manually and drag the VS2008 .sln file into it.
If you are in this situation, two things you need to check the registry entry for the file extension. One is for .vcproj file extension, and the other is for .sln file extension.
Make sure following two registry entry is like this:
1) check .vcproj file extension
HKEY_CLASSES_ROOT\
  .vcproj\
  (default)=”VisualStudio.vcproj.9.0″
  OpenWithList\
  devenv.exe
Here is the picture:
vcproj
2) check .sln file extension
HKEY_CLASSES_ROOT\
   .sln\
   OpenWithProgids\
   VisualStudio.sln.9.0
Here is the picture:
sln
(0) Comments    (10) Views    Read More   
Posted on 06-01-2016
Filed Under (Technology) by bigbang

We can build OpenCV under Visual Studio by using CMake under Windows7. It is very easy to do this job using edition OpenCV 2.4.X with Visual Studio 2008.

But when I try to build OpenCV 3.1.0 under Visual Studio 2008, there are some errors!

The first error is :

Error   131     fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory      g:\setup_files\opencv\windows\opencv-3.1.0\sources\modules\imgcodecs\src\jpeg_exif.hpp  51

To fix this error, just google the stdint.h file and put it under the build path of OpenCV.

The second error is:

Error   1       error C2039: 'data' : is not a member of 'std::vector<_Ty>'     g:\setup_files\OpenCV\Windows\OpenCV-3.1.0\sources\modules\videoio\src\cap_mjpeg_decoder.cpp    793

This error is generated by \modules\videoio\src∩_mjpeg_decoder.cpp line 793, the origin code is:

m_file_stream.read(result.data(), chunk.m_size);

To fix this error, just change the code into following:

m_file_stream.read(&result[0], chunk.m_size);

OpenCV 3.1.0 uses C++11 code but Visual Studio 2008 doesn’t support this feature.

By done these, re-compile your solution then you will get the OpenCV 3.1.0 libraries from Visual Studio 2008.

(0) Comments    (183) Views    Read More   
Posted on 06-05-2015
Filed Under (Technology) by bigbang

In Android jni folder, we will always add some C/C++ header file folders. Basically, there are two ways to do this job.

Option 1:

Add one of the following lines to your Android.mk inside a module of your choice:

LOCAL_C_INCLUDES := /path/to/your/includes # ignore previous includes
                                           # OR
LOCAL_C_INCLUDES += /path/to/your/includes # preserve previous includes

If necessary you could create an environment variable pointing at ‘/path/to/your/includes’ and include it like this:

LOCAL_C_INCLUDES := $(MYLIB_INCLUDES_PATH) # ignore previous includes
                                           # OR
LOCAL_C_INCLUDES += $(MYLIB_INCLUDES_PATH) # preserve previous includes

If you write following code but there is no effect:

LOCAL_C_INCLUDES := ../example/include
LOCAL_C_INCLUDES += ../example/include2

please add $(LOCAL_PATH) to them, which will be:

LOCAL_C_INCLUDES := $(LOCAL_PATH)../example/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)../example/include2

Option 2:

  1. Copy the complete folder with all header-files in it (mylib) into the ‘jni’ folder of your project.
  2. Add the following line to your Android.mk inside a module of your choice:
LOCAL_C_INCLUDES := $(LOCAL_PATH)/mylib

or

LOCAL_C_INCLUDES += $(LOCAL_PATH)/mylib

Depending on whether there are previous includes or not. If the include is the first one, use the first examle which use := as keyword. If has previous includes, use latter which is += as keyword.

(0) Comments    (258) Views    Read More   

When we put the jni folder under projects and compile it using command line tool ndk-build, we will get libs & obj folders like this:

|--jni
|--libs
|----armeabi-v7a
|--obj

But under Android Studio develop environment, android studio can’t find the so files under libs folder.

We can do it by using following folder structure under Android Studio:

|---app
|------jni
|------libs
|------obj
|------src
|---------androidTest
|---------main

We can use this folder structure to compile JNI. When we compile the JNI file, ndk-build will generate libs & obj folders.

Finally, we add following to android part in build.gradle to let Android Studio finds the so files generated by jni folder:

sourceSets.main {
    jniLibs.srcDirs = ['libs']
}

Finally, the build.gradle should look like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "org.waterlin.mediatester"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets.main {
        jniLibs.srcDirs = ['libs']
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
}

By this way, Android Studio can let you use local jni code to generate so library and integrated into your Android project.

(0) Comments    (219) Views    Read More   
Posted on 08-04-2014
Filed Under (Technology) by bigbang

If you are under Windows, you may need to config golang develop environment manually.

Get Emacs go-mode from misc/emacs/, there are two files: go-mode-load.el and go-mode.el.

Put them into your Emacs load-path, then add following code to .emacs:

;; golang mode
(add-to-list 'load-path "~/emacs/site-lisp/go-mode")
(require 'go-mode-load)
(require 'go-mode)

Then you can open go source file with syntax highlight now.

If you are under Ubuntu/Debian, the easiest way to install golang-mode is by:

sudo apt-get install golang-mode

After this installation, retart your Emacs then you can edit go source file with syntax highlight.

Posted on 08-04-2014
Filed Under (Technology) by bigbang

If you have a keyboard with two Alt keys (e.g. a US Keyboard), you will find that PuTTY doesn’t recognize the one on the right side. It is a fatal problem if you are using Emacs in putty on Windows to editing files on a remote computer.

After doing some reasearching on it, I think there are two soluctions for this problem.

  1. Easily fixed the problem with a simple registry edit

    The putty topic Right Alt Key Broken shows an easy solution for it by add following registry code:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,38,00,38,e0,00,00,00,00
    
  2. Use AutoHotkey to cheat Putty right Alt as left Alt

    Right click on AutoHotkey icon and click ‘Window Spy’ in the menu, you can get Putty class name in AutoHotkey. Then add following setting in current script in AutoHotkey:

    #IfWinActive ahk_class PuTTY
    RAlt::LAlt
    #IfWinActive
    

    Reload the script and you can use right Alt to invoke Emacs M-x key bindings in Putty.

I prefer the second way to fix the Right Alt Key Broken problem in Putty under Windows.

Posted on 01-04-2014
Filed Under (Technology) by bigbang

Django-Chartit looks like a good tool for drawing some data charts under Python Django framework.

But it is a little hard to get it ready for work. Here I remind of two key steps while using Chartit:

  1. add chartit to your INSTALLED_APPS.
  2. install simplejason if you get ‘use_decimal’ error.

    The error message is something like:

    TypeError at /charts/
    __init__() got an unexpected keyword argument 'use_decimal'
    

I don’t think Chartit is the best choice current now, and I prefer Chart.js instead if you just want to draw some basic charts.

(0) Comments    (791) Views    Read More   
Posted on 01-04-2014
Filed Under (Technology) by bigbang

While I make my cpp source files linking ZeroMQ under Ubuntu, I got following error:

/usr/bin/ld: test_server.o: undefined reference to symbol 'zmq_strerror'
/usr/bin/ld: note: 'zmq_strerror' is defined in DSO /usr/local/lib/libzmq.so.3 so try adding it to the linker command line
/usr/local/lib/libzmq.so.3: could not read symbols: Invalid operation

The ZeroMQ library has already installed. By checking the man:

Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

I get rid of the error by following steps:

  1. install libtool;
  2. add the library path to LD_LIBRARY_PATH;
  3. use root to make.

I think the last one, using root to make, is the key point. Why?

Posted on 27-03-2014
Filed Under (Technology) by bigbang

While I am using ‘go get’ command to install the libraries of GoLang, I get this error:

# pkg-config --cflags libzmq libzmq libzmq libzmq
exec: "pkg-config": executable file not found in $PATH

We need to install pkg-config to fix this problem. On Ubuntu, just use command:

sudo apt-get install pkg-config

It’s because that package (sdl) uses pkg-config to get necessary cflags and ldfalgs for compiler and linker, respectively.

Posted on 23-02-2014
Filed Under (Technology) by bigbang

I am using Clojure & Compojure to write my webpages, and I am trying to use Selmer as template system for Clojure.

Here is my template file structure: there is a basic template file base.tpl which defines basic header, footer or something else. And some other files like index.tpl, search.tpl to do the real job by including base.tpl template. The base.tpl file defines the common part of my site and changes few times during my project lifetime.

In some suitations, we need to modify base.tpl. But after modification of base.tpl, Clojure & Selmer don’t re-render base.tpl when I visit and render index.tpl file. So I need to restart lein ring server every time after I modify base.tpl.

It is too troublesome and forgettable to restart lein ring server every time after modified base.tpl. Finally I find the reason on Selmer official doc site:

Note that changes in files referenced by the template will not trigger a recompile. This means that if your template extends or includes other templates you must touch the file that’s being rendered for changes to take effect.

Alternatively you can turn caching on and off using

(selmer.parser/cache-on!)

and

(selmer.parser/cache-off!)

respectively.

(0) Comments    (806) Views    Read More