Tuesday, 23 May 2017

Open Data Kit : ODK Scan

Status : Draft


Build

Ketika melakukan kompilasi ODKScanCore, Anda harus menggunakan OpenCV 2.3.1, download disini : https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/  (harus melakukan proses kompilasi dari source), ketika melakukan kompilasi, nonaktifkan opsi ffmpeg :

Untuk Mac OS X, penulis menggunakan Mojave, maka sebelumnya perlu menginstall OpenCV 2 dengan perintah :

brew install opencv@2

lalu edit src/Aligner.cpp dan tambahkan baris berikut :

#include <opencv2/nonfree/features2d.hpp>

Lalu untuk Makefile ubah bagian berikut :

INCLUDES := $(OPENCV_INCLUDES)\
-I./jsoncpp-src-0.5.0/include\
-I./src -I./\
-L/usr/lib
-I./zxing/core/src -I./zxing/cli/src

menjadi : 

INCLUDES := -I/usr/local/Cellar/opencv\@2/2.4.13.7_3/include/\
-L/usr/local/Cellar/opencv\@2/2.4.13.7_3/lib\
-lopencv_core\
-lopencv_imgproc\
-lopencv_highgui\
-lopencv_ml\
-lopencv_video\
-lopencv_features2d\
-lopencv_calib3d\
-lopencv_objdetect\
-lopencv_contrib\
-lopencv_legacy\
-lopencv_flann\
-lopencv_nonfree\
-liconv\
-I./jsoncpp-src-0.5.0/include\
-I./src -I./\
-lboost_filesystem -lboost_system\
-I./zxing/core/src -I./zxing/cli/src

Berikutnya berlaku untuk Linux dan Mac

cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON \
      -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=OFF \
      -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON \
      -D WITH_FFMPEG=OFF ..

Error 1 :

OpenCV-2.3.1/share/OpenCV/../../include/opencv2/flann/any.h:88:67: error: call to function 'operator<<' that is neither visible in the template
      definition nor found by argument-dependent lookup

Solusi, terapkan patch berikut [sumber]:

diff --git a/modules/flann/include/opencv2/flann/any.h b/modules/flann/include/opencv2/flann/any.h
index 46e1116..06db1b2 100644
--- a/modules/flann/include/opencv2/flann/any.h
+++ b/modules/flann/include/opencv2/flann/any.h
@@ -30,6 +30,12 @@ struct empty_any
 {
 };
 
+inline std::ostream& operator <<(std::ostream& out, const empty_any&)
+{
+    out << "[empty_any]";
+    return out;
+}
+
 struct base_any_policy
 {
     virtual void static_delete(void** x) = 0;
diff --git a/modules/flann/include/opencv2/flann/lsh_index.h b/modules/flann/include/opencv2/flann/lsh_index.h
index a777990..6ed5740 100644
--- a/modules/flann/include/opencv2/flann/lsh_index.h
+++ b/modules/flann/include/opencv2/flann/lsh_index.h
@@ -56,7 +56,7 @@ namespace cvflann
 
 struct LshIndexParams : public IndexParams
 {
-    LshIndexParams(unsigned int table_number, unsigned int key_size, unsigned int multi_probe_level)
+    LshIndexParams(unsigned int table_number = 12, unsigned int key_size = 20, unsigned int multi_probe_level = 2)
     {
         (* this)["algorithm"] = FLANN_INDEX_LSH;
         // The number of hash tables to use

Error 2

armeabi] SharedLibrary  : libbubblebot.so
/home/wildan/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/home/wildan/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/home/wildan/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/home/wildan/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4

Solusi : 

Edit : 

bubblebot_lib/jni/Android.mk

Tambahkan -latomic di LOCAL_LDLIBS :

LOCAL_LDLIBS += $(OPENCV_LIBS) $(ANDROID_OPENCV_LIBS) -llog -ldl -lGLESv2 -latomic                                                                   
 
OSX Mojave

cd OpenCV-2.3.1
mkdir build
cd build
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON       -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON       -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=OFF       -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON       -D WITH_FFMPEG=OFF ..

Error 3 

/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/core/src/persistence.cpp:3437:36: error: ordered comparison
      between pointer and zero ('const char *' and 'int')
    if( rows < 0 || cols < 0 || dt < 0 )
                                ~~ ^ ~
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/core/src/persistence.cpp:4503:16: error: ordered comparison
      between pointer and zero ('const char *' and 'int')
    if( vtx_dt > 0 )
        ~~~~~~ ^ ~
2 errors generated.
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/persistence.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2

Perbaikan, ubah :

if( rows < 0 || cols < 0 || dt < 0 ) menjadi : if( rows < 0 || cols < 0 || dt != nullptr )

dan

if( vtx_dt > 0 ) nenjadi if( vtx_dt  != nullptr )

Error 4 

/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/highgui/src/window_QT.cpp:316:5: error: use of undeclared
      identifier 'usleep'
                                usleep(1000);
                                ^
1 error generated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

Solusi :

tambahkan :

#include <unistd.h>

di OpenCV-2.3.1/modules/highgui/src/window_QT.cpp

Error 5

/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/highgui/src/cap_qtkit.mm:34:9: fatal error: 'QTKit/QTKit.h'
      file not found
#import <QTKit/QTKit.h>
        ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

Solusi :

Here is a workaround solution to fix the issue:

  1. Download MACOSX SDK https://codeload.github.com/phracker/MacOSX-SDKs/zip/MacOSX10.11.sdk
  2. extract head files from MacOSX10.11.sdk/MacOSX10.11.sdk/System/Library/Frameworks/QTKit.framework/Headers/
  3. Create a folder under opencv source file folder: opencv-2.3.1/modules/highgui/src/QTKit, and copy all header files into the folder.

Error 6

Scanning dependencies of target opencv_ts
[ 28%] Building CXX object modules/ts/CMakeFiles/opencv_ts.dir/src/precomp.o
In file included from /Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/ts/src/precomp.cpp:1:
In file included from /Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/ts/src/precomp.hpp:7:
In file included from /Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/ts/include/opencv2/ts/ts.hpp:10:
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/ts/include/opencv2/ts/ts_gtest.h:1511:10: fatal error:
      'tr1/tuple' file not found
#include <tr1/tuple>  // NOLINT
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [modules/ts/CMakeFiles/opencv_ts.dir/src/precomp.o] Error 1
make[1]: *** [modules/ts/CMakeFiles/opencv_ts.dir/all] Error 2
make: *** [all] Error 2

Solusi

Aktifkan opsi GTEST_USE_OWN_TR1_TUPLE 1 di  ts_gtest.h

Error 7

OPENCV_CONFIG =
PROJECT_PATH defaulting to this directory
/Users/earth/Library/Android/sdk/ndk-bundle/ndk-build NDK_LIBS_OUT=./../scan_app/src/main/jniLibs OPENCV_CONFIG= PROJECT_PATH=. V=  ARM_TARGETS="armeabi armeabi-v6 armeabi-v7a"
make[1]: Entering directory `/Users/earth/jobstuff/software/OpenDataKit/scan/bubblebot_lib'
[armeabi-v7a] Install        : libbubblebot.so => ../scan_app/src/main/jniLibs/armeabi-v7a/libbubblebot.so
[armeabi] SharedLibrary  : libbubblebot.so
/Users/earth/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/Users/earth/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/Users/earth/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
/Users/earth/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ext/atomicity.h:49: error: undefined reference to '__atomic_fetch_add_4'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [obj/local/armeabi/libbubblebot.so] Error 1
make[1]: Leaving directory `/Users/earth/jobstuff/software/OpenDataKit/scan/bubblebot_lib'
make: *** [libs/armeabi-v7a/libbubblebot.so] Error 2

Solusi :  untuk masalah ini bisa dibaca di : Error migrating from GCC to Clang - undefined reference to atomic #104.

yaitu di : bubblebot_lib/jni/Android.mk

LOCAL_LDLIBS += $(OPENCV_LIBS) $(ANDROID_OPENCV_LIBS) -llog -ldl -lGLESv2

ditambah -latomic menjadi :

LOCAL_LDLIBS += $(OPENCV_LIBS) $(ANDROID_OPENCV_LIBS) -llog -ldl -lGLESv2 -latomic

Error 8 

[ 64%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/texture.o
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/legacy/src/texture.cpp:138:32: warning: 'memset' call
      operates on objects of type 'CvGLCM' while the size is based on a different type 'CvGLCM *'
      [-Wsizeof-pointer-memaccess]
    memset( newGLCM, 0, sizeof(newGLCM) );
            ~~~~~~~            ^~~~~~~
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/legacy/src/texture.cpp:138:32: note: did you mean to
      dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset( newGLCM, 0, sizeof(newGLCM) );
                               ^~~~~~~
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/legacy/src/texture.cpp:472:32: error: ordered comparison
      between pointer and zero ('double *' and 'int')
        if( marginalProbability>0 )
            ~~~~~~~~~~~~~~~~~~~^~
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/legacy/src/texture.cpp:518:10: warning: use of unary
      operator that may be intended as compound assignment (-=)
    HXY1 =- HXY1;
         ^~
/Users/earth/jobstuff/software/OpenCV/OpenCV-2.3.1/modules/legacy/src/texture.cpp:519:10: warning: use of unary
      operator that may be intended as compound assignment (-=)
    HXY2 =- HXY2;
         ^~
3 warnings and 1 error generated.
make[2]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/src/texture.o] Error 1
make[1]: *** [modules/legacy/CMakeFiles/opencv_legacy.dir/all] Error 2
make: *** [all] Error 2

Solusi

ubah

if( marginalProbability>0 )

menjadi

if( marginalProbability > (void *)0 )

Referensi


  1. ODK Scan Wiki and Issues, https://github.com/opendatakit/scan

Monday, 22 May 2017

Open edX : the open source platform that powers edX courses.

Status : Draft


Instalasi


Untuk instalasinya mudah, di dokumentasinya cukup jelas, singkatnya :

1. mkdir devstack && cd devstack
2. set environment variables di .bashrc , sehingga output nya:

echo $OPENEDX_RELEASE
open-release/ficus.3

3. curl -OL https://raw.github.com/edx/configuration/$OPENEDX_RELEASE/util/install/install_stack.sh

4.  chmod +x install_stack.sh

5. ./install_stack.sh

6. Nyalakan VM dan masuk ke VM dengan perintah vragrant up && vragrant ssh

Selanjutnya bisa membaca [2]

Referensi

  1. Open edX, https://open.edx.org/
  2. Running Devstack, https://openedx.atlassian.net/wiki/display/OpenOPS/Running+Devstack

Thursday, 18 May 2017

Solusi E-Commerce Open Source

Status : Draft


Konektifa

Konektifa [3] tidak open source, hanya konsepnya sepertinya menarik.

Referensi

  1. OpenShop.io, Open-source mobile E-commerce platform, http://openshop.io/
  2. Sylius, First eCommerce framework that grows with your business, http://sylius.org/
  3. Konektifa, https://konektifa.com/

Sunday, 14 May 2017

LaTeXML : A LaTeX to XML/HTML/MathML Converter

Status : Draft

Prasyarat Kompilasi 

Agar make test semuanya terlewati, berikut adalah paket-paket yang perlu diinstall

sudo apt-get install   \
  libarchive-zip-perl libfile-which-perl libimage-size-perl  \
  libio-string-perl libjson-xs-perl libtext-unidecode-perl \
  libparse-recdescent-perl liburi-perl libuuid-tiny-perl libwww-perl \
  libxml2 libxml-libxml-perl libxslt1.1 libxml-libxslt-perl  \
  texlive-latex-base texlive-full imagemagick libimage-magick-perl

Untuk cara kompilasi bisa lihat di [2]


Referensi

  1. LaTeXML, http://dlmf.nist.gov/LaTeXML/
  2. LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator, https://github.com/brucemiller/LaTeXML, https://github.com/brucemiller/LaTeXML

Tangent : Salah Satu Tool untuk Maths Information Retrieval

Status : Draft


Requirement


Tangent menggunakan Pyhton 3, beberapa library  yang diperlukan :

  1. Beautiful Soup, pip3 install beautifulsoup4

Instalasi 


Untuk instalasi sudah jelas, tinggal jalankan make all. Misal kita setelah mendownload Tangent, menempatkannya di direktori :

/home/wildan/jobstuff/openthinklabs/eksperimen/tangent/tangent.0.3.1

Maka di .bashrc kita perlu menambahkan variabel PYTHONPATH, agar kode tangent bisa kita jalankan :

export PYTHONPATH=/home/wildan/jobstuff/openthinklabs/eksperimen/tangent/tangent.0.3.1/tangent_code:$PYTHONPATH                                       
Jika ketika running masih terjadi error seperti : https://github.com/OpenThink-Labs/Tangent/blob/master/log1.txt 

Langkah yang dilakukan untuk mengatasinya adalah :

  1.  menguninstall latexml bawaan sistem, dan melakukan kompilasi ulang LaTeXML terbaru, http://software.openthinklabs.com/2017/05/latexml-latex-to-xmlhtmlmathml-converter.html 
  2. dan sedikit perbaikan https://github.com/OpenThink-Labs/Tangent/commit/3e7807ae52fa38ca0a523e288432f271b97f2ba4
Seharusnya, jika semua sudah Ok, output python2 index.py akan seperti ini :

https://github.com/OpenThink-Labs/Tangent/blob/master/log4.txt

Referensi


  1. Kemiripan Persamaan Matematika, http://software.openthinklabs.com/2015/11/kemiripan-persamaan-matematika.html

Friday, 12 May 2017

Apache Fineract untuk E-Koperasi

Status : Draft


Apache Fineract 


Dari situs nya Fineract didefinidikan sebagai [1] :

Apache Fineract (\’fīn-,ә-,rakt\) is an open source system for core banking as a platform. Fineract provides a reliable, robust, and affordable solution for entrepreneurs, financial institutions, and service providers to offer financial services to the world’s 2 billion underbanked and unbanked.

Fineract Provider


Untuk instalasi Fineract Provider dapat mengikut petunjuk di [2].

MifosX Community App


Fineract-provider hanya memiliki APIs, untuk itu kita memerlukan aplikasi untuk memanfaatkan,
salah satu user interface, yang dapat kita  gunakan adalah, commuity app Mifos X [3]


Referensi

  1. Apache Fineract, http://fineract.apache.org/
  2. Apache Fineract: A Platform for Microfinance, https://github.com/apache/incubator-fineract
  3. MifosX Community App, https://github.com/openmf/community-app
  4. Apache Fineract untuk E-Koperasi, https://github.com/OpenThink-Labs/ApacheFineract