Sunday, March 10, 2019
mySql Optimize date queries and inserts
High Level of use
DROP INDEX VENTAS_fecven_idx ON VENTAS
select * from VENTAS where date(fecven)='2019-03-09' #~2.81
select * from VENTAS where fecven >='2019-03-09 00:00:00' and fecven<'2019-03-10 00:00:00' #~2.9
select * from VENTAS where fecven Between '2019-03-09 00:00:00' and '2019-03-10 00:00:00' #~3.6
CREATE INDEX VENTAS_fecven_idx ON VENTAS (fecven)
select * from VENTAS where date(fecven)='2019-03-09' #~2.794
select * from VENTAS where fecven >='2019-03-09 00:00:00' and fecven<'2019-03-10 00:00:00' #~0.265
select * from VENTAS where fecven Between '2019-03-09 00:00:00' and '2019-03-10 00:00:00' #~0.261
CREATE INDEX MOVPRO_fecmov_idx ON MOVPRO (fecmov)
#change date(fecmov) between f1 and f2
#to fecmov between f1 and f2 #implicit add 00:00:00
DROP INDEX MOVPRO_fecmov_idx ON MOVPRO
Setting mysql
SET GLOBAL bulk_insert_buffer_size = 1024 * 1024 * 128;
[mysqld]
bulk_insert_buffer_size=128M
References
[1] Insert https://dev.mysql.com/doc/refman/8.0/en/insert-optimization.html
[2] Amazon Best Practices https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_BestPractices.html
Saturday, March 09, 2019
Linux Discovery ports
sudo lsof -iTCP -sTCP:LISTEN
Linux
List used ports
$netstat -tulpn | grep LISTEN
tcp 0 0 127.0.0.1:5939 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
List process that using port
You like to knows who is using port 80, then
$sudo lsof -i :80
apache2 965 root 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13794 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13795 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13796 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13797 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
apache2 13798 www-data 4u IPv6 26650 0t0 TCP *:http (LISTEN)
Second option
$sudo netstat -peanut | grep ":80"
tcp6 0 0 :::80 :::* LISTEN 0 26650 965/apache2
Setting apache
$vi /etc/apache2/apache2.conf
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
Thursday, March 07, 2019
PostgreSQL 8.4 en CentOS
#vi /etc/yum.repos.d/CentOS-Base.repo
agregar la siguiente linea a [base] y [updates]
exclude=postgresql*
2) Añadir los repositorios de PostgreSQL 8.4
Descargar el rpm apropiado desde http://yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html
#wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
#rpm -ivh pgdg-centos-8.4-2.noarch.rpm (este archivos es el que descargamos)
3) Instalar PostgreSQL
3.1 verifique version
#yum list postgresql*
#yum install postgresql postgresql-server
3.1 Error probable de dependencia a apr-util
#yum install apr-util
#yum install postgresql postgresql-server
4) Arrancar el servidor y habilitar conexiones remotas
#service postgresql initdb
#service postgresql start
5) Configurar Accesos en /var/lib/pgsql/data/
5.1 pg_hba.conf
host all all 0.0.0.0/0 trust #no need password , use md5
5.2 postgresql.conf
listen_addresses='*'
port=5432
max_connections=100
superuser_reserved_connections=5
6) Reinicia servicio
#/etc/init.d/postgresql restart
Referencias
[0] Postgres 9.1 http://wiki.postgresql.org/wiki/YUM_Installation
[1] Auto Start/Stop http://www.michaelhinds.com/tech/linux/install-postgres.html
[2] http://www.ixavi.com/2010/01/instalar-postgresql-8-3-en-centos-desde-yum/
Linux root password reset
Mode 1:Recover mode
In recover mode try to remount and after that change password
mount -o remount,rw /
Mode 2: Using live
mkdir /mnt/recover
mount /dev/sda2 /mnt/recover
chroot /mnt/recover
passwd #or
passwd user
exit
umount /mnt/recover
Other way : Using files(for root or any user)
/etc/passwd
/etc/shadow
root:x:0:0:root:/root:/bin/bash
to
root::0:0:root:/root:/bin/bash
References:
[1] http://www.microhowto.info/howto/reset_a_forgotten_root_password_using_a_live_distribution.html
[2] https://www.computersecuritystudent.com/UNIX/UBUNTU/1204/lesson5/index.html
Monday, March 04, 2019
Sunday, March 03, 2019
Raspberry Resources
QEMU can be used to emulate an x86 PC but performance will be terrible.
Wine will not work because it does not translate binary data, only Windows API calls, the binaries are still incompatible.
This is a difficult problem to solve which is probably why ExaGear charge money for it.
Resources:
[1] Chart comparison all famous Arm processors https://www.loverpi.com/blogs/news/85588545-raspberry-pi-banana-pi-orange-pi-odroid-differences-and-chart
[2] Odroid vs other https://tudosobreraspberry.info/2017/08/comparacao-raspberry-pi-orange-pi-banana-pi-e-odroid/
[3] Raspberry Pi3 vs UDOO x86 https://www.youtube.com/watch?v=dJkHxDjFuNA
[4] Combine qemu and wine for run Windows applications https://github.com/AlbrechtL/RPi-QEMU-x86-wine
[5] https://www.kickstarter.com/projects/udoo/udoo-x86-the-most-powerful-maker-board-ever/?src=soc
[6] https://www.raspberrypi.org/forums/viewtopic.php?t=189198
[7] https://elchapuzasinformatico.com/2016/04/udoo-x86-10-veces-mas-potente-raspberry-pi-3-79e/
[8] https://www.redeszone.net/2016/05/20/udoo-x86-mini-ordenador-10-veces-mas-potente-raspberry-pi-3/
[9] https://www.anandtech.com/show/11978/macom-sells-off-appliedmicros-xgene-cpu-business
[1] Experimental comparison Raspberry and Orange https://raspberryparatorpes.net/rivales/raspberry-pi-vs-orange-pi-2017/
Ubuntu users
#adduser username
#usermod -aG sudo username
$
su - username
$whoami
$sudo whoami
Examples to use
$fdisk -l
$sudo fdisk -l
$sudo ls -l /root
Saturday, March 02, 2019
mySql Optimization parameters or commands
Query
SHOW GLOBAL STATUS
SHOW VARIABLES LIKE '%size%';
SHOW GLOBAL VARIABLES LIKE '%size%';
Settings
SET GLOBAL join_buffer_size = 1024 * 1024 * 128 #128M
or
[mysqld]
join_buffer_size = 128M #default ~256K
References:
[0] Compute memory http://mysqlcalculator.com/
[1]
https://dba.stackexchange.com/questions/74693/how-to-break-table-into-two-without-losing-performance
join_buffer_size
[2] https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
[3] Example tunning https://dba.stackexchange.com/questions/127862/tuning-mysql-variables-to-accommodate-high-load
[4] Query variables https://dev.mysql.com/doc/refman/8.0/en/show-variables.html
Sunat Servicios Web
JavaScript Frameworks Lecture
References:
[1] https://reactjs.org/
[2] https://www.w3schools.com/whatis/whatis_react.asp
[3] Repository https://github.com/facebook/react
mySql Common Commands
CREATE TABLE foo LIKE bar;
ALTER TABLE <tablename> CHANGE COLUMN <colname> <colname> VARCHAR(65536);
ALTER TABLE emp MODIFY COLUMN name VARCHAR(100);
Or use CHANGE, but that means you have to give the column name twice
(because CHANGE allows you to change the name of the column too).ALTER TABLE emp CHANGE COLUMN name name VARCHAR(100);
Friday, March 01, 2019
Linux Discover Teamviewer id
$sudo grep -n id /home/user/.local/share/teamviewer14/logfiles/TeamViewer14_Logfile.log
$whereis teamviewer
$/usr/bin/teamviewer help
$/usr/bin/teamviewer info #for get id too
$/usr/bin/teamviewer daemon stop
$/usr/bin/teamviewer setup
$/usr/bin/teamviewer daemon status
$/usr/bin/teamviewer daemon start
References:
[1] http://www.tonisoto.com/2013/07/launching-teamviewer-remotely-throught-ssh/
Thursday, February 28, 2019
mySql change port problem
Do you already have another mysqld server running on port: 13306 ?
Common solution is change my.cnf adding port=newport, but in what section?
Discover who is the principal executable
$locate mysqld.service
/etc/systemd/system/multi-user.target.wants/mysqld.service
/usr/lib/systemd/system/mysqld.service
$vi /usr/lib/systemd/system/mysqld.service #for watch settings
In my case, was this:
ExecStart=/usr/bin/mysqld_safe --basedir=/usr
then i know what section i need to change
$vi /etc/my.cnf # add new port in section [mysqld_safe]
Aditional commands during process:
tail -30 /var/log/mysql/error.log
sudo lsof -i TCP:3306
netstat -lp | grep 3306
$systemctl status iptables.service
$service iptables status
Wednesday, February 27, 2019
Ubuntu mySQL Backup/Restore
2) Restore
$mysql -u root -p mysql
> create database mydb; mysql
> use mydb; mysql
> source db_backup.dump;
3) Another way, you need to run:
$mysql -p -u[user] [database] < db_backup.dump
If the dump contains multiple databases you should omit the database name:
$mysql -p -u[user] < db_backup.dump
4) Restore specific database
$mysql -u onepoint -p --one-database maxx2016 < back_20190226.sql
Monday, February 25, 2019
Ubuntu Apache Django settings
References:
[1] main https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-16-04
[2] https://coderwall.com/p/ooerda/python-django-apache-ubuntu
[3] https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-debian-8
Fixing geopandas and osmnx problem: Could not find libspatialindex_c library file
Traceback (most recent call last):
File "
NameError: name 'find_library' is not defined
The solution is:
import ctypes
from ctypes.util import find_library
When you install environment and install geopandas, rtree and osmnx
pip install git+git://github.com/geopandas/geopandas.git
pip install rtree
pip install osmnx
No error, everythong aparently is ok, and you try to test$python
>>> import rtree
Traceback (most recent call last):
File "
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/__init__.py", line 1, in
from .index import Rtree
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/index.py", line 5, in
from . import core
File "/var/www/sampleapp/crivist/myEnv/lib/python3.5/site-packages/rtree/core.py", line 125, in
raise OSError("Could not find libspatialindex_c library file")
OSError: Could not find libspatialindex_c library file
You can solve using:
sudo apt install python3-rtree
But in some servers, you can't access to apt, then you decide do next commands:
$git clone https://github.com/libspatialindex/libspatialindex.git
$cd libspatialindex
$cmake --prefix=/usr .
$make
$sudo make install #You cannot install on system
CMake Error at src/cmake_install.cmake:52 (file):
file INSTALL cannot copy file
"/home/fincahuanaco/Temp/libspatialindex/bin/libspatialindex.so.5.0.0" to
"/usr/local/lib/libspatialindex.so.5.0.0".
Call Stack (most recent call first):
cmake_install.cmake:42 (include)
But you compile, then you have the link to file, then set next variable
export SPATIALINDEX_C_LIBRARY=environmentpath/lib/libspatialindex_c.so
Enjoy
References:
[1] geopandas http://geopandas.org/install.html
[2] python environment https://docs.python-guide.org/dev/virtualenvs/
[3] python environment 2 https://docs.python.org/3/tutorial/venv.html
Level Set Topics
References:
[1] Methods In (Bio)Medical Image Analysis 2019 https://www.cs.cmu.edu/~galeotti/methods_course/
Saturday, February 23, 2019
Thursday, February 21, 2019
Latex On Line
Latex online
[1] Single/public https://www.papeeria.com
[2] Latex/R/Python/Octave/Julia/Shell/GPU https://cocalc.com/
[3] Single
Latex & Octave http://www.verbosus.com/ #limit 4 resources
[4] Quick snap code to image quicklatex.com
Over google docs
http://docs.latexlab.org/
Single Compiler
[1] http://latex.informatik.uni-halle.de/latex-online/latex.php
[2] http://sciencesoft.at/latex/flatex.gsp?lang=en
After register
Unlimited https://www.sharelatex.com/
Monkey http://monkeytex.bradcater.webfactional.com/
Others References
[1] http://tex.stackexchange.com/questions/3/compiling-documents-online
[2] http://texblog.net/latex-link-archive/online-compiler/
Wednesday, February 20, 2019
Python 3D Interactive
[1] Python draw 2d and 3d http://jeffskinnerbox.me/notebooks/matplotlib-2d-and-3d-plotting-in-ipython.html
[2] Python 3D picking https://stackoverflow.com/questions/10424517/how-to-get-properties-of-picked-object-in-mplot3d-matplotlib-python
[3] Python mayavi picking http://docs.enthought.com/mayavi/mayavi/auto/example_pick_on_surface.html
[4] Python mayavi for 3D https://docs.enthought.com/mayavi/mayavi/mlab.html
Fedora 23 - Executing MONO Asp.NET MVC App
Table 'mysql.user' doesn't exist:ERROR
Or
ERROR 1146 (42S02): Table 'mysql.role_edges' doesn't exist
$mysql_upgrade -u root
Access problem (resolve inner mysql)
$mysql -u root -p
>show GRANTS FOR onepoint@localhost;
Execution problem
Turns out simply creating the folder using mkdir
$sudo mkdir /etc/mono/registry
$sudo chmod uog+rw /etc/mono/registry # setting the right permissions
Another way
You can set MONO_REGISTRY_PATH to point to a directory that you control:
$mkdir my-registry
$MONO_REGISTRY_PATH=`pwd`/my-registry
$xsp4
System.MissingMethodException Method 'RouteCollection.get_AppendTrailingSlash' not found.
[uxxx@sxxx MaxxCoreWeb]$ mono --version
Mono JIT compiler version 4.0.5 (Stable 4.0.5.1/1d8d582 Mon Jan 4 11:09:45 UTC 2016)
These message showed because the system was build in mono 4.5 and mono 4.2 (both are compatible
for me in my system), but in my case i installed mono 4, lastest on Fedora 23.
Command for update repository to Fedora 27, but after update still doesn't ran
$rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
$su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'
$dnf update
I removed mono and tried to install mono 5, mono 4.8 and mono 4.2, but i got error of conflicts. Then i executed next command:
$sudo dnf autoremove #for remove dependences
And tried again and was successful.
$ sudo dnf install mono-complete-4.8.1.0-0.xamarin.1.x86_64
References:
[1] Upgrade tips https://fedoraproject.org/wiki/DNF_system_upgrade
[2] mono https://www.mono-project.com/download/stable/#download-lin-fedora
Fedora 23 Services
$systemctl status sshd.service
$systemctl enable httpd.service
$systemctl disable service_name.service
$systemctl start service_name.service
$systemctl stop service_name.service
$systemctl restart service_name.service
$systemctl list-units --type=service
References:
[1] General info https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/infrastructure-services/Services_and_Daemons/
[2] List services https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/s1-services-running.html
Tuesday, February 19, 2019
Ubuntu mySQL Setting for remote access
$wget --verbose http://localhost:3306
$wget --verbose http://192.168.0.12:3306
or
$nmap -sV localhost
$nmap -sV 192.168.0.12
or
$sudo netstat -tulpn
or
$sudo iptables -L -n
2) Verify file /etc/mysql/conf.d/ #include other possibles files
$sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf #edit file and comment next line, or
$sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
3) Add user
mysql>select user, host, authentication_string from mysql.user;
mysql>SHOW GRANTS FOR 'onepoint'@'%'; #if not exist
mysql> CREATE USER 'onepoint'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON Maxx2018.* TO 'onepoint'@'localhost' WITH GRANT OPTION;
mysql>CREATE USER 'onepoint'@'%' IDENTIFIED BY 'password';
mysql>GRANT ALL PRIVILEGES ON *.* TO 'onepoint'@'%' WITH GRANT OPTION;
mysql>GRANT ALL PRIVILEGES ON *.* TO 'onepoint'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
4) Update user
mysql>flush privileges;
5) Common Errors
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
SET GLOBAL validate_password_policy=LOW;
You can edir /etc/mysql/my.cnf, but then you will have a security risk!
in [mysqld] add:
validate_password_policy=LOW
References:
[1] Firewall ubuntu https://stackoverflow.com/questions/30251889/how-to-open-some-ports-on-ubuntu
[2] https://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql
Fedora 29 mySQL
$sudo dnf --disablerepo=mysql80-community --enablerepo=mysql57-community install mysql-community-server
works too for Fedora 23 (Server Edition)
Problems
$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
$ sudo grep 'temporary password' /var/log/mysqld.log
Referencias:
[1] https://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
free VPN Service
Username: vpnbook
Password: rktbz9c
vpnbook (http://www.vpnbook.com/)
Username: vpnbook
Password: adv7ebeh
.ovpn files http://www.vpnbook.com/free-openvpn-account/VPNBook.com-OpenVPN-Euro1.zip
getusvpn (http://www.getusvpn.com/)
Notes:
After download OpenVPN Cliente on W7, run link (desktop) as Administrator.
References:
[1] top 5 http://www.zeropaid.com/news/94826/top-5-free-vpn-services/
[2] http://www.tuvpn.com/es/tutoriales/openvpn-en-windows7#step-0
[3] Setting openvpn - ES https://hide.me/es/vpnsetup/ubuntu/openvpn/
Monday, February 18, 2019
Planes Internet Perú
Movistar
www.movistar.com.pe/negocio/internet-seguridad/internet-empresarial
www.movistar.com.pe/hogar/internet/solo-internet
Claro
www.claro.com.pe/negocios/fijos/adicionales/direcciones-ip-publicas/
Sunday, February 17, 2019
Linux Fedora: Información de Hardware
Paso 1: #yum install lshw lshw-gtk
Paso 2: #lshw
Otra forma es compilando desde el código fuente, asi :
Paso 1:#wget http://ezix.org/software/files/lshw-B.02.12.01.tar.gz
Paso 2:#tar -xvfz lshw-release.tar.gz
Paso 3:#cd lshw-B.02.12.01/src
Paso 4:#make
Paso 5:#lshw
make gui , para instalar interfaz gráfica
CONSTRUIR RPM package:
#rpmbuild -ta lshw-release.tar.gz
#rpmbuild -ta --with gui lshw-release.tar.gz
Friday, February 15, 2019
Linux Mono C#
$mono-csc searchmono.cs /out:seachmono -r:/usr/lib/mono/4.5/System.Web.dll
Compiling with mySql connector library
$mono-csc mysqlmono.cs /out:mysqlmono -r:System.Data.dll -r:/path/.nuget/packages/mysql.data/8.0.13/lib/net452/MySql.Data.dll
References:
[1] Example https://www.codeproject.com/Articles/9407/Introduction-to-Mono-Your-first-Mono-app
[2] Converter tools
http://converter.telerik.com/
https://codeconverter.icsharpcode.net/
https://www.carlosag.net/tools/codetranslator/
[3] Mysql Connection https://www.mono-project.com/docs/database-access/providers/mysql/
Onde comprar no Brasil
Lojas online
[1] www.casasbahia.com.br
[2] www.extra.com.br
[3] www.americanas.com.br
[4] Notebook Accesories www.bringit.com.br
[5] www.kalunga.com.br
[6] Best Monitor prices than Notebook www.kabum.com.br
[7] Motos www.webmotors.com.br
Lojas remate
[1] www.saldaodainformatica.com.br
Wednesday, February 13, 2019
Ubuntu Services
sudo service --status-all
https://askubuntu.com/questions/912216/16-04-command-to-list-all-services-started-on-boot/912218
Linux small distro
Lubuntu
Linux Lite (based on Ubuntu/Testing)
Tiny Core (Testing), works for Raspberry Pi
Download:
Installation GUI:
$tce-load -wi Xvesa.tcz Xlibs.tcz Xprogs.tcz aterm.tcz flwm_topside.tcz wbar.tcz
$tce-load -wi Xorg-7.7 #if Xvesa not found
References:
[1] List of popular distros https://itsfoss.com/lightweight-linux-beginners/
[2] Comparison https://en.wikipedia.org/wiki/Light-weight_Linux_distribution
[3] Tiny Core installation https://iotbytes.wordpress.com/install-microcore-tiny-linux-on-local-disk/
[4] Tiny Core Packages http://distro.ibiblio.org/tinycorelinux/7.x/x86/tcz/
[5] Tiny Core Addin desktop http://wiki.tinycorelinux.net/wiki:adding_a_desktop_to_microcore
[6] WBar http://lxlinux.com/wbar.html
Monday, February 11, 2019
Ubuntu 16 - Setting PDF Printer
List of printers installed
$ls /etc/cups/ppd
Manually
Device URI:cups-pdf:/
By Command Line (Partial tested)
lpadmin -h localhost -p cups-pdf -v cups-pdf:/ -P /usr/share/cups/model/CUPS-PDF.ppd -E
Setting file (output/destination)
/etc/cups/cups-pdf.conf
Status Idle - File "/usr/lib/cups/backend/cups-pdf" has insecure permissions
$chmod 700 /usr/lib/cups/backend/cups-pdf
Null Printer
Device URI: file:/dev/null
References:
[1] Complete info https://en.opensuse.org/SDB:Printing_to_PDF
[2] openSUSE compile cups-pdf and ppd file https://pawn.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/documentation.shtml
[3] CUPS PDF-WRITER Backend on Suse https://www.novell.com/coolsolutions/feature/17636.html
[4] Fake printer https://superuser.com/questions/304670/how-to-add-a-fake-dummy-null-printer-in-cups
[5] Install cups-pdf http://www.debianadmin.com/howto-install-and-customize-cups-pdf-in-debian.html
Tuesday, February 05, 2019
Fedora 29 Network Settings
[1] https://alchemist.digital/articles/configure-a-static-ip-address-on-fedora-24-25/
Fedora 29 firewalld settings
$sudo service firewalld start
$sudo
firewall-cmd --list-all
$sudo
firewall-cmd --get-zones
$sudo
sudo firewall-cmd --zone=home --list-all
$sudo
firewall-cmd --get-default-zone
$sudo
firewall-cmd --get-active-zones
$sudo firewall-cmd --add-port=8081/tcp --permanent
$sudo firewall-cmd --add-port=8081/udp --permanent
$sudo firewall-cmd --reload #important in Fedora 23 (VPS)
References:
[1] firewall-cmd https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sec-Open_Ports_in_the_firewall-CLI.html
[2] other firewall-cmd https://www.hiroom2.com/2017/07/12/fedora-26-firewalld-en/
[3] zones https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
Monday, February 04, 2019
Fedora - mySQL restoring root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
#service mysqld stop // id doesn't stop run #mysqladmin -u root -p shutdown
#mysqld_safe --skip-grant-tables &
#mysql -u root
> use mysql;
> update user set password=PASSWORD("mynewpassword") where User='root';
> flush privileges;
> quit
#service mysqld stop
#service mysqld start &
if mysqld_safe not exist (updated 2019)
# systemctl stop mysqld
# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
# systemctl start mysqld
$ mysql -u root
get temporaly password (updated 2019)
$sudo grep 'temporary password' /var/log/mysqld.log
A temporary password is generated for root@localhost: cvcvcv
$mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.htmlreference:
http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password
Sunday, January 27, 2019
Thursday, January 17, 2019
Monday, January 14, 2019
Ubuntu Memory type ddr2 ddr3
$ sudo dmidecode --type 17
$ sudo lshw -short -C memory
From [1]
DDR1: 2.5 V, 133–200 MHz
DDR2: 200–400 MHz
DDR3: 1.5 V, 400–800 MHz (up to 1400 MHz for super-high-end)
DDR4: 1.2 V, 2133–4266 MHz
For example: if shows up in lshw -short -C memory
as simply 16GiB DIMM Synchronous 2133 MHz (0.5 ns)
. The MHz rating indicates that it's almost certainly DDR4. References:
[1] memory types http://en.wikipedia.org/wiki/Synchronous_dynamic_random-access_memory#Generations_of_SDRAM
[2]
Tuesday, January 08, 2019
Ubuntu upgrade from i386 to x86_64
Wednesday, December 19, 2018
Wednesday, December 12, 2018
Tuesday, December 04, 2018
Tensor resources
References:
[1] Tensor decomposition https://www.slideshare.net/panisson/tensor-decomposition-with-python
[2] Tensores (sp) http://bibing.us.es/proyectos/abreproy/12082/fichero/Cap%C3%ADtulo3.pdf
Friday, November 30, 2018
Ubuntu 16 OpenCV 2.4
./configure --enable-nonfree --enable-pic --enable-shared
Download ffmpeg and build 3.4.5, 3.2.12 or 4.0 and try to compile opencv doesn't help, then
Final solution: disable ffmpeg
$cmake -D WITH_CUDA=OFF -D WITH_FFMPEG=0 ..
$make
That compile opencv 2.4.x and 3.4.x
References:
[1] Error sys/videoio.h not found problem http://yutopapa.hatenadiary.com/entry/2017/06/08/173149
Tuesday, November 27, 2018
ASP.NET MVC Mono
.Net Framework 4.5.2 using project properties
Mysql.Data.Entity using NuGet(6.10.8)
Setup Web.config
Fix version of entry System.Web.Mvc.MvcWebRazorHostFactory at views/Web.config
Classes
//Ado
using System;
using System.Data.Entity;
using MySQLEntity.Models;
namespace MySQLEntity.Entity
{
public class MyDb : DbContext
{
public MyDb() : base("ferredb")
//public MyDb() : base(nameOrConnectionString: "ferredb")
{
}
public DbSet
}
}
//Entity
using System;
//Added
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace MySQLEntity.Models
{
[Table("Users")]
public class Usuario
{
[Key]
public string usuario { get; set; }
public string apenom { get; set; }
}
}
Controller Snippet code
public ActionResult Index()
{
MyDb db = new MyDb();
var Model=db.Usuarios.ToList();
return View(Model);
}
View Snippet code
@foreach (var item in Model)
{
<div> @item.usuario @item.apenom </div>
Action results
References:
[1] MySQL EntityFramework web.config https://iyalovoi.wordpress.com/2015/04/06/entity-framework-with-mysql-on-mac-os/
[2] Action results
https://www.c-sharpcorner.com/article/different-types-of-action-results-in-asp-net-mvc/
[3] ViewBag better than DataView http://www.tutorialsteacher.com/mvc/viewbag-in-asp.net-mvc
Monday, November 26, 2018
mySQL Develop Optimization
Select * from MOVPRO where fecmov>='2018-11-25' and tipmov='S'
EXPLAIN Select * from MOVPRO where fecmov>='2018-11-25' and tipmov='S'
CREATE INDEX MOVPRO_fecmov_tipmov_index ON MOVPRO (fecmov,tipmov)
References:
[1] faster using indexes https://blog.nodeswat.com/making-slow-queries-fast-with-composite-indexes-in-mysql-eb452a8d6e46
python3 using mysql connection
$pip3 install mysql-connector-python --user
from mysql.connector import (connection)
cnx=connection.MySQLConnection(user='user', password='*******',
host='ip', database='db')
cnx.close()
Resources:
[1] https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html
API Testing
References
[1] postman https://steelkiwi.com/blog/api-testing-useful-tools-postman-tutorial-and-hints/
Water Simulation
[1] 2D SPH https://github.com/tizian/SPH-Water-Simulation
$sudo apt-cache search sfml
$sudo apt-get install libsfml-dev
#change for's
$make
$./sph
[2] WebGL water simulation https://experiments.withgoogle.com/webgl-water-simulation
[3] Google webgl https://experiments.withgoogle.com/search?q=fluid
[3.1] http://david.li/fluid/
[3.2] http://madebyevan.com/webgl-water/
[4] 3D Simulation/Animation/Fluids and more https://www.fetchcfd.com/search-projects/type/cfd
Related:
[1] Stanford su2 https://su2code.github.io/
[2] Multiple Interacting Fluids https://www.yiningkarlli.com/projects/multifluid.html
São Carlos to Guarulhos
1) Expensive alternative
São Carlos - SP to Rodoviária Tietê, São Paulo - SP 66.53R
https://passagemcometa.com.br
São Carlos - SP to Rodoviária Tietê, São Paulo - SP 66.55R
http://www.empresacruz.com.br
São Paulo - Tietê - SP to Aeroporto de Guarulhos 37.00R
http://www.airportbusservice.com.br/
2) Cheap alternative
São Carlos - SP to Campinas - SP 40.53R
https://passagemcometa.com.br
São Carlos - SP to Campinas - SP 40.55R
http://www.empresacruz.com.br
Campinas-SP to Aeroporto de Guarulhos-SP 42.75R
https://www.buscaonibus.com.br
Thursday, November 15, 2018
English Tools
English test - Duolingo
[1] https://englishtest.duolingo.com/applicants
Lessons
[1] https://webapps.towson.edu/ows/activepass.htm
e-Books
[1] http://www.kosstu.kz/static/uploads/library/gumanitar/english/g-e-91.pdf
http://www.kosstu.kz/static/uploads/library/gumanitar/english/
[2] English Grammar In Use for Raymond Murphy. https://golammartoza.files.wordpress.com/2016/02/english-grammar-in-use-intermediate001.pdf
Online grammar
[1] http://www.gingersoftware.com/grammarcheck
[2] http://www.grammarcheck.net/editor/
Aditional helps
[1] https://www.websiteplanet.com/blog/talking-aloud-talking-allowed-watch-write-make-sure-right/
[2] For Presentation
[2.1] Presentation Skills for Scientists
Thursday, November 08, 2018
Tuesday, October 30, 2018
Thursday, October 11, 2018
Filtering
References:
[1] http://cattedraledigitale.isti.cnr.it
2012 Bilateral filters https://onlinelibrary.wiley.com/doi/full/10.1111/j.1467-8659.2011.02078.x
[2] http://files.is.tue.mpg.de/pgehler/assets/publications/jampani16learning/jampani16learning.pdf
[3] https://zapdf.com/fast-high-dimensional-filtering-using-clustering.html
[6] http://www.inf.ufrgs.br/~oliveira/students_dissertations/PhD/Eduardo_Gastal_PhD_Dissertation.pdf
[7] https://is.tuebingen.mpg.de/uploads_file/attachment/attachment/259/0766_cameraready.pdf
[8] http://www.scitepress.org/Papers/2016/57151/57151.pdf
[9] http://vision.ai.illinois.edu/publications/yangijcv2015.pdf
http://openaccess.thecvf.com/content_cvpr_2018/papers/Wu_Fast_End-to-End_Trainable_CVPR_2018_paper.pdf
http://perso.ensta-paristech.fr/~manzaner/Publis/icpr10.pdf
http://www.cs.cityu.edu.hk/~rynson/papers/tcsvt16a.pdf
https://arxiv.org/pdf/1505.00077.pdf
https://fukushima.web.nitech.ac.jp/paper/2016_visapp_fujita.pdf
http://www.riken.jp/brict/Yoshizawa/Papers/cgf09yby.pdf
High-dimensional integration without Markov chains, Alexander gray
https://www.cs.ubc.ca/~nando/nipsfast/slides/high.pdf
Fast edge-preserving/-aware high dimensional filters for image & video processing https://www.slideshare.net/yuhuang/fast-edge-preservingaware-high-dimensional-filters-for-image-video-processing
Aditional
[1] Parallel methods for Numeric Analysis http://adl.stanford.edu/cme342/Home.html
[2] Fast Multipole Methods https://www.math.uci.edu/~chenlong/MathPKU/FMMsimple.pdf
Resources
[1] ImageStack https://code.google.com/archive/p/imagestack/
https://github.com/abadams/imagestack
[2] RGBD Utils, use ImageStack https://github.com/s-gupta/rgbdutils
[3] Recursive bilateral filtering https://github.com/ufoym/RecursiveBF
./rbf girl_out.bmp girl.bmp 0.1 0.04
file https://media.macphun.com/img/uploads/uploads/macphun/noiseless/nl_slider_1_b.jpg
[4] Bilateral grid http://groups.csail.mit.edu/graphics/bilagrid/
[5] Bilateral upsampling http://people.csail.mit.edu/jiawen/
Python tools
[1] ndimage 3D convolution https://docs.scipy.org/doc/scipy-0.16.0/reference/ndimage.html
Friday, September 28, 2018
video face fake
Resources:
[1] Original article (pt) https://medium.com/ensina-ai/deep-fakes-ao-vivo-que-tal-entrar-em-uma-video-confer%C3%AAncia-com-o-rosto-de-outra-pessoa-92fc8c2d5726
[2] source code using docker https://github.com/alew3/faceit_live
Monday, September 24, 2018
opengl compile error
https://github.com/MarcusMathiassen/P2D
$g++ Circle.cpp getTime64.cpp Process.cpp Utility.cpp Color.cpp hwinfo.cpp Inputs.cpp Quadtree.cpp Vec2.cpp Config.cpp main.cpp Rect.cpp FixedGrid.cpp Node.cpp Render.cpp -I ../include/ -lGL -lglut -lGLU -lGLEW -lpthread -lX11 -lglfw -o q5
error while loading shared libraries: libGLEW.so.2.1: cannot open shared object file: No such file or directory
$sudo apt-get install libglew-dev
$locate libGLEW.so.2.1
...
/usr/lib64/libGLEW.so.2.1.0
/usr/local/lib/libGLEW.so.2.1
/usr/local/lib/libGLEW.so.2.1.0
...
...
sudo vi /etc/ld.so.conf.d/glew.conf
/usr/local/lib
$sudo ldconfig
Resources:
[1] https://sourceforge.net/projects/glew/files/glew/snapshots/
Wednesday, September 19, 2018
Delaunay Resources
Delaunay
[1] http://www.cs.uu.nl/docs/vakken/ga/slides9alt.pdf
[1.1] Geometric Algorithms
http://www.cs.uu.nl/docs/vakken/ga/
[2] Geometric modeling codes* http://jeffe.cs.illinois.edu/compgeom/code.html
[3] Hexahedral mesh https://www.hextreme.eu/download/
[4] Delaunay 3D https://github.com/ashwin/gDel3D
[5] Delaunay 3D https://github.com/ashwin/gStar4D
[6] Delaunay 2D/3D https://github.com/mikolalysenko/delaunay-triangulate
[7] D3D for C++ http://www.geom.at/fade3d/html/
Friday, September 14, 2018
3D Models & tools
1) Open .obj 3D format
view3dscene
$sudo apt-get install view3dscene
meshlab - System for processing and editing triangular meshes
$sudo apt-get install meshlab
g3dviewer
$sudo apt-get install g3dviewer
Other tools
- glc_player which is said to read-and-show '.3ds', '.obj', '.stl', '.off', '.3dxml', and Collada ('.dae') files
- g3dviewer which is said to read-and-show '.3ds', '.lwo', '.obj', '.dxf', '.md2', '.md3', '.wrl', '.vrml', '.dae' (COLLADA), '.ase' (ASCII Scene Exporter), '.ac' (AC3D)
- ivview which reads-and-shows '.iv' and VRML1 files
- paraview which reads-and-shows '.ply' and '.vt*' files
- varicad-view which reads-and-shows '.dwg' (2D), '.dxf' (2D only?), '.igs' (maybe?), '.stp' (3D) files
- wings3d - Nendo-inspired 3D polygon mesh modeller (legacy)
- gmsh - Three-dimensional finite element mesh generator
- libadmesh-dev - Tool for processing triangulated solid meshes.
- libgmsh-dev - Three-dimensional finite element mesh generator.
- libmadlib-dev - mesh adaptation library
- libnglib-dev - Automatic 3d tetrahedral mesh generator development files
- libscotch-dev - programs and libraries for graph, mesh and hypergraph partitioning
- netgen - Automatic 3d tetrahedral mesh generator
- libtriangle-dev - High-quality 2-D mesh generator development files
[1] mview http://mview.sourceforge.net/
Models
[1] .max, .obj, blender, etc. www.turbosquid.com
[1] http://tf3dm.com/
Thursday, September 13, 2018
Python extending functions from C/C++
References
[1] https://docs.python.org/3/library/ctypes.html
https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
https://opensourceforu.com/2010/05/extending-python-via-shared-libraries/
https://en.wikibooks.org/wiki/Python_Programming/Extending_with_C%2B%2B
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
Thursday, September 06, 2018
Wednesday, September 05, 2018
pip3 ImportError: cannot import name 'main'
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
Sunday, September 02, 2018
quadtree
[1] http://www.lcad.icmc.usp.br/~jbatista/procimg/quadtree_neighbours.pdf
[2] http://homepage.divms.uiowa.edu/~kvaradar/sp2012/daa/ann.pdf
[3] http://web.archive.org/web/20120907211934/http://ww1.ucmss.com/books/LFS/CSREA2006/MSV4517.pdf
[3] operations cost https://arxiv.org/pdf/1712.05591.pdf
Resources:
[1] quadtree neighbors https://bl.ocks.org/mbostock/4343214
[2] neighbors https://gist.github.com/patricksurry/6478178
[3] neighbors https://github.com/geidav/quadtree-neighbor-finding/blob/master/neighbors.py
[4] https://geidav.wordpress.com/2017/12/02/advanced-octrees-4-finding-neighbor-nodes/
[5] for check https://github.com/xoolive/quadtree
[6] gaussian kd-tree https://www.cg.tuwien.ac.at/courses/Visualisierung2/HallOfFame/2012/7-Labschuetz/Homepage/index.html#References
[7] quadtree over CUDA source code http://ecee.colorado.edu/~siewerts/extra/code/example_code_archive/a490dmis_code/CUDA/cuda_work/samples/Samples.html
Thursday, August 30, 2018
Linux: mount folder to different folders
mount -o bind /media/disk1/pictures /home/user1/pictures mount -o bind /media/disk1/pictures /home/user2/pictures
/media/disk1/pictures /home/add1cker/pictures none defaults,bind 0 0
Sunday, August 26, 2018
OpenGL Tutorial
$sudo apt-get install freeglut3-dev
Matrix Class [3]
Error:
_dl_check_map_versions: Assertion `needed != ((void *)0)' failed!
Fixed using -lpthread parameter [2].
References:
[1] https://www.opengl.org/wiki/Programming_OpenGL_in_Linux:_GLX_and_Xlib
[2] http://stackoverflow.com/questions/20007961/error-running-a-compiled-c-file-uses-opengl-error-inconsistency-detected
[3] http://www.songho.ca/opengl/index.html
http://www.songho.ca/opengl/gl_matrix.html#example1
[4] Image Libraries
https://www.opengl.org/wiki/Image_Libraries
[5] SFML
http://www.sfml-dev.org/tutorials/2.3/start-linux.php
Wednesday, August 22, 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/
Monday, August 20, 2018
Thursday, August 16, 2018
Optimize code C/C++
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
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
-
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/...
Odoo 17 - Custom adds
[1] Diario/Seq https://apps.odoo.com/apps/modules/17.0/sequence_for_journal