Friday, September 07, 2018

Linear Regresion



[1] Regresion linear http://onlinestatbook.com/2/regression/intro.html
[2] https://towardsdatascience.com/linear-regression-with-example-8daf6205bd49


Wednesday, September 05, 2018

pip3 ImportError: cannot import name 'main'


In linux you need to change the file: /usr/bin/pip3 from:
 
from pip import main
if __name__ == '__main__':
    sys.exit(main())

to:

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())
 
 

Monday, September 03, 2018

c++ realloc references



https://en.cppreference.com/w/c/memory/realloc
https://www.tutorialspoint.com/c_standard_library/c_function_realloc.htm

Thursday, August 30, 2018

Linux: mount folder to different folders

Code:
mount -o bind /media/disk1/pictures /home/user1/pictures
mount -o bind /media/disk1/pictures /home/user2/pictures
for add a fstab entry to auto-mount at startup.


Code:
/media/disk1/pictures /home/add1cker/pictures none defaults,bind 0 0

Sunday, August 26, 2018

Tuesday, August 21, 2018

Raspberry pi 3


1) user and passwords:
Distribution   | Username   | Password
---------------|------------|-------------
Debian Squeeze | pi         | raspberry
Arch           | root       | root
QtonPi         | root       | rootme
Raspbian       | pi         | raspberry
OpenElec       | root       | openelec
Pidora         | root       | raspberrypi
RISC OS        | n/a        | n/a
raspbmc        | pi         | raspberry
 
2) add users

$sudo adduser username
$usermod -aG sudo username
 
3) Ports
 
$lsof -nP -i | grep LISTEN
$netstat -tlpn | grep LISTEN
 
4) vncserver (reinstall, by default sometime doesn't works)
$sudo apt-get install tightvncserver 

5) Firewalls

iptables -I INPUT -p tcp --dport 5900 -j ACCEPT
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

Resources:
[1] https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart
[2] direct way https://www.shellhacks.com/how-to-grant-root-access-user-root-privileges-linux/
[3] vncserver https://quaintproject.wordpress.com/2013/03/24/establish-a-vnc-connection-to-your-raspberry-pi-from-a-linux-pc/
 
 
 

Thursday, August 16, 2018

Optimize code C/C++

If you are using linux: use getchar_unlocked() and putchar_unlocked() for taking fast single character I/O.
In Windows the equivalent is getchar() and puchar() repectively



Resources:
[1] fast input/output https://ideone.com/BrsDz4


Enteprise solutions:
[1] http://www.fastformat.org/

Thursday, August 09, 2018

Programming online C++ and others

Online programming tools

Resources:
[1] C++, Python  https://repl.it/@melhorum


[2] Multi Language Support https://code.dcoder.tech/

[3] Account for C/C++, C#, Java  http://rextester.com
[4] http://www.onlinegdb.com/


Wednesday, August 01, 2018

Store on EEUU for Buy


Stores:
[1] https://www.shipito.com/pt/shipito-pricing

Python 2.7 pip


Resolving error on python 2.7 using pip: ImportError: No module named _internal



$wget https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz
$tar -xzvf pip-8.1.2.tar.gz
$cd pip-8.1.2
$sudo python setup.py install
 
 
 

Tuesday, July 10, 2018

Lectures


https://arxiv.org/pdf/1803.04189.pdf

Friday, June 29, 2018

OpenCV 2.4.9 and 3.4.1 Compiling




2.4.x

CUDA_nppi_LIBRARY  CUDA 7.5 -> 8.0 (was removed)
  -D WITH_CUDA=OFF ..

c++ 6 fatal error: stdlib.h: No such file or directory

 export CC=path_of_gcc/gcc-version
 export CXX=path_of_g++/g++-version
 cmake  path_of_project_contain_CMakeList.txt
 make 
 
OR
 #Current version is 6, but we need to compile using another version (installed for sure)
$CC="gcc-4.9" CXX="g++-4.9" cmake /CMakeLists.txt 
 
OR$cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/usr/bin/g++ CMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_TBB=ON -DBUILD_NEW_PYTHON_SUPPORT=ON -DWITH_V4L=ON -DINSTALL_C_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DBUILD_FAT_JAVA_LIB=ON -DINSTALL_TO_MANGLED_PATHS=ON -DINSTALL_CREATE_DISTRIB=ON -DINSTALL_TESTS=ON -DENABLE_FAST_MATH=ON -DWITH_IMAGEIO=ON -DBUILD_SHARED_LIBS=OFF -DWITH_GSTREAMER=ON -DWITH_OPENMP=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF ..

3.4.x

Unknown CMake command "ocv_append_source_files_cxx_compiler_options".

This happened when the opencv_contrib version is no compatible with your current version.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -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=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ ..


$make
$sudo make install
$sudo ldconfig

After installation, if doesn't compile, check the files opencv.conf and opencv.pc:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#/etc/ld.so.conf.d/opencv.conf
/usr/local/lib
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#/usr/local/lib/pkgconfig/opencv.pc

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.13.6
Libs: -L${exec_prefix}/lib -lopencv_contrib -lopencv_legacy -lopencv_stitching -lopencv_nonfree -lopencv_superres -lopencv_ocl -lopencv_objdetect -lopencv_ml -lopencv_ts -lopencv_videostab -lopencv_video -lopencv_photo -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_imgproc -lopencv_flann -lopencv_core -L/usr/lib/x86_64-linux-gnu -lIlmThread -lHalf -lIex -lIlmImf -lImath -ljasper -ltiff -lpng -ljpeg -lavutil -lswscale -lswresample -lavcodec -lz -llzma -lxcb-shape -lxcb-render -lxcb-xfixes -lxcb-shm -lxcb -lavformat -lv4l2 -lv4l1 -ldc1394 -lGL -lGLU -latomic -ltbb -lrt -lpthread -lm -ldl -lstdc++
Cflags: -I${includedir_old} -I${includedir_new}

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Resources:

[1] opencv github (choice right branch) https://github.com/opencv/opencv

[1] opencv_contrib is just from 3.0 .. https://github.com/opencv/opencv_contrib/releases
[2] Steps for install () http://karytech.blogspot.com/2012/05/opencv-24-on-ubuntu-1204.html
[3] Script for install under ubuntu16 https://gist.github.com/fortunto2/20a9696c7fc23ef18f8cfc50e371fe5f
[4] Some variables http://daveaubin.com/index.php/how-to-build-and-install-opencv-2-4-9-on-raspberry-pi/


Friday, June 08, 2018

Fluid Simulation: Lectures and Resources



CAELinux LiveDVD in your computer to turn it into a free and open engineering development workstation with CAD, CAM, CAE / FEA / CFD, electronic design and 3D printing  features: no licence and even no installation is required ! [2]


Resources:
[1] Laboratory http://lgg.epfl.ch/research_physicsbased_animation.php
[2] CFD Linux distro https://caelinux.com/CMS3/

Courses:
[1] Khan https://pt.khanacademy.org/partner-content/pixar/effects/particle/p/water-simulation

Wednesday, June 06, 2018

Compiling tris2indicator on Linux Ubuntu 16

change code from MapViewOfFile (Windows) to mmap (Linux) on read_obj.cpp and write_grid.cpp.

$g++ read_obj.cpp vect.cpp global.cpp insert_poly.cpp write_grid.cpp timer.cpp main.cpp -lpthread -lm -o tris2indicator



source code:
[1] http://josiahmanson.com/research/wavelet_rasterization/

Running apps

Runtastic (I uninstalled because force to update your device - Internet connection problems) Runkeeper  (Wrong GPS tracking) Strava   (Curr...