Monday, August 20, 2018
Thursday, August 16, 2018
Optimize code C/C++
If you are using linux: use
In Windows the equivalent is
Resources:
[1] fast input/output https://ideone.com/BrsDz4
Enteprise solutions:
[1] http://www.fastformat.org/
getchar_unlocked()
and putchar_unlocked()
for taking fast single character I/O.In Windows the equivalent is
getchar()
and puchar()
repectivelyResources:
[1] fast input/output https://ideone.com/BrsDz4
Enteprise solutions:
[1] http://www.fastformat.org/
Monday, August 13, 2018
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/
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
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
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/
Monday, June 11, 2018
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/
$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/
Tuesday, June 05, 2018
Mapping files into memory
- CreateFile(); or OpenFile();
- CreateFileMapping();
- MapViewOfFile();
mmap()
combines the functions of CreateFileMapping()
and MapViewOfFile()
References
[1] https://stackoverflow.com/questions/8391094/equivalent-win-api-in-nix
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
[3] mmap example https://gist.github.com/marcetcheverry/991042
Saturday, May 19, 2018
AI Courses and Resources
Resources:
[1] Berkeley course http://ai.berkeley.edu
[2] Minimax algorithm https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-3-tic-tac-toe-ai-finding-optimal-move/
[3] Alfa Beta Prunning https://www.geeksforgeeks.org/minimax-algorithm-in-game-theory-set-4-alpha-beta-pruning/
[4] Full Course, Search slides https://courses.cs.washington.edu/courses/cse473/14au/slides/
Friday, May 18, 2018
Qt Project to MakeFile
qmake -spec macx-g++ x.pro
on Mac OS X to generate Makefileqmake x.pro
on linux to generate Makefile (default behaviour)qmake -spec win32-g++ x.pro
on Windows to generate MakefileReferences:
[1] https://stackoverflow.com/questions/8571687/how-to-get-a-makefile-from-qmake
Wednesday, May 16, 2018
Fluid SImulaton Source codes
Compile OceanSurface under Ubuntu 16 [2]
* Install dependences
libglm-dev
libglfw3-dev
libsoil-dev
$g++ -o OceanSurface main.cpp wave.cpp Record.cpp -lGL -lglfw -lGLEW -lfftw3 -lfftw3f -lSOIL
Resources:
[1] splishsplash http://melhorum.blogspot.com.br/2018/05/compile-splishsplash.html
[2] https://github.com/JiashuoLi/OceanSurface
[3] https://ttnghia.github.io/
Sunday, May 06, 2018
Ubuntu 16 Setting Screen Samsung SyncMaster T240M
$cvt 1600 1000 #get right values for this resolution
$gtf 1600 1000 60 #alternative
# 1600x1000 59.87 Hz (CVT 1.60MA) hsync: 62.15 kHz; pclk: 132.25 MHz
Modeline "1600x1000_60.00" 132.25 1600 1696 1864 2128 1000 1003 1009 1038 -hsync +vsync
$ sudo xrandr --newmode "1600x1000" 132.25 1600 1696 1864 2128 1000 1003 1009 1038 -hsync +vsync #define
$ sudo xrandr --addmode DVI-I-1 "1600x1000" #register on system
$ xrandr
Screen 0: minimum 320 x 200, current 1600 x 900, maximum 16384 x 16384
DVI-I-1 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
1920x1200 59.95 +
1600x1200 60.00
1280x1024 75.02 60.02
1280x960 60.00
1152x864 75.00
1024x768 75.08 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 60.00
720x400 70.08
1600x900 59.95*
1600x1000 59.87
DVI-I-2 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
1600x900_60.00 (0x58e) 118.250MHz -HSync +VSync
h: width 1600 start 1696 end 1856 total 2112 skew 0 clock 55.99KHz
v: height 900 start 903 end 908 total 934 clock 59.95Hz
* Set permanent settings using ~/.xprofile (for example)
$vi ~/.xprofile
#
xrandr --newmode "1600x1000" 132.25 1600 1696 1864 2128 1000 1003 1009 1038 -hsync +vsync
xrandr --addmode DVI-I-1 "1600x1000"
* Problem: After nvidia drivers installation this doesn't works (crap)
$xrandr --fb 1600x1000 #show
xrandr: specified screen 1900x1000 not large enough for output DVI-I-3 (1920x1200+0+0)
xrandr: Configure crtc 0 failed
X Error of failed request: BadValue (integer parameter out of range for operation)
#or
X Error of failed request: BadMatch (invalid parameter attributes)
$xrandr --output DVI-I-3 --scale 1x0.85 #this solve after nvidia drivers installation
References:
http://ubuntuhandbook.org/index.php/2017/04/custom-screen-resolution-ubuntu-desktop/
Friday, May 04, 2018
Nvidia and Opengl doesn't works
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Prepare removing
sudo apt-get purge nvidia*
#This will remove your current nVidia driverssudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
sudo dpkg-reconfigure xserver-xorg
#This should fix Xorgsudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf
sudo apt-add-repository ppa:xorg-edgers/ppa
#provides the necessary repositorysudo apt-get update
sudo apt-get install bumblebee-nvidia nvidia-319 nvidia-settings-319
Monday, April 30, 2018
Thursday, April 26, 2018
My favorite Music
Ludwig Van Beethoven
Symphony No. 5 in C minor ("Fate") (composed 1804–08, premiĆØred 1808)
Sonata N° 14 'moonlight'
Fur Elisa
Himno de la alegria
Turkish March (Adapted by Chavo del 8 program, in intro)
Wolfgang Amadeus Mozart
Turkish March
RĆ©quiem
Antonio Vivaldi
Storm
La Stravaganza Four Season:Spring
Johan Sebastian Bach
Toccata and Fugue Ave maria
Passacaglia
FrƩdƩric Chopin
Waltz rain
Spring waltz (Mariage d'Amour)
AntonĆn DvoÅĆ”k
Symphony no. 9 - 4th movement - Allegro con fuoco
Subscribe to:
Posts (Atom)
-
Resources: [1] Hela https://ome.grc.nia.nih.gov/iicbu2008/hela/index.html
-
en inglĆ©s se llama “A potentially dangerous Request.Form value was detected from the client”. varias pĆ”ginas indican dos cosas: 1. agrega...
-
mas plugins http://devsnippets.com/reviews/using-jquery-to-style-design-elements-20-impressive-plugins.html http://www.extjs.com/deploy/dev/...
Ubuntu Forware port 80
#!/bin/bash iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8069 iptables -t nat -A PREROUTING -i eth0 -p tc...