Friday, November 30, 2018

Ubuntu 16 OpenCV 2.4

Problems during compilation:

relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object

Solution:
recompile ffmpeg-3.4.5 with(2018-11-29):
./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

Settings at 11/2018

.Net Framework 4.5.2 using project properties
Mysql.Data.Entity using NuGet(6.10.8)

Setup Web.config

<!--Added--> 
<configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections> 
<connectionStrings> 
  <add name="ferredb" connectionString="server=127.0.0.1;Port=3306;Database=ferre;Uid=root;Pwd=Microsoft;" providerName="MySql.Data.MySqlClient"/> </connectionStrings> 
<!--Added--> 
<entityFramework> 
<providers> 
  <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
  </provider> 
</providers> 
</entityFramework> 
<!--Added--> 
<system.data> 
<DbProviderFactories> <remove invariant="MySql.Data.MySqlClient" /> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> 
 </DbProviderFactories> 
</system.data>

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<Usuario> Usuarios { get; set; }
}


}


//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
Types

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

Compiling Sources:
[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 08, 2018

Physics resources

Physic Courses
[1] Cursos de Graduação em Engenharia do ITA http://www.ief.ita.br/~rrpela/

Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com